File indexing completed on 2025-08-06 08:17:56
0001 #include "DumpPHG4InEvent.h"
0002
0003 #include <phool/PHIODataNode.h>
0004
0005 #include <g4main/PHG4InEvent.h>
0006 #include <g4main/PHG4Particle.h>
0007 #include <g4main/PHG4VtxPoint.h>
0008
0009 #include <map>
0010 #include <ostream>
0011 #include <string>
0012 #include <utility>
0013
0014 using MyNode_t = PHIODataNode<PHG4InEvent>;
0015
0016 DumpPHG4InEvent::DumpPHG4InEvent(const std::string &NodeName)
0017 : DumpObject(NodeName)
0018 {
0019 return;
0020 }
0021
0022 int DumpPHG4InEvent::process_Node(PHNode *myNode)
0023 {
0024 PHG4InEvent *phg4inevent = nullptr;
0025 MyNode_t *thisNode = static_cast<MyNode_t *>(myNode);
0026 if (thisNode)
0027 {
0028 phg4inevent = thisNode->getData();
0029 }
0030 if (phg4inevent)
0031 {
0032 std::map<int, PHG4VtxPoint *>::const_iterator vtxiter;
0033 std::multimap<int, PHG4Particle *>::const_iterator particle_iter;
0034 std::pair<std::map<int, PHG4VtxPoint *>::const_iterator, std::map<int, PHG4VtxPoint *>::const_iterator> vtxbegin_end = phg4inevent->GetVertices();
0035
0036 for (vtxiter = vtxbegin_end.first; vtxiter != vtxbegin_end.second; ++vtxiter)
0037 {
0038 *fout << "vtx number: " << vtxiter->first << std::endl;
0039 (*vtxiter->second).identify(*fout);
0040 std::pair<std::multimap<int, PHG4Particle *>::const_iterator, std::multimap<int, PHG4Particle *>::const_iterator> particlebegin_end = phg4inevent->GetParticles(vtxiter->first);
0041 for (particle_iter = particlebegin_end.first; particle_iter != particlebegin_end.second; ++particle_iter)
0042 {
0043 (particle_iter->second)->identify(*fout);
0044 }
0045 }
0046 }
0047 return 0;
0048 }