00001 #include <iostream>
00002 #include "PHNode.h"
00003 #include "PHCompositeNode.h"
00004 #include "PHIODataNode.h"
00005 #include "PHNodeIterator.h"
00006 #include "PHTable.hh"
00007 #include "mEmcDCMinputModule.h"
00008
00009 #include "dEmcDCMDataWrapper.h"
00010 typedef PHIODataNode<PHTable> TableNode_t;
00011
00012 PHBoolean
00013 mEmcDCMinputModule::event(PHCompositeNode *root) {
00014 PHPointerList<PHNode> nodes;
00015 PHNodeIterator i(root), *j;
00016
00017 TableNode_t *d;
00018 PHTable *w;
00019 PHCompositeNode *dstNode, *outNode;
00020
00021 dstNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "DST"));
00022 if (!dstNode) {
00023 dstNode = new PHCompositeNode("DST");
00024 root->addNode(dstNode);
00025 }
00026
00027
00028
00029
00030 outNode = dstNode;
00031 j = new PHNodeIterator(outNode);
00032 if (!(d = static_cast<TableNode_t*>(j->findFirst("PHIODataNode","dEmcDCMData")))) {
00033 w = new dEmcDCMDataWrapper("dEmcDCMData", 500);
00034 if (!w) {
00035 return 1;
00036 }
00037 d = new TableNode_t(w,"dEmcDCMData");
00038 outNode->addNode(d);
00039 }
00040 delete j;
00041 nodes.append(d);
00042
00043 return callPAM(nodes);
00044 }