Monte Carlo LYSO
Geant4 simulation for the LYSO calorimeter prototype
event.hh
Go to the documentation of this file.
1 
5 #ifndef EVENT_HH
6 #define EVENT_HH
7 
8 #include <vector>
9 
10 #include "G4RunManager.hh"
11 #include "G4UserEventAction.hh"
12 #include "G4Event.hh"
13 #include "G4AnalysisManager.hh"
14 
15 #include "globalsettings.hh"
16 #include "hit.hh"
17 #include "generator.hh"
18 
25 class MyEventAction : public G4UserEventAction
26 {
27 public:
28  MyEventAction() = default;
29  ~MyEventAction() override = default;
36  void BeginOfEventAction(const G4Event *event) override;
47  void EndOfEventAction(const G4Event *event) override;
48 
55  inline void SetArrivalandFirstInteraction(G4double newtimein, G4ThreeVector newposin, G4double newtimeinter, G4ThreeVector newposinter)
56  {
57  if(newtimein < fTimeIn)
58  {
59  fTimeIn = newtimein;
60  fPosXIn = newposin.x();
61  fPosYIn = newposin.y();
62  fPosZIn = newposin.z();
63 
64  fTimeFirstInter = newtimeinter;
65  fPosXFirstInter = newposinter.x();
66  fPosYFirstInter = newposinter.y();
67  fPosZFirstInter = newposinter.z();
68  }
69  }
75  inline void AddEdep(G4double edep) { fEdep += edep; }
84  inline void SetMaxEdep(G4double edepondx, G4ThreeVector maxedeppos)
85  {
86  if(edepondx > fMaxEdep)
87  {
88  fMaxEdep = edepondx;
89  fMaxEdepPos = maxedeppos;
90  }
91  };
92 
93 
94  inline void SetDecayTriggerSi(G4bool trg) { fDecayTriggerSi = trg; }
95  inline void SetCosmicTriggerUp(G4bool trg) { fCosmicTriggerUp = trg; }
96  inline void SetCosmicTriggerBottom(G4bool trg) { fCosmicTriggerBottom = trg; }
97 
98 
99  // Primary's data
100  G4double fTimeIn,
109  // Crystal's data
110  G4double fEdep;
111  G4double fMaxEdep;
112  G4ThreeVector fMaxEdepPos;
114  // Detectors' data
115  G4int fHitsNum_F,
117  std::vector<G4double> fT_F,
123  std::vector<G4int> fHitsNum_F_Ch,
125  fHitsNum_B_Ch,
128  // Intercalibration triggers
129  G4double fTimeOfDecay;
130  G4bool fDecayTriggerSi,
131  fCosmicTriggerUp,
132  fCosmicTriggerBottom;
133 };
134 
135 #endif // EVENT_HH
User action concrete class of G4UserEventAction. In addition to defining procedures executed at the s...
Definition: event.hh:26
G4double fMaxEdep
Maximum deposit of energy per unit length (MeV/mm) in the crystal.
Definition: event.hh:111
MyEventAction()=default
Constructor of the class.
G4double fPosXIn
X position of arrival of primary gamma.
Definition: event.hh:101
std::vector< G4double > fT_F
Vector containing times of detection of optical photons on the front face.
Definition: event.hh:117
G4ThreeVector fMaxEdepPos
Position of the maximum deposit of energy per unit length in the crystal.
Definition: event.hh:112
G4double fPosYFirstInter
Y position of first interaction of primary gamma.
Definition: event.hh:106
~MyEventAction() override=default
Destructor of the class.
void EndOfEventAction(const G4Event *event) override
Fills the TTree with the data of the event.
Definition: event.cc:42
G4double fPosXFirstInter
X position of first interaction of primary gamma.
Definition: event.hh:105
std::vector< G4double > fT_B
Vector containing times of detection of optical photons on the back face.
Definition: event.hh:120
G4double fEdep
Total energy deposited inside the crystal.
Definition: event.hh:110
void SetArrivalandFirstInteraction(G4double newtimein, G4ThreeVector newposin, G4double newtimeinter, G4ThreeVector newposinter)
Stores the time and the position of arrival to the crystal of the primary gamma.
Definition: event.hh:55
void BeginOfEventAction(const G4Event *event) override
Resets every data containers at the beginning of a new event.
Definition: event.cc:7
void AddEdep(G4double edep)
For every G4Step inside the crystal it sums the energy deposit.
Definition: event.hh:75
std::vector< G4double > fY_F
Vector containing y-positions of detection of optical photons on the front face.
Definition: event.hh:119
std::vector< G4double > fX_B
Vector containing x-positions of detection of optical photons on the back face.
Definition: event.hh:121
G4double fTimeFirstInter
Time of first interaction of primary gamma.
Definition: event.hh:104
std::vector< G4int > fChannel_B
Vector containing SiPM channels of detection of optical photons on the back face.
Definition: event.hh:126
void SetMaxEdep(G4double edepondx, G4ThreeVector maxedeppos)
Stores the maximum deposit of energy per unit length and its position inside the crystal.
Definition: event.hh:84
G4int fHitsNum_F
Total number of optical photons detected by SiPMs on the front face.
Definition: event.hh:115
G4double fPosYIn
Y position of arrival of primary gamma.
Definition: event.hh:102
G4double fPosZIn
Z position of arrival of primary gamma.
Definition: event.hh:103
G4double fPosZFirstInter
Z position of first interaction of primary gamma.
Definition: event.hh:107
G4int fHitsNum_B
Total number of optical photons detected by SiPMs on the back face.
Definition: event.hh:116
std::vector< G4double > fX_F
Vector containing x-positions of detection of optical photons on the front face.
Definition: event.hh:118
G4double fTimeIn
Time of arrival of primary gamma.
Definition: event.hh:100
std::vector< G4double > fY_B
Vector containing y-positions of detection of optical photons on the back face.
Definition: event.hh:122
std::vector< G4int > fChannel_F
Vector containing SiPM channels of detection of optical photons on the front face.
Definition: event.hh:124
Declaration of the class MyPrimaryGenerator.
Definition of the namespace GS.
Declaration of the class MyHit.