25 #include <TLorentzVector.h>
29 #include <calobase/RawCluster.h>
30 #include <calobase/RawClusterContainer.h>
31 #include <calobase/RawClusterUtility.h>
32 #include <calobase/RawTowerGeomContainer.h>
33 #include <calobase/RawTower.h>
34 #include <calobase/RawTowerContainer.h>
41 #include <g4vertex/GlobalVertex.h>
42 #include <g4vertex/GlobalVertexMap.h>
47 #include <trackbase_historic/SvtxVertex.h>
48 #include <trackbase_historic/SvtxVertexMap.h>
56 #pragma GCC diagnostic push
57 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
58 #include <HepMC/GenEvent.h>
59 #include <HepMC/GenParticle.h>
60 #include <HepMC/GenVertex.h>
61 #include <HepMC/IteratorRange.h>
62 #include <HepMC/SimpleVector.h>
63 #include <HepMC/GenParticle.h>
64 #pragma GCC diagnostic pop
83 std::cout <<
"isoCluster::isoCluster(const std::string &name) Calling ctor" << std::endl;
88 std::cout <<
"isoCluster::~isoCluster() Calling dtor" << std::endl;
94 std::cout <<
"isoCluster::Init(PHCompositeNode *topNode) Initializing" << std::endl;
98 T =
new TTree(
"T",
"T");
118 std::cout <<
"isoCluster::InitRun(PHCompositeNode *topNode) Initializing for Run XXX" << std::endl;
127 RawClusterContainer *clusterContainer = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_CEMC");
128 if(!clusterContainer)
130 std::cout <<
PHWHERE <<
"isoCluster::process_event - Fatal Error - CLUSTER_POS_COR_CEMC node is missing. " << std::endl;
136 GlobalVertexMap *vtxContainer = findNode::getClass<GlobalVertexMap>(topNode,
"GlobalVertexMap");
139 std::cout <<
PHWHERE <<
"isoCluster::process_event - Fatal Error - GlobalVertexMap node is missing. Please turn on the do_global flag in the main macro in order to reconstruct the global vertex." << std::endl;
145 if (vtxContainer->
empty())
147 std::cout <<
PHWHERE <<
"isoCluster::process_event - Fatal Error - GlobalVertexMap node is empty. Please turn on the do_global flag in the main macro in order to reconstruct the global vertex." << std::endl;
156 std::cout <<
PHWHERE <<
"isoCluster::process_event Could not find vtx from vtxContainer" << std::endl;
164 std::cout <<
PHWHERE <<
"isoCluster::process_event Could not find node G4TruthInfo" << std::endl;
169 PHHepMCGenEventMap *genEventMap = findNode::getClass<PHHepMCGenEventMap>(topNode,
"PHHepMCGenEventMap");
172 std::cout <<
PHWHERE <<
"isoCluster::process_event Could not find PHHepMCGenEventMap" << std::endl;
180 std::cout <<
PHWHERE <<
"isoCluster::process_event Could not find PHHepMCGenEvent" << std::endl;
184 HepMC::GenEvent *theEvent = genEvent ->
getEvent();
190 std::cout <<
PHWHERE <<
"isoCluster::process_event cluster eval not available" << std::endl;
197 for(clusterIter = clusterEnd.first; clusterIter != clusterEnd.second; clusterIter++)
199 RawCluster *recoCluster = clusterIter -> second;
202 if(E_vec_cluster.mag() < 3)
continue;
216 for(truthIter = truthRange.first; truthIter != truthRange.second; truthIter++)
221 int previousparentid = -999;
222 if(truthPar -> get_pid() != 22)
continue;
227 while (parentid != 0)
229 previousparentid = parentid;
234 if(previousparentid > 0)truthPar = truthinfo -> GetParticle(previousparentid);
235 if(truthPar -> get_pid() != 22)
continue;
237 for(HepMC::GenEvent::particle_const_iterator
p = theEvent -> particles_begin();
p != theEvent -> particles_end(); ++
p)
241 if((*p) -> barcode() == truthPar -> get_barcode())
243 for(HepMC::GenVertex::particle_iterator mother = (*p)->production_vertex()->particles_begin(HepMC::parents);
244 mother != (*p)->production_vertex()->particles_end(HepMC::parents); ++mother)
248 if((*mother) -> pdg_id() != 22)
continue;
250 HepMC::FourVector moMomentum = (*mother) ->
momentum();
253 m_photonEta.push_back(moMomentum.pseudoRapidity());
255 m_photonPt.push_back(sqrt(moMomentum.px()*moMomentum.px()+moMomentum.py()*moMomentum.py()));
292 std::cout <<
"isoCluster::EndRun(const int runnumber) Ending Run for Run " << runnumber << std::endl;
299 std::cout <<
"isoCluster::End(PHCompositeNode *topNode) This is the End..." << std::endl;
309 std::cout <<
"isoCluster::Reset(PHCompositeNode *topNode) being Reset" << std::endl;
316 std::cout <<
"isoCluster::Print(const std::string &what) const Printing info for " << what << std::endl;