forked from sPHENIX-Collaboration/coresoftware
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPHG4TruthTrackingAction.h
More file actions
76 lines (57 loc) · 1.92 KB
/
PHG4TruthTrackingAction.h
File metadata and controls
76 lines (57 loc) · 1.92 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Tell emacs that this is a C++ source
// -*- C++ -*-.
#ifndef G4MAIN_PHG4TRUTHTRACKINGACTION_H
#define G4MAIN_PHG4TRUTHTRACKINGACTION_H
#include "PHG4TrackingAction.h"
#include "PHG4MCProcessDefs.h"
#include <Geant4/G4ThreeVector.hh>
#include <map>
#include <utility>
#include <vector>
class G4Track;
class PHCompositeNode;
class PHG4TruthInfoContainer;
class PHG4TruthEventAction;
class PHG4Particle;
class PHG4VtxPoint;
class PHG4TruthTrackingAction : public PHG4TrackingAction
{
public:
//! constructor
PHG4TruthTrackingAction(PHG4TruthEventAction*);
//! destructor
~PHG4TruthTrackingAction() = default;
//! tracking action
void PreUserTrackingAction(const G4Track*) override;
void PostUserTrackingAction(const G4Track*) override;
//! Set pointers to the i/o nodes
void SetInterfacePointers(PHCompositeNode*) override;
int ResetEvent(PHCompositeNode*) override;
private:
// Key is (position, process) to distinguish vertices at the same location but different processes
std::map<std::pair<G4ThreeVector, PHG4MCProcess>, int> m_VertexMap;
//! pointer to the "owning" event action
PHG4TruthEventAction* m_EventAction;
//! pointer to truth information container
PHG4TruthInfoContainer* m_TruthInfoList{nullptr};
PHG4Particle* AddParticle(PHG4TruthInfoContainer&, G4Track&);
PHG4VtxPoint* AddVertex(PHG4TruthInfoContainer&, const G4Track&);
// check if track is long-lived
bool isLongLived(int pid) const;
// check if track is sPHENIX primary
bool issPHENIXPrimary(PHG4TruthInfoContainer& truth, PHG4Particle* particle) const;
/// Machinery to keep track of upstream particles while adding Geant4 tracks
/// to the truth info container
///@{
void UpdateG4ParticleStack(const G4Track*);
struct G4ParticleInfo
{
int g4track_id{0};
int particle_id{0};
int vertex_id{0};
};
std::vector<G4ParticleInfo> m_G4ParticleStack;
G4ParticleInfo m_CurrG4Particle;
///@}
};
#endif