Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ExGflashEventAction Class Reference

#include <Doxymodules_parameterisations.h>

Inheritance diagram for ExGflashEventAction:
G4UserEventAction

Public Member Functions

 ExGflashEventAction ()
 
 ~ExGflashEventAction () override
 
void BeginOfEventAction (const G4Event *) override
 
void EndOfEventAction (const G4Event *) override
 

Private Attributes

G4int fNevent {0}
 
G4double fDtime {0.0}
 
G4int fCalorimeterCollectionId {-1}
 
G4Timer fTimerIntern
 

Detailed Description

Definition at line 109 of file Doxymodules_parameterisations.h.

Constructor & Destructor Documentation

◆ ExGflashEventAction()

ExGflashEventAction::ExGflashEventAction ( )
default

◆ ~ExGflashEventAction()

ExGflashEventAction::~ExGflashEventAction ( )
override

Definition at line 54 of file ExGflashEventAction.cc.

55{
56 if (fNevent > 0) {
57 G4cout << "Internal Real Elapsed Time /event is: " << fDtime / fNevent << G4endl;
58 }
59}

Member Function Documentation

◆ BeginOfEventAction()

void ExGflashEventAction::BeginOfEventAction ( const G4Event evt)
override

Definition at line 63 of file ExGflashEventAction.cc.

64{
65 fTimerIntern.Start();
66 G4cout << " ------ Start ExGflashEventAction ----- " << G4endl;
67 fNevent = evt->GetEventID();
68 G4cout << " Start generating event Nr " << fNevent << G4endl << G4endl;
69}

◆ EndOfEventAction()

void ExGflashEventAction::EndOfEventAction ( const G4Event evt)
override

Hits in sensitive Detector

Computing (x,y,z) of vertex of initial particles

For all Hits in sensitive detector

Definition at line 73 of file ExGflashEventAction.cc.

74{
75 fTimerIntern.Stop();
76 G4cout << G4endl;
77 G4cout << "******************************************";
78 G4cout << G4endl;
79 G4cout << "Internal Real Elapsed Time is: " << fTimerIntern.GetRealElapsed();
80 G4cout << G4endl;
81 G4cout << "Internal System Elapsed Time: " << fTimerIntern.GetSystemElapsed();
82 G4cout << G4endl;
83 G4cout << "Internal GetUserElapsed Time: " << fTimerIntern.GetUserElapsed();
84 G4cout << G4endl;
85 G4cout << "******************************************" << G4endl;
86 fDtime += fTimerIntern.GetRealElapsed();
87 G4cout << " ------ ExGflashEventAction::End of event nr. " << fNevent << " -----" << G4endl;
88
89 G4SDManager* SDman = G4SDManager::GetSDMpointer();
90 G4String colNam;
91 fCalorimeterCollectionId = SDman->GetCollectionID(colNam = "ExGflashCollection");
92 if (fCalorimeterCollectionId < 0) return;
93 G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
94 ExGflashHitsCollection* THC = nullptr;
95 G4double totE = 0;
96 // Read out of the crysta ECAL
98 if (THC) {
99 /// Hits in sensitive Detector
100 int n_hit = THC->entries();
101 G4cout << " " << n_hit << " hits are stored in ExGflashHitsCollection " << G4endl;
102 G4PrimaryVertex* pvertex = evt->GetPrimaryVertex();
103 /// Computing (x,y,z) of vertex of initial particles
104 G4ThreeVector vtx = pvertex->GetPosition();
105 G4PrimaryParticle* pparticle = pvertex->GetPrimary();
106 // direction of the Shower
107 G4ThreeVector mom = pparticle->GetMomentum() / pparticle->GetMomentum().mag();
108
109 //@@@ ExGflashEventAction: Magicnumber
110 G4double energyincrystal[100];
111 G4int hitsincrystal[100];
112 for (int i = 0; i < 100; i++)
113 energyincrystal[i] = 0.;
114 for (int i = 0; i < 100; i++)
115 hitsincrystal[i] = 0.;
116
117 //@@@ ExGflashEventAction: Magicnumber
118 /// For all Hits in sensitive detector
119 for (int i = 0; i < n_hit; i++) {
120 G4double estep = (*THC)[i]->GetEdep() / GeV;
121 if (estep > 0.0) {
122 totE += (*THC)[i]->GetEdep() / GeV;
123 G4int num = (*THC)[i]->GetCrystalNum();
124
125 energyincrystal[num] += (*THC)[i]->GetEdep() / GeV;
126 hitsincrystal[num]++;
127 // G4cout << num << G4endl;
128 // G4cout << " Crystal Nummer " << (*THC)[i]->GetCrystalNum() << G4endl;
129 // G4cout << (*THC)[i]->GetCrystalNum() /10 <<
130 // " "<<(*THC)[i]->GetCrystalNum()%10 << G4endl;
131
132 G4ThreeVector hitpos = (*THC)[i]->GetPos();
133 G4ThreeVector l(hitpos.x(), hitpos.y(), hitpos.z());
134 // distance from shower start
135 l = l - vtx;
136 // projection on shower axis = longitudinal profile
137 G4ThreeVector longitudinal = l;
138 // shower profiles (Radial)
139 G4ThreeVector radial = vtx.cross(l);
140 }
141 }
142 G4double max = 0;
143 G4int index = 0;
144 // Find crystal with maximum energy
145 for (int i = 0; i < 100; i++) {
146 // G4cout << i <<" " << energyincrystal[i] << G4endl;
147 if (max < energyincrystal[i]) {
148 max = energyincrystal[i];
149 index = i;
150 }
151 }
152 // G4cout << index <<" NMAX " << index << G4endl;
153
154 // 3x3 matrix of crystals around the crystal with the maximum energy deposit
155 G4double e3x3 = energyincrystal[index] + energyincrystal[index + 1] + energyincrystal[index - 1]
156 + energyincrystal[index - 10] + energyincrystal[index - 9]
157 + energyincrystal[index - 11] + energyincrystal[index + 10]
158 + energyincrystal[index + 11] + energyincrystal[index + 9];
159
160 // 5x5 matrix of crystals around the crystal with the maximum energy deposit
161 G4double e5x5 =
162 energyincrystal[index] + energyincrystal[index + 1] + energyincrystal[index - 1]
163 + energyincrystal[index + 2] + energyincrystal[index - 2] + energyincrystal[index - 10]
164 + energyincrystal[index - 9] + energyincrystal[index - 11] + energyincrystal[index - 8]
165 + energyincrystal[index - 12] + energyincrystal[index + 10] + energyincrystal[index + 11]
166 + energyincrystal[index + 9] + energyincrystal[index + 12] + energyincrystal[index + 8];
167
168 // 3x3 matrix of crystals around the crystal with the maximum energy deposit
169 G4int num3x3 = hitsincrystal[index] + hitsincrystal[index + 1] + hitsincrystal[index - 1]
170 + hitsincrystal[index - 10] + hitsincrystal[index - 9]
171 + hitsincrystal[index - 11] + hitsincrystal[index + 10]
172 + hitsincrystal[index + 11] + hitsincrystal[index + 9];
173
174 // 5x5 matrix of crystals around the crystal with the maximum energy deposit
175 G4int num5x5 = hitsincrystal[index] + hitsincrystal[index + 1] + hitsincrystal[index - 1]
176 + hitsincrystal[index + 2] + hitsincrystal[index - 2] + hitsincrystal[index - 10]
177 + hitsincrystal[index - 9] + hitsincrystal[index - 11] + hitsincrystal[index - 8]
178 + hitsincrystal[index - 12] + hitsincrystal[index + 10]
179 + hitsincrystal[index + 11] + hitsincrystal[index + 9]
180 + hitsincrystal[index + 12] + hitsincrystal[index + 8];
181
182 G4cout << " e1 " << energyincrystal[index] << " e3x3 " << e3x3 << " GeV e5x5 " << e5x5
183 << G4endl;
184
185 G4cout << " num1 " << hitsincrystal[index] << " num3x3 " << num3x3 << " num5x5 "
186 << num5x5 << G4endl;
187 }
188
189 G4cout << " Total energy deposited in the calorimeter: " << totE << " (GeV)" << G4endl;
190 G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
191 G4int n_trajectories = 0;
192 if (trajectoryContainer) {
193 n_trajectories = trajectoryContainer->entries();
194 }
195 G4cout << " " << n_trajectories << " trajectories stored in this event." << G4endl;
196}

Member Data Documentation

◆ fNevent

G4int ExGflashEventAction::fNevent {0}
private

Definition at line 47 of file ExGflashEventAction.hh.

47{0};

◆ fDtime

G4double ExGflashEventAction::fDtime {0.0}
private

Definition at line 48 of file ExGflashEventAction.hh.

48{0.0};

◆ fCalorimeterCollectionId

G4int ExGflashEventAction::fCalorimeterCollectionId {-1}
private

Definition at line 49 of file ExGflashEventAction.hh.

49{-1};

◆ fTimerIntern

G4Timer ExGflashEventAction::fTimerIntern
private

Definition at line 50 of file ExGflashEventAction.hh.


The documentation for this class was generated from the following files:

Applications | User Support | Publications | Collaboration