mEmcRawToFEMModule.C

Go to the documentation of this file.
00001 #include "mEmcRawToFEMModule.h"
00002 
00003 #include "dEmcRawDataWrapper.h"
00004 
00005 #include "dEmcFEMDataWrapper.h"
00006 
00007 #include "PHNode.h"
00008 #include "PHCompositeNode.h"
00009 #include "PHIODataNode.h"
00010 #include "PHNodeIterator.h"
00011 #include "PHTable.hh"
00012 
00013 #include <iostream>
00014 using namespace std;
00015 
00016 typedef PHIODataNode<PHTable> TableNode_t;
00017 
00018 PHBoolean
00019 mEmcRawToFEMModule::event(PHCompositeNode *root) {
00020  PHPointerList<PHNode> nodes;
00021  PHNodeIterator i(root), *j;
00022  PHNode *n;
00023  TableNode_t *d;
00024  PHTable *w;
00025  PHCompositeNode *emcNode, *outNode;
00026 
00027  emcNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "EMC"));
00028  if (!emcNode) {
00029    emcNode = new PHCompositeNode("EMC");
00030    root->addNode(emcNode);
00031  }
00032 
00033 // Insert code here to navigate node hierarchy and find
00034 // or create specific nodes to pass to physics module...
00035 
00036  outNode = emcNode;
00037   n = i.findFirst("PHIODataNode", "dEmcRawData");
00038   if (!n) {
00039     cout << "ERROR:  'in' parameter dEmcRawData not found" << endl;
00040      w = new dEmcRawDataWrapper("dEmcRawData", 15000);
00041      if (!w) {
00042        return 1;
00043      }
00044      n = new TableNode_t(w,"dEmcRawData");
00045      outNode->addNode(n);
00046   }
00047   nodes.append(n);
00048 
00049   outNode = emcNode;
00050   j = new PHNodeIterator(outNode);
00051   if (!(d = static_cast<TableNode_t*>(j->findFirst("PHIODataNode","dEmcFEMData")))) {
00052      w = new dEmcFEMDataWrapper("dEmcFEMData", 500);
00053      if (!w) {
00054        return 1;
00055      }
00056      d = new TableNode_t(w,"dEmcFEMData");
00057      outNode->addNode(d);
00058   }
00059   delete j;
00060   nodes.append(d);
00061 
00062   return callPAM(nodes);
00063 }