00001 #include "mEmcGeaMakeRawModule.h"
00002
00003 #include "headerWrapper.h"
00004
00005 #include "dEmcGeaHitWrapper.h"
00006
00007 #include "dEmcGeaParamsWrapper.h"
00008
00009 #include "dEmcRespParWrapper.h"
00010
00011 #include "dEmcGeometryWrapper.h"
00012
00013 #include "dEmcGeaTrackTowerWrapper.h"
00014
00015 #include "dEmcGeaTowerTrackWrapper.h"
00016
00017 #include "dEmcRawDataWrapper.h"
00018
00019 #include "PHNode.h"
00020 #include "PHCompositeNode.h"
00021 #include "PHIODataNode.h"
00022 #include "PHNodeIterator.h"
00023 #include "PHTable.hh"
00024
00025 #include <iostream>
00026 using namespace std;
00027
00028 typedef PHIODataNode<PHTable> TableNode_t;
00029
00030
00031 mEmcGeaMakeRawModule::mEmcGeaMakeRawModule()
00032 {
00033 name = "mEmcGeaMakeRawModule";
00034 }
00035
00036 PHBoolean
00037 mEmcGeaMakeRawModule::event(PHCompositeNode *root) {
00038 PHPointerList<PHNode> nodes;
00039 PHNodeIterator i(root), *j;
00040 PHNode *n;
00041 TableNode_t *d;
00042 PHTable *w;
00043 PHCompositeNode *geaNode, *emcNode, *parNode, *evaNode, *outNode;
00044
00045 parNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "PAR"));
00046 if (!parNode) {
00047 parNode = new PHCompositeNode("PAR");
00048 root->addNode(parNode);
00049 }
00050
00051 emcNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "EMC"));
00052 if (!emcNode) {
00053 emcNode = new PHCompositeNode("EMC");
00054 root->addNode(emcNode);
00055 }
00056
00057 geaNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "GEA"));
00058 if (!geaNode) {
00059 geaNode = new PHCompositeNode("GEA");
00060 root->addNode(geaNode);
00061 }
00062
00063 evaNode = static_cast<PHCompositeNode*>(i.findFirst("PHCompositeNode", "EVA"));
00064 if (!evaNode) {
00065 evaNode = new PHCompositeNode("EVA");
00066 root->addNode(evaNode);
00067 }
00068
00069
00070
00071
00072
00073 outNode = geaNode;
00074 n = i.findFirst("PHIODataNode", "header");
00075 if (!n) {
00076 cout << "ERROR: 'in' parameter header not found" << endl;
00077 w = new headerWrapper("header", 10);
00078 if (!w) {
00079 return 1;
00080 }
00081 n = new TableNode_t(w,"header");
00082 outNode->addNode(n);
00083 }
00084 nodes.append(n);
00085
00086 outNode = emcNode;
00087 n = i.findFirst("PHIODataNode", "dEmcGeaHit");
00088 if (!n) {
00089 cout << "ERROR: 'in' parameter dEmcGeaHit not found" << endl;
00090 w = new dEmcGeaHitWrapper("dEmcGeaHit", 405000);
00091 if (!w) {
00092 return 1;
00093 }
00094 n = new TableNode_t(w,"dEmcGeaHit");
00095 outNode->addNode(n);
00096 }
00097 nodes.append(n);
00098
00099 outNode = parNode;
00100 n = i.findFirst("PHIODataNode", "dEmcGeaParams");
00101 if (!n) {
00102 cout << "ERROR: 'in' parameter dEmcGeaParams not found" << endl;
00103 w = new dEmcGeaParamsWrapper("dEmcGeaParams", 400);
00104 if (!w) {
00105 return 1;
00106 }
00107 n = new TableNode_t(w,"dEmcGeaParams");
00108 outNode->addNode(n);
00109 }
00110 nodes.append(n);
00111
00112 outNode = parNode;
00113 n = i.findFirst("PHIODataNode", "dEmcRespPar");
00114 if (!n) {
00115 cout << "ERROR: 'in' parameter dEmcRespPar not found" << endl;
00116 w = new dEmcRespParWrapper("dEmcRespPar", 1);
00117 if (!w) {
00118 return 1;
00119 }
00120 n = new TableNode_t(w,"dEmcRespPar");
00121 outNode->addNode(n);
00122 }
00123 nodes.append(n);
00124
00125 outNode = parNode;
00126 n = i.findFirst("PHIODataNode", "dEmcGeometry");
00127 if (!n) {
00128 cout << "ERROR: 'in' parameter dEmcGeometry not found" << endl;
00129 w = new dEmcGeometryWrapper("dEmcGeometry", 30000);
00130 if (!w) {
00131 return 1;
00132 }
00133 n = new TableNode_t(w,"dEmcGeometry");
00134 outNode->addNode(n);
00135 }
00136 nodes.append(n);
00137
00138 outNode = evaNode;
00139 j = new PHNodeIterator(outNode);
00140 if (!(d = static_cast<TableNode_t*>(j->findFirst("PHIODataNode","dEmcGeaTrackTower")))) {
00141 w = new dEmcGeaTrackTowerWrapper("dEmcGeaTrackTower", 7500);
00142 if (!w) {
00143 return 1;
00144 }
00145 d = new TableNode_t(w,"dEmcGeaTrackTower");
00146 outNode->addNode(d);
00147 }
00148 delete j;
00149 nodes.append(d);
00150
00151 outNode = evaNode;
00152 j = new PHNodeIterator(outNode);
00153 if (!(d = static_cast<TableNode_t*>(j->findFirst("PHIODataNode","dEmcGeaTowerTrack")))) {
00154 w = new dEmcGeaTowerTrackWrapper("dEmcGeaTowerTrack", 15000);
00155 if (!w) {
00156 return 1;
00157 }
00158 d = new TableNode_t(w,"dEmcGeaTowerTrack");
00159 outNode->addNode(d);
00160 }
00161 delete j;
00162 nodes.append(d);
00163
00164 outNode = emcNode;
00165 j = new PHNodeIterator(outNode);
00166 if (!(d = static_cast<TableNode_t*>(j->findFirst("PHIODataNode","dEmcRawData")))) {
00167 w = new dEmcRawDataWrapper("dEmcRawData", 15000);
00168 if (!w) {
00169 return 1;
00170 }
00171 d = new TableNode_t(w,"dEmcRawData");
00172 outNode->addNode(d);
00173 }
00174 delete j;
00175 nodes.append(d);
00176
00177 return callPAM(nodes);
00178 }