REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestGeant4Hits.h
1 
18 #ifndef RestCore_TRestGeant4Hits
19 #define RestCore_TRestGeant4Hits
20 
21 #include <TRestHits.h>
22 
23 #include <iostream>
24 
25 #include "TRestGeant4Metadata.h"
26 
27 class G4Step;
28 class TRestGeant4Track;
29 class TRestGeant4Event;
30 
31 class 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  TRestGeant4Track* fTrack = nullptr;
39  TRestGeant4Event* fEvent = nullptr;
40 
41  public:
42  TRestGeant4Metadata* GetGeant4Metadata() const;
43 
44  inline const TRestGeant4Track* GetTrack() const { return fTrack; }
45  inline void SetTrack(TRestGeant4Track* track) { fTrack = track; }
46 
47  inline const TRestGeant4Event* GetEvent() const { return fEvent; }
48  inline void SetEvent(TRestGeant4Event* event) { fEvent = event; }
49 
50  inline TVector3 GetMomentumDirection(size_t n) const { return fMomentumDirection[n]; }
51 
52  inline Int_t GetProcessId(size_t n) const { return fProcessID[n]; }
53  inline Int_t GetProcess(size_t n) const { return GetProcessId(n); }
54  inline Int_t GetHitProcess(size_t n) const { return GetProcessId(n); }
55  TString GetProcessName(size_t n) const;
56 
57  inline Int_t GetVolumeId(size_t n) const { return fVolumeID[n]; }
58  inline Int_t GetHitVolume(size_t n) const { return GetVolumeId(n); }
59  TString GetVolumeName(size_t n) const;
60 
61  void RemoveG4Hits();
62 
63  inline Double_t GetKineticEnergy(size_t n) const { return fKineticEnergy[n]; }
64 
65  Double_t GetEnergyInVolume(Int_t volumeID) const;
66 
67  TVector3 GetMeanPositionInVolume(Int_t volumeID) const;
68  TVector3 GetFirstPositionInVolume(Int_t volumeID) const;
69  TVector3 GetLastPositionInVolume(Int_t volumeID) const;
70 
71  size_t GetNumberOfHitsInVolume(Int_t volumeID) const;
72 
73  // non-const methods (should only be used on the analysis, carefully)
74  std::vector<Float_t>& GetEnergyRef() { return fEnergy; }
75 
76  // Constructor
78  // Destructor
79  virtual ~TRestGeant4Hits();
80 
81  ClassDef(TRestGeant4Hits, 7); // REST event superclass
82 
83  // restG4
84  public:
85  void InsertStep(const G4Step*);
86 };
87 #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.
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