Analysis Software
Documentation for sPHENIX simulation 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 
15 
17  : DumpObject(NodeName)
18 {
19  return;
20 }
21 
23 {
24  PHG4InEvent *phg4inevent = nullptr;
25  MyNode_t *thisNode = static_cast<MyNode_t *>(myNode);
26  if (thisNode)
27  {
28  phg4inevent = thisNode->getData();
29  }
30  if (phg4inevent)
31  {
32  std::map<int, PHG4VtxPoint *>::const_iterator vtxiter;
33  std::multimap<int, PHG4Particle *>::const_iterator particle_iter;
34  std::pair<std::map<int, PHG4VtxPoint *>::const_iterator, std::map<int, PHG4VtxPoint *>::const_iterator> vtxbegin_end = phg4inevent->GetVertices();
35 
36  for (vtxiter = vtxbegin_end.first; vtxiter != vtxbegin_end.second; ++vtxiter)
37  {
38  *fout << "vtx number: " << vtxiter->first << std::endl;
39  (*vtxiter->second).identify(*fout);
40  std::pair<std::multimap<int, PHG4Particle *>::const_iterator, std::multimap<int, PHG4Particle *>::const_iterator> particlebegin_end = phg4inevent->GetParticles(vtxiter->first);
41  for (particle_iter = particlebegin_end.first; particle_iter != particlebegin_end.second; ++particle_iter)
42  {
43  (particle_iter->second)->identify(*fout);
44  }
45  }
46  }
47  return 0;
48 }