REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGeant4Track.h
1
15
16#ifndef RestCore_TRestGeant4Track
17#define RestCore_TRestGeant4Track
18
19#include <TColor.h>
20#include <TString.h>
21#include <TVector3.h>
22
23#include "TRestGeant4Hits.h"
24
27class G4Track;
28class G4Step;
29
30// Perhaps there might be need for a mother class TRestTrack (if there is future need)
32 protected:
33 Int_t fTrackID;
34 Int_t fParentID;
35
36 TString fParticleName;
37
38 TRestGeant4Hits fHits;
39
40 TString fCreatorProcess;
41
42 std::vector<Int_t> fSecondaryTrackIDs;
43
44 Double_t fGlobalTimestamp;
45 Double_t fTimeLength;
46
47 Double_t fInitialKineticEnergy;
48 Double_t fLength;
49
50 TVector3 fInitialPosition;
51
52 Double_t fWeight = 1; // Used for biasing
53
54 TRestGeant4Event* fEvent = nullptr;
55
56 public:
57 inline const TRestGeant4Hits& GetHits() const { return fHits; }
58 inline TRestGeant4Hits* GetHitsPointer() { return &fHits; }
59 inline const TRestGeant4Event* GetEvent() const { return fEvent; }
60 const TRestGeant4Metadata* GetGeant4Metadata() const;
61
62 inline void SetEvent(TRestGeant4Event* event) { fEvent = event; }
63 inline void SetHits(const TRestGeant4Hits& hits) {
64 fHits = hits;
65 fHits.SetTrack(this);
66 }
67
68 inline TString GetCreatorProcess() const { return fCreatorProcess; }
69
70 inline void AddSecondaryTrackID(Int_t trackID) { fSecondaryTrackIDs.push_back(trackID); }
71
72 size_t GetNumberOfHits(Int_t volID = -1) const;
73 size_t GetNumberOfPhysicalHits(Int_t volID = -1) const;
74
75 inline Int_t GetTrackID() const { return fTrackID; }
76 inline Int_t GetParentID() const { return fParentID; }
77 inline TString GetParticleName() const { return fParticleName; }
78 inline Double_t GetGlobalTime() const { return fGlobalTimestamp; }
79 inline Double_t GetTimeLength() const { return fTimeLength; }
80 inline Double_t GetInitialKineticEnergy() const { return fInitialKineticEnergy; }
81 inline TVector3 GetInitialPosition() const { return fInitialPosition; }
82 inline Double_t GetWeight() const { return fWeight; }
83 inline Double_t GetTotalEnergy() const { return fHits.GetTotalEnergy(); }
84 inline Double_t GetLength() const { return fLength; }
85
86 TString GetInitialVolume() const;
87 TString GetFinalVolume() const;
88
89 inline std::vector<Int_t> GetSecondaryTrackIDs() const { return fSecondaryTrackIDs; }
90 std::vector<const TRestGeant4Track*> GetSecondaryTracks() const;
91 inline std::vector<const TRestGeant4Track*> GetChildrenTracks() const { return GetSecondaryTracks(); }
92
93 TRestGeant4Track* GetParentTrack() const;
94
95 inline TVector3 GetTrackOrigin() const { return GetInitialPosition(); }
96
97 EColor GetParticleColor() const;
98
99 inline Double_t GetEnergyInVolume(Int_t volID) const { return fHits.GetEnergyInVolume(volID); }
100 inline TVector3 GetMeanPositionInVolume(Int_t volID) const {
101 return fHits.GetMeanPositionInVolume(volID);
102 }
103 inline TVector3 GetFirstPositionInVolume(Int_t volID) const {
104 return fHits.GetFirstPositionInVolume(volID);
105 }
106 inline TVector3 GetLastPositionInVolume(Int_t volID) const {
107 return fHits.GetLastPositionInVolume(volID);
108 }
109
110 Int_t GetProcessID(const TString& processName) const;
111 TString GetProcessName(Int_t id) const;
112
113 Bool_t ContainsProcessInVolume(Int_t processID, Int_t volumeID = -1) const;
114 inline Bool_t ContainsProcess(Int_t processID) const { return ContainsProcessInVolume(processID, -1); }
115
116 Bool_t ContainsProcessInVolume(const TString& processName, Int_t volumeID = -1) const;
117 inline Bool_t ContainsProcess(const TString& processName) const {
118 return ContainsProcessInVolume(processName, -1);
119 }
120
121 Double_t GetEnergyInVolume(const TString& volumeName, bool children = false) const;
122
123 TString GetLastProcessName() const;
124
126 void PrintTrack(size_t maxHits = 0) const;
127 void PrintTrackFilterVolumes(const std::set<std::string>& filterVolumes) const;
128
129 inline void RemoveHits() { fHits.RemoveHits(); }
130
131 // Constructor
133
134 // Destructor
135 virtual ~TRestGeant4Track();
136
137 friend class TRestGeant4Event; // allows TRestGeant4Event to access private members
138
139 ClassDef(TRestGeant4Track, 5); // REST event superclass
140
141 // restG4
142 public:
143 explicit TRestGeant4Track(const G4Track*);
144 void UpdateTrack(const G4Track*);
145 void InsertStep(const G4Step*);
146};
147
148#endif
An event class to store geant4 generated event information.
The main class to store the Geant4 simulation conditions that will be used by restG4.
void PrintTrack(size_t maxHits=0) const
Prints the track information. N number of hits to print, 0 = all.
size_t GetNumberOfHits(Int_t volID=-1) const
Function that returns the number of hit depositions found inside the TRestGeant4Track....
size_t GetNumberOfPhysicalHits(Int_t volID=-1) const
Function that returns the number of hit depositions found inside the TRestGeant4Track with energy > 0...
virtual void RemoveHits()
It removes all hits inside the class.
Definition: TRestHits.cxx:371