mEmcDefGeomModule.C

Go to the documentation of this file.
00001 #include "mEmcDefGeomModule.h"
00002 
00003 #include "dEmcGeaParamsWrapper.h"
00004 
00005 #include "dEmcGeometryWrapper.h"
00006 
00007 
00008 #include "PHNode.h"
00009 #include "PHCompositeNode.h"
00010 #include "PHIODataNode.h"
00011 #include "PHNodeIterator.h"
00012 #include "PHTable.hh"
00013 
00014 #include <iostream>
00015 using namespace std;
00016 
00017 typedef PHIODataNode<PHTable> TableNode_t;
00018 
00019 PHBoolean
00020 mEmcDefGeomModule::event(PHCompositeNode *root) {
00021  PHPointerList<PHNode> nodes;
00022  PHNodeIterator i(root), *j;
00023  PHNode *n;
00024  TableNode_t *d;
00025  PHTable *w;
00026  PHCompositeNode *parNode, *emcNode, *dstNode, *outNode;
00027 
00028  parNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "PAR"));
00029  if (!parNode) {
00030    parNode = new PHCompositeNode("PAR");
00031    root->addNode(parNode);
00032  }
00033 
00034  emcNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "EMC"));
00035  if (!emcNode) {
00036    emcNode = new PHCompositeNode("EMC");
00037    root->addNode(emcNode);
00038  }
00039 
00040  dstNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "DST"));
00041  if (!dstNode) {
00042    dstNode = new PHCompositeNode("DST");
00043    root->addNode(dstNode);
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 = parNode;
00050   n = i.findFirst("PHIODataNode", "dEmcGeaParams");
00051   if (!n) {
00052     cout << "ERROR:  'in' parameter dEmcGeaParams not found" << endl;
00053      w = new dEmcGeaParamsWrapper("dEmcGeaParams", 10);
00054      if (!w) {
00055        return 1;
00056      }
00057      n = new TableNode_t(w,"dEmcGeaParams");
00058      outNode->addNode(n);
00059   }
00060   nodes.append(n);
00061 
00062   outNode = parNode;
00063   n = i.findFirst("PHIODataNode", "dEmcGeometry");
00064   if (!n) {
00065     cout << "ERROR:  'in' parameter dEmcGeometry not found" << endl;
00066      w = new dEmcGeometryWrapper("dEmcGeometry", 10);
00067      if (!w) {
00068        return 1;
00069      }
00070      n = new TableNode_t(w,"dEmcGeometry");
00071      outNode->addNode(n);
00072   }
00073   nodes.append(n);
00074 
00075   return callPAM(nodes);
00076 }