forked from sPHENIX-Collaboration/coresoftware
/
DumpPHG4InEvent.cc
50 lines (42 loc) · 1.42 KB
/
DumpPHG4InEvent.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "DumpPHG4InEvent.h"
#include <phool/PHIODataNode.h>
#include <g4main/PHG4InEvent.h>
#include <g4main/PHG4Particle.h>
#include <g4main/PHG4VtxPoint.h>
#include <map>
#include <ostream>
#include <string>
#include <utility>
using namespace std;
typedef PHIODataNode<PHG4InEvent> MyNode_t;
DumpPHG4InEvent::DumpPHG4InEvent(const string &NodeName)
: DumpObject(NodeName)
{
return;
}
int DumpPHG4InEvent::process_Node(PHNode *myNode)
{
PHG4InEvent *phg4inevent = nullptr;
MyNode_t *thisNode = static_cast<MyNode_t *>(myNode);
if (thisNode)
{
phg4inevent = thisNode->getData();
}
if (phg4inevent)
{
map<int, PHG4VtxPoint *>::const_iterator vtxiter;
multimap<int, PHG4Particle *>::const_iterator particle_iter;
std::pair<std::map<int, PHG4VtxPoint *>::const_iterator, std::map<int, PHG4VtxPoint *>::const_iterator> vtxbegin_end = phg4inevent->GetVertices();
for (vtxiter = vtxbegin_end.first; vtxiter != vtxbegin_end.second; ++vtxiter)
{
*fout << "vtx number: " << vtxiter->first << endl;
(*vtxiter->second).identify(*fout);
pair<multimap<int, PHG4Particle *>::const_iterator, multimap<int, PHG4Particle *>::const_iterator> particlebegin_end = phg4inevent->GetParticles(vtxiter->first);
for (particle_iter = particlebegin_end.first; particle_iter != particlebegin_end.second; ++particle_iter)
{
(particle_iter->second)->identify(*fout);
}
}
}
return 0;
}