00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "mEmcRealEventModule.h"
00012 #include "VtxOut.h"
00013 #include "dEmcEventWrapper.h"
00014
00015 #include "PHNode.h"
00016 #include "PHIODataNode.h"
00017 #include "PHNodeIterator.h"
00018 #include "PHDataNodeIterator.h"
00019
00020 #include <iostream>
00021 #include <fstream>
00022 #include <cmath>
00023
00024 using namespace std;
00025
00026 typedef PHIODataNode<VtxOut> VtxOutNode_t;
00027
00028 static int ievno = 0;
00029 int j;
00030
00031 PHBoolean mEmcRealEventModule::event(PHCompositeNode *root)
00032 {
00033
00034
00035 PHNodeIterator i(root);
00036 PHIODataNode<PHTable>* dEmcEventNode = (PHIODataNode<PHTable>*)i.findFirst("PHIODataNode","dEmcEvent");
00037 dEmcEventWrapper * dEmcEvent = static_cast<dEmcEventWrapper*>(dEmcEventNode->getData());
00038
00039 float z_value = 0;
00040 PHTypedNodeIterator<VtxOut> vtxiter(root);
00041 VtxOutNode_t *VtxOutNode = vtxiter.find("VtxOut");
00042 if (VtxOutNode)
00043 {
00044 vtxout = VtxOutNode->getData();
00045 vertex = vtxout->get_Vertex();
00046 z_value = vertex.getZ();
00047 }
00048 else
00049 {
00050 cout << PHWHERE << "No VtxOut Object, using Z-Vtx = 0" << endl;
00051 }
00052 for( j = 0; j < 2; j++)
00053 {
00054 dEmcEvent->set_xyz(j,0,0.0) ;
00055 }
00056
00057 if(fabs(z_value)>100.0)
00058 {
00059 z_value = 100.0;
00060 }
00061
00062 dEmcEvent->set_xyz(2,0,z_value) ;
00063
00064
00065 ievno++;
00066
00067
00068 dEmcEvent->set_id(0,1);
00069 dEmcEvent->set_evtyp(0,2);
00070 dEmcEvent->set_evno(0,0);
00071 dEmcEvent->set_runno(0,0);
00072 dEmcEvent->set_serialno(0,0);
00073 dEmcEvent->set_impact(0,0.0);
00074 dEmcEvent->set_twrmultlo(0,0.0);
00075 dEmcEvent->set_twrmulthi(0,0.0);
00076 for ( j = 0; j < 3; j++)
00077 {
00078 dEmcEvent->set_trigsum(j,0,0.0);
00079 }
00080 dEmcEvent->set_tote(0,0.0);
00081 dEmcEvent->set_totet(0,0.0);
00082
00083 dEmcEvent->SetRowCount(1);
00084
00085
00086 return true;
00087
00088 }
00089