REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGeant4Hits.h
1
17
18#ifndef RestCore_TRestGeant4Hits
19#define RestCore_TRestGeant4Hits
20
21#include <TRestHits.h>
22
23#include <iostream>
24
25#include "TRestGeant4Metadata.h"
26
27class G4Step;
30
31class TRestGeant4Hits : public TRestHits {
32 protected:
33 std::vector<Int_t> fProcessID = {};
34 std::vector<Int_t> fVolumeID = {};
35 std::vector<Float_t> fKineticEnergy = {};
36 std::vector<TVector3> fMomentumDirection = {};
37
38 std::vector<std::string> fHadronicTargetIsotopeName = {};
39 std::vector<int> fHadronicTargetIsotopeA = {};
40 std::vector<int> fHadronicTargetIsotopeZ = {};
41
42 TRestGeant4Track* fTrack = nullptr;
43 TRestGeant4Event* fEvent = nullptr;
44
45 public:
46 TRestGeant4Metadata* GetGeant4Metadata() const;
47
48 inline const TRestGeant4Track* GetTrack() const { return fTrack; }
49 inline void SetTrack(TRestGeant4Track* track) { fTrack = track; }
50
51 inline const TRestGeant4Event* GetEvent() const { return fEvent; }
52 inline void SetEvent(TRestGeant4Event* event) { fEvent = event; }
53
54 inline TVector3 GetMomentumDirection(size_t n) const { return fMomentumDirection[n]; }
55
56 inline Int_t GetProcessId(size_t n) const { return fProcessID[n]; }
57 inline Int_t GetProcess(size_t n) const { return GetProcessId(n); }
58 inline Int_t GetHitProcess(size_t n) const { return GetProcessId(n); }
59 TString GetProcessName(size_t n) const;
60
61 inline Int_t GetVolumeId(size_t n) const { return fVolumeID[n]; }
62 inline Int_t GetHitVolume(size_t n) const { return GetVolumeId(n); }
63 TString GetVolumeName(size_t n) const;
64
65 inline bool GetHadronicOk() const { return fHadronicTargetIsotopeName.size() > 0; }
66 inline std::string GetHadronicTargetIsotopeName(size_t n) const { return fHadronicTargetIsotopeName[n]; }
67 inline int GetHadronicTargetIsotopeA(size_t n) const { return fHadronicTargetIsotopeA[n]; }
68 inline int GetHadronicTargetIsotopeZ(size_t n) const { return fHadronicTargetIsotopeZ[n]; }
69
70 void RemoveG4Hits();
71
72 inline Double_t GetKineticEnergy(size_t n) const { return fKineticEnergy[n]; }
73
75 inline bool HasCompleteStepInfo() const {
76 const auto size = GetNumberOfHits();
77 return fProcessID.size() == size && fVolumeID.size() == size && fKineticEnergy.size() == size;
78 }
79
80 Double_t GetEnergyInVolume(Int_t volumeID) const;
81
82 TVector3 GetMeanPositionInVolume(Int_t volumeID) const;
83 TVector3 GetFirstPositionInVolume(Int_t volumeID) const;
84 TVector3 GetLastPositionInVolume(Int_t volumeID) const;
85
86 size_t GetNumberOfHitsInVolume(Int_t volumeID) const;
87
88 // non-const methods (should only be used on the analysis, carefully)
89 std::vector<Float_t>& GetEnergyRef() { return fEnergy; }
90
91 // Constructor
93 // Destructor
94 virtual ~TRestGeant4Hits();
95
96 ClassDef(TRestGeant4Hits, 8); // REST event superclass
97
98 // restG4
99 public:
100 void InsertStep(const G4Step*);
101};
102#endif
An event class to store geant4 generated event information.
bool HasCompleteStepInfo() const
True when the saved process, volume, and post-step kinetic-energy arrays cover every hit.
The main class to store the Geant4 simulation conditions that will be used by restG4.
It saves a 3-coordinate position and an energy for each punctual deposition.
Definition: TRestHits.h:39
std::vector< Float_t > fEnergy
Energy deposited at each 3-coordinate position (units keV)
Definition: TRestHits.h:59