mEmcGeaTrackModule.C

Go to the documentation of this file.
00001 #include "mEmcGeaTrackModule.h"
00002 
00003 #include "dEmcGeaTrackTowerWrapper.h"
00004 
00005 #include "dEmcGeaTrackWrapper.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 // Default constructor and destructor to pacify CINT
00019 mEmcGeaTrackModule::mEmcGeaTrackModule()
00020 {
00021   name = "mEmcGeaTrackModule";
00022 }
00023 
00024 PHBoolean
00025 mEmcGeaTrackModule::event(PHCompositeNode *root) {
00026  PHPointerList<PHNode> nodes;
00027  PHNodeIterator i(root), *j;
00028  PHNode *n;
00029  TableNode_t *d;
00030  PHTable *w;
00031  PHCompositeNode *evaNode, *outNode;
00032 
00033  evaNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "EVA"));
00034  if (!evaNode) {
00035    evaNode = new PHCompositeNode("EVA");
00036    root->addNode(evaNode);
00037  }
00038 
00039 
00040 // Insert code here to navigate node hierarchy and find
00041 // or create specific nodes to pass to physics module...
00042 
00043   outNode = evaNode;
00044   n = i.findFirst("PHIODataNode", "dEmcGeaTrackTower");
00045   if (!n) {
00046     cout << "ERROR:  'in' parameter dEmcGeaTrackTower not found" << endl;
00047      w = new dEmcGeaTrackTowerWrapper("dEmcGeaTrackTower", 7500);
00048      if (!w) {
00049        return 1;
00050      }
00051      n = new TableNode_t(w,"dEmcGeaTrackTower");
00052      outNode->addNode(n);
00053   }
00054   nodes.append(n);
00055 
00056   outNode = evaNode;
00057   j = new PHNodeIterator(outNode);
00058   if (!(d = static_cast<TableNode_t*>(j->findFirst("PHIODataNode","dEmcGeaTrack")))) {
00059      w = new dEmcGeaTrackWrapper("dEmcGeaTrack", 10);
00060      if (!w) {
00061        return 1;
00062      }
00063      d = new TableNode_t(w,"dEmcGeaTrack");
00064      outNode->addNode(d);
00065   }
00066   delete j;
00067   nodes.append(d);
00068 
00069   return callPAM(nodes);
00070 }