mEmcEventModule.C

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