ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DumpPHG4TruthInfoContainer.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DumpPHG4TruthInfoContainer.cc
2 
3 #include <phool/PHIODataNode.h>
4 
5 #include <g4main/PHG4Particle.h>
6 #include <g4main/PHG4Shower.h>
8 #include <g4main/PHG4VtxPoint.h>
9 
10 #include <map>
11 #include <ostream>
12 #include <string>
13 #include <utility>
14 
15 using namespace std;
16 
18 
20  : DumpObject(NodeName)
21 {
22  return;
23 }
24 
26 {
27  PHG4TruthInfoContainer *truthcontainer = nullptr;
28  MyNode_t *thisNode = static_cast<MyNode_t *>(myNode);
29  if (thisNode)
30  {
31  truthcontainer = thisNode->getData();
32  }
33  if (truthcontainer)
34  {
35  *fout << "number of G4 tracks: " << truthcontainer->size() << endl;
36  *fout << "min trk index: " << truthcontainer->mintrkindex() << endl;
37  *fout << "max trk index: " << truthcontainer->maxtrkindex() << endl;
38  *fout << "number of G4 Vertices: " << truthcontainer->GetNumVertices() << endl;
39  *fout << "min vtx index: " << truthcontainer->minvtxindex() << endl;
40  *fout << "max vtx index: " << truthcontainer->maxvtxindex() << endl;
41  *fout << "number of Showers: " << truthcontainer->shower_size() << endl;
42  *fout << "min shower index: " << truthcontainer->minshowerindex() << endl;
43  *fout << "max shower index: " << truthcontainer->maxshowerindex() << endl;
44 
46  // std::pair< std::map<int, PHG4VtxPoint *>::const_iterator, std::map<int, PHG4VtxPoint *>::const_iterator > vtxbegin_end = truthcontainer->GetVtxRange();
47  PHG4TruthInfoContainer::ConstVtxRange vtxbegin_end = truthcontainer->GetVtxRange();
48 
49  for (vtxiter = vtxbegin_end.first; vtxiter != vtxbegin_end.second; vtxiter++)
50  {
51  *fout << "vtx number: " << vtxiter->first << endl;
52  (*vtxiter->second).identify(*fout);
53  }
55  PHG4TruthInfoContainer::ConstRange particlebegin_end = truthcontainer->GetParticleRange();
56  for (particle_iter = particlebegin_end.first; particle_iter != particlebegin_end.second; particle_iter++)
57  {
58  *fout << "particle number: " << particle_iter->first << endl;
59  (particle_iter->second)->identify(*fout);
60  }
62  PHG4TruthInfoContainer::ConstShowerRange showerbegin_end = truthcontainer->GetShowerRange();
63  for (shower_iter = showerbegin_end.first; shower_iter != showerbegin_end.second; ++shower_iter)
64  {
65  *fout << "shower " << shower_iter->first << endl;
66  *fout << "get_id(): " << shower_iter->second->get_id() << endl;
67  *fout << "get_parent_particle_id(): " << shower_iter->second->get_parent_particle_id() << endl;
68  *fout << "get_parent_shower_id(): " << shower_iter->second->get_parent_shower_id() << endl;
69  *fout << "get_x(): " << shower_iter->second->get_x() << endl;
70  *fout << "get_y(): " << shower_iter->second->get_y() << endl;
71  *fout << "get_z(): " << shower_iter->second->get_z() << endl;
72  }
73  }
74  return 0;
75 }