mEmcCalibTowerModule.C

Go to the documentation of this file.
00001 #include "mEmcCalibTowerModule.h"
00002 
00003 #include "dEmcRawDataWrapper.h"
00004 
00005 #include "dEmcGeometryWrapper.h"
00006 
00007 #include "dEmcEventWrapper.h"
00008 
00009 #include "dEmcCalibTowerWrapper.h"
00010 
00011 #include "PHNode.h"
00012 #include "PHCompositeNode.h"
00013 #include "PHIODataNode.h"
00014 #include "PHNodeIterator.h"
00015 #include "PHTable.hh"
00016 #include <iostream>
00017 
00018 using namespace std;
00019 
00020 typedef PHIODataNode<PHTable> TableNode_t;
00021 
00022 // Default constructor and destructor to pacify CINT
00023 mEmcCalibTowerModule::mEmcCalibTowerModule()
00024 {
00025   name = "mEmcCalibTowerModule";
00026 }
00027 
00028 PHBoolean
00029 mEmcCalibTowerModule::event(PHCompositeNode *root) {
00030  PHPointerList<PHNode> nodes;
00031  PHNodeIterator i(root), *j;
00032  PHNode *n;
00033  TableNode_t *d;
00034  PHTable *w;
00035  PHCompositeNode *parNode, *emcNode, *dstNode, *outNode;
00036 
00037  parNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "PAR"));
00038  if (!parNode) {
00039    parNode = new PHCompositeNode("PAR");
00040    root->addNode(parNode);
00041  }
00042 
00043  emcNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "EMC"));
00044  if (!emcNode) {
00045    emcNode = new PHCompositeNode("EMC");
00046    root->addNode(emcNode);
00047  }
00048 
00049  dstNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "DST"));
00050  if (!dstNode) {
00051    dstNode = new PHCompositeNode("DST");
00052    root->addNode(dstNode);
00053  }
00054 
00055 // Insert code here to navigate node hierarchy and find
00056 // or create specific nodes to pass to physics module...
00057 
00058  outNode = emcNode;
00059   n = i.findFirst("PHIODataNode", "dEmcRawData");
00060   if (!n) {
00061     cout << "ERROR:  'in' parameter dEmcRawData not found" << endl;
00062      w = new dEmcRawDataWrapper("dEmcRawData", 25000);
00063      if (!w) {
00064        return 1;
00065      }
00066      n = new TableNode_t(w,"dEmcRawData");
00067      outNode->addNode(n);
00068   }
00069   nodes.append(n);
00070 
00071   outNode = parNode;
00072   n = i.findFirst("PHIODataNode", "dEmcGeometry");
00073   if (!n) {
00074     cout << "ERROR:  'inout' parameter dEmcGeometry not found" << endl;
00075      w = new dEmcGeometryWrapper("dEmcGeometry", 30000);
00076      if (!w) {
00077        return 1;
00078      }
00079      n = new TableNode_t(w,"dEmcGeometry");
00080      outNode->addNode(n);
00081   }
00082   nodes.append(n);
00083 
00084   outNode = emcNode;
00085   n = i.findFirst("PHIODataNode", "dEmcEvent");
00086   if (!n) {
00087     cout << "ERROR:  'inout' parameter dEmcEvent not found" << endl;
00088      w = new dEmcEventWrapper("dEmcEvent", 1);
00089      if (!w) {
00090        return 1;
00091      }
00092      n = new TableNode_t(w,"dEmcEvent");
00093      outNode->addNode(n);
00094   }
00095   nodes.append(n);
00096 
00097   outNode = dstNode;
00098   j = new PHNodeIterator(outNode);
00099   if (!(d = static_cast<TableNode_t*>(j->findFirst("PHIODataNode","dEmcCalibTower")))) {
00100      w = new dEmcCalibTowerWrapper("dEmcCalibTower", 25000);
00101      if (!w) {
00102        return 1;
00103      }
00104      d = new TableNode_t(w,"dEmcCalibTower");
00105      outNode->addNode(d);
00106   }
00107   delete j;
00108   nodes.append(d);
00109 
00110   return callPAM(nodes);
00111 }