mEmcGeaEventModule.C

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