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