mEmcGeaTowerEvalModule.C

Go to the documentation of this file.
00001 #include "mEmcGeaTowerEvalModule.h"
00002 
00003 #include "dEmcGeometryWrapper.h"
00004 
00005 #include "dEmcEventWrapper.h"
00006 
00007 #include "dEmcCalibTowerWrapper.h"
00008 
00009 #include "dEmcGeaTrackWrapper.h"
00010 
00011 #include "dEmcGeaTowerTrackWrapper.h"
00012 
00013 #include "dEmcGeaTowerEvalWrapper.h"
00014 
00015 #include "PHNode.h"
00016 #include "PHCompositeNode.h"
00017 #include "PHIODataNode.h"
00018 #include "PHNodeIterator.h"
00019 #include "PHTable.hh"
00020 
00021 #include <iostream>
00022 using namespace std;
00023 
00024 typedef PHIODataNode<PHTable> TableNode_t;
00025 PHBoolean
00026 mEmcGeaTowerEvalModule::event(PHCompositeNode *root) {
00027  PHPointerList<PHNode> nodes;
00028  PHNodeIterator i(root), *j;
00029  PHNode *n;
00030  TableNode_t *d;
00031  PHTable *w;
00032  PHCompositeNode *parNode, *emcNode, *evaNode, *dstNode, *outNode;
00033 
00034  parNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "PAR"));
00035  if (!parNode) {
00036    parNode = new PHCompositeNode("PAR");
00037    root->addNode(parNode);
00038  }
00039 
00040  emcNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "EMC"));
00041  if (!emcNode) {
00042    emcNode = new PHCompositeNode("EMC");
00043    root->addNode(emcNode);
00044  }
00045 
00046  dstNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "DST"));
00047  if (!dstNode) {
00048    dstNode = new PHCompositeNode("DST");
00049    root->addNode(dstNode);
00050  }
00051 
00052  evaNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "EVA"));
00053  if (!evaNode) {
00054    evaNode = new PHCompositeNode("EVA");
00055    root->addNode(evaNode);
00056  }
00057 
00058 
00059 // Insert code here to navigate node hierarchy and find
00060 // or create specific nodes to pass to physics module...
00061 
00062   outNode = parNode;
00063   n = i.findFirst("PHIODataNode", "dEmcGeometry");
00064   if (!n) {
00065     cout << "ERROR:  'in' parameter dEmcGeometry not found" << endl;
00066      w = new dEmcGeometryWrapper("dEmcGeometry", 30000);
00067      if (!w) {
00068        return 1;
00069      }
00070      n = new TableNode_t(w,"dEmcGeometry");
00071      outNode->addNode(n);
00072   }
00073   nodes.append(n);
00074 
00075   outNode = emcNode;
00076   n = i.findFirst("PHIODataNode", "dEmcEvent");
00077   if (!n) {
00078     cout << "ERROR:  'in' parameter dEmcEvent not found" << endl;
00079      w = new dEmcEventWrapper("dEmcEvent", 1);
00080      if (!w) {
00081        return 1;
00082      }
00083      n = new TableNode_t(w,"dEmcEvent");
00084      outNode->addNode(n);
00085   }
00086   nodes.append(n);
00087 
00088   outNode = dstNode;
00089   n = i.findFirst("PHIODataNode", "dEmcCalibTower");
00090   if (!n) {
00091     cout << "ERROR:  'in' parameter dEmcCalibTower not found" << endl;
00092      w = new dEmcCalibTowerWrapper("dEmcCalibTower", 10000);
00093      if (!w) {
00094        return 1;
00095      }
00096      n = new TableNode_t(w,"dEmcCalibTower");
00097      outNode->addNode(n);
00098   }
00099   nodes.append(n);
00100 
00101   outNode = evaNode;
00102   n = i.findFirst("PHIODataNode", "dEmcGeaTrack");
00103   if (!n) {
00104     cout << "ERROR:  'in' parameter dEmcGeaTrack not found" << endl;
00105      w = new dEmcGeaTrackWrapper("dEmcGeaTrack", 10);
00106      if (!w) {
00107        return 1;
00108      }
00109      n = new TableNode_t(w,"dEmcGeaTrack");
00110      outNode->addNode(n);
00111   }
00112   nodes.append(n);
00113 
00114   outNode = evaNode;
00115   n = i.findFirst("PHIODataNode", "dEmcGeaTowerTrack");
00116   if (!n) {
00117     cout << "ERROR:  'in' parameter dEmcGeaTowerTrack not found" << endl;
00118      w = new dEmcGeaTowerTrackWrapper("dEmcGeaTowerTrack", 15000);
00119      if (!w) {
00120        return 1;
00121      }
00122      n = new TableNode_t(w,"dEmcGeaTowerTrack");
00123      outNode->addNode(n);
00124   }
00125   nodes.append(n);
00126 
00127   outNode = evaNode;
00128   j = new PHNodeIterator(outNode);
00129   if (!(d = static_cast<TableNode_t*>(j->findFirst("PHIODataNode","dEmcGeaTowerEval")))) {
00130      w = new dEmcGeaTowerEvalWrapper("dEmcGeaTowerEval", 10);
00131      if (!w) {
00132        return 1;
00133      }
00134      d = new TableNode_t(w,"dEmcGeaTowerEval");
00135      outNode->addNode(d);
00136   }
00137   delete j;
00138   nodes.append(d);
00139 
00140   return callPAM(nodes);
00141 }