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 fTimeOffset = 0;
46 Double_t fTimeLength;
47
48 Double_t fInitialKineticEnergy;
49 Double_t fLength;
50
51 TVector3 fInitialPosition;
52
53 Double_t fWeight = 1; // Used for biasing
54
55 TRestGeant4Event* fEvent = nullptr;
56
57 public:
58 inline const TRestGeant4Hits& GetHits() const { return fHits; }
59 inline TRestGeant4Hits* GetHitsPointer() { return &fHits; }
60 inline const TRestGeant4Event* GetEvent() const { return fEvent; }
61 const TRestGeant4Metadata* GetGeant4Metadata() const;
62
63 inline void SetEvent(TRestGeant4Event* event) { fEvent = event; }
64 inline void SetHits(const TRestGeant4Hits& hits) {
65 fHits = hits;
66 fHits.SetTrack(this);
67 }
68
69 inline void SetTimeOffset(const double tOffset) { fTimeOffset = tOffset; }
70
71 inline TString GetCreatorProcess() const { return fCreatorProcess; }
72
73 inline void AddSecondaryTrackID(Int_t trackID) { fSecondaryTrackIDs.push_back(trackID); }
74
75 size_t GetNumberOfHits(Int_t volID = -1) const;
76 size_t GetNumberOfPhysicalHits(Int_t volID = -1) const;
77
78 inline Int_t GetTrackID() const { return fTrackID; }
79 inline Int_t GetParentID() const { return fParentID; }
80 inline TString GetParticleName() const { return fParticleName; }
81 inline Double_t GetGlobalTime() const { return fGlobalTimestamp; }
82 inline Double_t GetTimeOffset() const { return fTimeOffset; }
83 inline Double_t GetTimeLength() const { return fTimeLength; }
84 inline Double_t GetInitialKineticEnergy() const { return fInitialKineticEnergy; }
85 inline TVector3 GetInitialPosition() const { return fInitialPosition; }
86 inline Double_t GetWeight() const { return fWeight; }
87 inline Double_t GetTotalEnergy() const { return fHits.GetTotalEnergy(); }
88 inline Double_t GetLength() const { return fLength; }
89
90 TString GetInitialVolume() const;
91 TString GetFinalVolume() const;
92
93 inline std::vector<Int_t> GetSecondaryTrackIDs() const { return fSecondaryTrackIDs; }
94 std::vector<const TRestGeant4Track*> GetSecondaryTracks() const;
95 inline std::vector<const TRestGeant4Track*> GetChildrenTracks() const { return GetSecondaryTracks(); }
96
97 TRestGeant4Track* GetParentTrack() const;
98
99 inline TVector3 GetTrackOrigin() const { return GetInitialPosition(); }
100
101 EColor GetParticleColor() const;
102
103 inline Double_t GetEnergyInVolume(Int_t volID) const { return fHits.GetEnergyInVolume(volID); }
104 inline TVector3 GetMeanPositionInVolume(Int_t volID) const {
105 return fHits.GetMeanPositionInVolume(volID);
106 }
107 inline TVector3 GetFirstPositionInVolume(Int_t volID) const {
108 return fHits.GetFirstPositionInVolume(volID);
109 }
110 inline TVector3 GetLastPositionInVolume(Int_t volID) const {
111 return fHits.GetLastPositionInVolume(volID);
112 }
113
114 Int_t GetProcessID(const TString& processName) const;
115 TString GetProcessName(Int_t id) const;
116
117 Bool_t ContainsProcessInVolume(Int_t processID, Int_t volumeID = -1) const;
118 inline Bool_t ContainsProcess(Int_t processID) const { return ContainsProcessInVolume(processID, -1); }
119
120 Bool_t ContainsProcessInVolume(const TString& processName, Int_t volumeID = -1) const;
121 inline Bool_t ContainsProcess(const TString& processName) const {
122 return ContainsProcessInVolume(processName, -1);
123 }
124
125 Double_t GetEnergyInVolume(const TString& volumeName, bool children = false) const;
126
127 TString GetLastProcessName() const;
128
130 void PrintTrack(size_t maxHits = 0) const;
131 void PrintTrackFilterVolumes(const std::set<std::string>& filterVolumes) const;
132
133 inline void RemoveHits() { fHits.RemoveHits(); }
134
135 // Constructor
137
138 // Destructor
139 virtual ~TRestGeant4Track();
140
141 friend class TRestGeant4Event; // allows TRestGeant4Event to access private members
142
143 ClassDef(TRestGeant4Track, 6); // REST event superclass
144
145 // restG4
146 public:
147 explicit TRestGeant4Track(const G4Track*);
148 void UpdateTrack(const G4Track*);
149 void InsertStep(const G4Step*);
150};
151
152#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