-
Notifications
You must be signed in to change notification settings - Fork 3
/
TRestGeant4Track.h
147 lines (108 loc) · 4.95 KB
/
TRestGeant4Track.h
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
///_______________________________________________________________________________
///_______________________________________________________________________________
///_______________________________________________________________________________
///
///
/// RESTSoft : Software for Rare Event Searches with TPCs
///
/// TRestTrack.h
///
/// jul 2015: First concept
/// Created as part of the conceptualization of existing REST
/// software.
/// J. Galan
///_______________________________________________________________________________
#ifndef RestCore_TRestGeant4Track
#define RestCore_TRestGeant4Track
#include <TColor.h>
#include <TString.h>
#include <TVector3.h>
#include "TRestGeant4Hits.h"
class TRestGeant4Event;
class TRestGeant4Metadata;
class G4Track;
class G4Step;
// Perhaps there might be need for a mother class TRestTrack (if there is future need)
class TRestGeant4Track {
protected:
Int_t fTrackID;
Int_t fParentID;
TString fParticleName;
TRestGeant4Hits fHits;
TString fCreatorProcess;
std::vector<Int_t> fSecondaryTrackIDs;
Double_t fGlobalTimestamp;
Double_t fTimeLength;
Double_t fInitialKineticEnergy;
Double_t fLength;
TVector3 fInitialPosition;
Double_t fWeight = 1; // Used for biasing
TRestGeant4Event* fEvent = nullptr; //!
public:
inline const TRestGeant4Hits& GetHits() const { return fHits; }
inline TRestGeant4Hits* GetHitsPointer() { return &fHits; }
inline const TRestGeant4Event* GetEvent() const { return fEvent; }
const TRestGeant4Metadata* GetGeant4Metadata() const;
inline void SetEvent(TRestGeant4Event* event) { fEvent = event; }
inline void SetHits(const TRestGeant4Hits& hits) {
fHits = hits;
fHits.SetTrack(this);
}
inline TString GetCreatorProcess() const { return fCreatorProcess; }
inline void AddSecondaryTrackID(Int_t trackID) { fSecondaryTrackIDs.push_back(trackID); }
size_t GetNumberOfHits(Int_t volID = -1) const;
size_t GetNumberOfPhysicalHits(Int_t volID = -1) const;
inline Int_t GetTrackID() const { return fTrackID; }
inline Int_t GetParentID() const { return fParentID; }
inline TString GetParticleName() const { return fParticleName; }
inline Double_t GetGlobalTime() const { return fGlobalTimestamp; }
inline Double_t GetTimeLength() const { return fTimeLength; }
inline Double_t GetInitialKineticEnergy() const { return fInitialKineticEnergy; }
inline TVector3 GetInitialPosition() const { return fInitialPosition; }
inline Double_t GetWeight() const { return fWeight; }
inline Double_t GetTotalEnergy() const { return fHits.GetTotalEnergy(); }
inline Double_t GetLength() const { return fLength; }
TString GetInitialVolume() const;
TString GetFinalVolume() const;
inline std::vector<Int_t> GetSecondaryTrackIDs() const { return fSecondaryTrackIDs; }
std::vector<const TRestGeant4Track*> GetSecondaryTracks() const;
inline std::vector<const TRestGeant4Track*> GetChildrenTracks() const { return GetSecondaryTracks(); }
TRestGeant4Track* GetParentTrack() const;
inline TVector3 GetTrackOrigin() const { return GetInitialPosition(); }
EColor GetParticleColor() const;
inline Double_t GetEnergyInVolume(Int_t volID) const { return fHits.GetEnergyInVolume(volID); }
inline TVector3 GetMeanPositionInVolume(Int_t volID) const {
return fHits.GetMeanPositionInVolume(volID);
}
inline TVector3 GetFirstPositionInVolume(Int_t volID) const {
return fHits.GetFirstPositionInVolume(volID);
}
inline TVector3 GetLastPositionInVolume(Int_t volID) const {
return fHits.GetLastPositionInVolume(volID);
}
Int_t GetProcessID(const TString& processName) const;
TString GetProcessName(Int_t id) const;
Bool_t ContainsProcessInVolume(Int_t processID, Int_t volumeID = -1) const;
inline Bool_t ContainsProcess(Int_t processID) const { return ContainsProcessInVolume(processID, -1); }
Bool_t ContainsProcessInVolume(const TString& processName, Int_t volumeID = -1) const;
inline Bool_t ContainsProcess(const TString& processName) const {
return ContainsProcessInVolume(processName, -1);
}
Double_t GetEnergyInVolume(const TString& volumeName, bool children = false) const;
TString GetLastProcessName() const;
/// Prints the track information. N number of hits to print, 0 = all
void PrintTrack(size_t maxHits = 0) const;
inline void RemoveHits() { fHits.RemoveHits(); }
// Constructor
TRestGeant4Track();
// Destructor
virtual ~TRestGeant4Track();
friend class TRestGeant4Event; // allows TRestGeant4Event to access private members
ClassDef(TRestGeant4Track, 5); // REST event superclass
// restG4
public:
explicit TRestGeant4Track(const G4Track*); //!
void UpdateTrack(const G4Track*); //!
void InsertStep(const G4Step*); //!
};
#endif