ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DumpPHG4InEvent.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DumpPHG4InEvent.cc
1 #include "DumpPHG4InEvent.h"
2 
3 #include <phool/PHIODataNode.h>
4 
5 #include <g4main/PHG4InEvent.h>
6 #include <g4main/PHG4Particle.h>
7 #include <g4main/PHG4VtxPoint.h>
8 
9 #include <map>
10 #include <ostream>
11 #include <string>
12 #include <utility>
13 
14 using namespace std;
15 
17 
18 DumpPHG4InEvent::DumpPHG4InEvent(const string &NodeName)
19  : DumpObject(NodeName)
20 {
21  return;
22 }
23 
25 {
26  PHG4InEvent *phg4inevent = nullptr;
27  MyNode_t *thisNode = static_cast<MyNode_t *>(myNode);
28  if (thisNode)
29  {
30  phg4inevent = thisNode->getData();
31  }
32  if (phg4inevent)
33  {
34  map<int, PHG4VtxPoint *>::const_iterator vtxiter;
35  multimap<int, PHG4Particle *>::const_iterator particle_iter;
36  std::pair<std::map<int, PHG4VtxPoint *>::const_iterator, std::map<int, PHG4VtxPoint *>::const_iterator> vtxbegin_end = phg4inevent->GetVertices();
37 
38  for (vtxiter = vtxbegin_end.first; vtxiter != vtxbegin_end.second; ++vtxiter)
39  {
40  *fout << "vtx number: " << vtxiter->first << endl;
41  (*vtxiter->second).identify(*fout);
42  pair<multimap<int, PHG4Particle *>::const_iterator, multimap<int, PHG4Particle *>::const_iterator> particlebegin_end = phg4inevent->GetParticles(vtxiter->first);
43  for (particle_iter = particlebegin_end.first; particle_iter != particlebegin_end.second; ++particle_iter)
44  {
45  (particle_iter->second)->identify(*fout);
46  }
47  }
48  }
49  return 0;
50 }