ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Run.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Run.cc
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
28
//
29
//
30
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33
#include <numeric>
34
35
#include "Run.hh"
36
#include "DetectorConstruction.hh"
37
38
#include "
G4OpBoundaryProcess.hh
"
39
#include "
G4SystemOfUnits.hh
"
40
#include "
G4UnitsTable.hh
"
41
42
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
Run::Run
()
44
:
G4Run
()
45
{
46
fParticle
=
nullptr
;
47
fEkin
= -1.;
48
49
fCerenkovEnergy
= 0.0;
50
fScintEnergy
= 0.0;
51
52
fCerenkovCount
= 0;
53
fScintCount
= 0;
54
fRayleighCount
= 0;
55
56
fOpAbsorption
= 0;
57
fOpAbsorptionPrior
= 0;
58
59
fTotalSurface
= 0;
60
61
fBoundaryProcs
.clear();
62
fBoundaryProcs
.resize(40);
63
for
(
G4int
i = 0; i < 40; ++i) {
64
fBoundaryProcs
[i] = 0;
65
}
66
}
67
68
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
Run::~Run
()
70
{}
71
72
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73
void
Run::SetPrimary
(
G4ParticleDefinition
*
particle
,
G4double
energy
)
74
{
75
fParticle
=
particle
;
76
fEkin
=
energy
;
77
}
78
79
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80
void
Run::Merge
(
const
G4Run
* run)
81
{
82
const
Run
* localRun =
static_cast<
const
Run
*
>
(run);
83
84
// pass information about primary particle
85
fParticle
= localRun->
fParticle
;
86
fEkin
= localRun->
fEkin
;
87
88
fCerenkovEnergy
+= localRun->
fCerenkovEnergy
;
89
fScintEnergy
+= localRun->
fScintEnergy
;
90
91
fCerenkovCount
+= localRun->
fCerenkovCount
;
92
fScintCount
+= localRun->
fScintCount
;
93
fRayleighCount
+= localRun->
fRayleighCount
;
94
95
fTotalSurface
+= localRun->
fTotalSurface
;
96
97
fOpAbsorption
+= localRun->
fOpAbsorption
;
98
fOpAbsorptionPrior
+= localRun->
fOpAbsorptionPrior
;
99
100
for
(
size_t
i = 0; i <
fBoundaryProcs
.size(); ++i) {
101
fBoundaryProcs
[i] += localRun->
fBoundaryProcs
[i];
102
}
103
104
G4Run::Merge
(run);
105
}
106
107
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108
void
Run::EndOfRun
()
109
{
110
G4int
TotNbofEvents =
numberOfEvent
;
111
if
(TotNbofEvents == 0)
return
;
112
113
const
DetectorConstruction
* det = (
const
DetectorConstruction
*)
114
(
G4RunManager::GetRunManager
()->
GetUserDetectorConstruction
());
115
116
std::ios::fmtflags mode =
G4cout
.flags();
117
G4int
prec
=
G4cout
.precision(2);
118
119
G4cout
<<
"\n Run Summary\n"
;
120
G4cout
<<
"---------------------------------\n"
;
121
G4cout
<<
"Primary particle was: "
<<
fParticle
->
GetParticleName
()
122
<<
" with energy "
<<
G4BestUnit
(
fEkin
,
"Energy"
) <<
"."
<<
G4endl
;
123
124
G4cout
<<
"Material of world: "
<< det->
GetWorldMaterial
()->
GetName
()
125
<<
G4endl
;
126
G4cout
<<
"Material of tank: "
<< det->
GetTankMaterial
()->
GetName
()
127
<<
G4endl
<<
G4endl
;
128
129
if
(
fParticle
->
GetParticleName
() !=
"opticalphoton"
) {
130
G4cout
<<
"Average energy of Cerenkov photons created per event: "
131
<< (
fCerenkovEnergy
/
eV
)/TotNbofEvents <<
" eV."
<< G4endl;
132
G4cout
<<
"Average number of Cerenkov photons created per event: "
133
<<
fCerenkovCount
/TotNbofEvents <<
G4endl
;
134
if
(
fCerenkovCount
> 0) {
135
G4cout
<<
" Average energy: "
<< (
fCerenkovEnergy
/
eV
)/
fCerenkovCount
136
<<
" eV."
<< G4endl;
137
}
138
G4cout
<<
"Average energy of scintillation photons created per event: "
139
<< (
fScintEnergy
/
eV
)/TotNbofEvents <<
" eV."
<< G4endl;
140
G4cout
<<
"Average number of scintillation photons created per event: "
141
<<
fScintCount
/TotNbofEvents <<
G4endl
;
142
if
(
fScintCount
> 0) {
143
G4cout
<<
" Average energy: "
<< (
fScintEnergy
/
eV
)/
fScintCount
<<
" eV."
144
<< G4endl;
145
}
146
}
147
G4cout
<<
"Average number of OpRayleigh per event: "
148
<<
fRayleighCount
/TotNbofEvents <<
G4endl
;
149
G4cout
<<
"Average number of OpAbsorption per event: "
150
<<
fOpAbsorption
/TotNbofEvents <<
G4endl
;
151
G4cout
<<
152
"\nSurface events (on +X surface, maximum one per photon) this run:"
153
<<
G4endl
;
154
G4cout
<<
"# of primary particles: "
<< std::setw(8) << TotNbofEvents
155
<<
G4endl
;
156
G4cout
<<
"OpAbsorption before surface: "
<< std::setw(8)
157
<<
fOpAbsorptionPrior
<<
G4endl
;
158
G4cout
<<
"Total # of surface events: "
<< std::setw(8) <<
fTotalSurface
159
<<
G4endl
;
160
if
(
fParticle
->
GetParticleName
() ==
"opticalphoton"
) {
161
G4cout
<<
"Unaccounted for: "
<< std::setw(8)
162
<<
fTotalSurface
+
fOpAbsorptionPrior
- TotNbofEvents <<
G4endl
;
163
}
164
G4cout
<<
"\nSurface events by process:"
<<
G4endl
;
165
if
(
fBoundaryProcs
[
Transmission
] > 0) {
166
G4cout
<<
" Transmission: "
<< std::setw(8)
167
<<
fBoundaryProcs
[
Transmission
] <<
G4endl
;
168
}
169
if
(
fBoundaryProcs
[
FresnelRefraction
] > 0) {
170
G4cout
<<
" Fresnel refraction: "
<< std::setw(8)
171
<<
fBoundaryProcs
[
FresnelRefraction
] <<
G4endl
;
172
}
173
if
(
fBoundaryProcs
[
FresnelReflection
] > 0) {
174
G4cout
<<
" Fresnel reflection: "
<< std::setw(8)
175
<<
fBoundaryProcs
[
FresnelReflection
] <<
G4endl
;
176
}
177
if
(
fBoundaryProcs
[
TotalInternalReflection
] > 0) {
178
G4cout
<<
" Total internal reflection: "
<< std::setw(8)
179
<<
fBoundaryProcs
[
TotalInternalReflection
] <<
G4endl
;
180
}
181
if
(
fBoundaryProcs
[
LambertianReflection
] > 0) {
182
G4cout
<<
" Lambertian reflection: "
<< std::setw(8)
183
<<
fBoundaryProcs
[
LambertianReflection
] <<
G4endl
;
184
}
185
if
(
fBoundaryProcs
[
LobeReflection
] > 0) {
186
G4cout
<<
" Lobe reflection: "
<< std::setw(8)
187
<<
fBoundaryProcs
[
LobeReflection
] <<
G4endl
;
188
}
189
if
(
fBoundaryProcs
[
SpikeReflection
] > 0) {
190
G4cout
<<
" Spike reflection: "
<< std::setw(8)
191
<<
fBoundaryProcs
[
SpikeReflection
] <<
G4endl
;
192
}
193
if
(
fBoundaryProcs
[
BackScattering
] > 0) {
194
G4cout
<<
" Backscattering: "
<< std::setw(8)
195
<<
fBoundaryProcs
[
BackScattering
] <<
G4endl
;
196
}
197
if
(
fBoundaryProcs
[
Absorption
] > 0) {
198
G4cout
<<
" Absorption: "
<< std::setw(8)
199
<<
fBoundaryProcs
[
Absorption
] <<
G4endl
;
200
}
201
if
(
fBoundaryProcs
[
Detection
] > 0) {
202
G4cout
<<
" Detection: "
<< std::setw(8)
203
<<
fBoundaryProcs
[
Detection
] <<
G4endl
;
204
}
205
if
(
fBoundaryProcs
[
NotAtBoundary
] > 0) {
206
G4cout
<<
" Not at boundary: "
<< std::setw(8)
207
<<
fBoundaryProcs
[
NotAtBoundary
] <<
G4endl
;
208
}
209
if
(
fBoundaryProcs
[
SameMaterial
] > 0) {
210
G4cout
<<
" Same material: "
<< std::setw(8)
211
<<
fBoundaryProcs
[
SameMaterial
] <<
G4endl
;
212
}
213
if
(
fBoundaryProcs
[
StepTooSmall
] > 0) {
214
G4cout
<<
" Step too small: "
<< std::setw(8)
215
<<
fBoundaryProcs
[
StepTooSmall
] <<
G4endl
;
216
}
217
if
(
fBoundaryProcs
[
NoRINDEX
] > 0) {
218
G4cout
<<
" No RINDEX: "
<< std::setw(8)
219
<<
fBoundaryProcs
[
NoRINDEX
] <<
G4endl
;
220
}
221
// LBNL polished
222
if
(
fBoundaryProcs
[
PolishedLumirrorAirReflection
] > 0) {
223
G4cout
<<
" Polished Lumirror Air reflection: "
<< std::setw(8)
224
<<
fBoundaryProcs
[
PolishedLumirrorAirReflection
] <<
G4endl
;
225
}
226
if
(
fBoundaryProcs
[
PolishedLumirrorGlueReflection
] > 0) {
227
G4cout
<<
" Polished Lumirror Glue reflection: "
<< std::setw(8)
228
<<
fBoundaryProcs
[
PolishedLumirrorGlueReflection
] <<
G4endl
;
229
}
230
if
(
fBoundaryProcs
[
PolishedAirReflection
] > 0) {
231
G4cout
<<
" Polished Air reflection: "
<< std::setw(8)
232
<<
fBoundaryProcs
[
PolishedAirReflection
] <<
G4endl
;
233
}
234
if
(
fBoundaryProcs
[
PolishedTeflonAirReflection
] > 0) {
235
G4cout
<<
" Polished Teflon Air reflection: "
<< std::setw(8)
236
<<
fBoundaryProcs
[
PolishedTeflonAirReflection
] <<
G4endl
;
237
}
238
if
(
fBoundaryProcs
[
PolishedTiOAirReflection
] > 0) {
239
G4cout
<<
" Polished TiO Air reflection: "
<< std::setw(8)
240
<<
fBoundaryProcs
[
PolishedTiOAirReflection
] <<
G4endl
;
241
}
242
if
(
fBoundaryProcs
[
PolishedTyvekAirReflection
] > 0) {
243
G4cout
<<
" Polished Tyvek Air reflection: "
<< std::setw(8)
244
<<
fBoundaryProcs
[
PolishedTyvekAirReflection
] <<
G4endl
;
245
}
246
if
(
fBoundaryProcs
[
PolishedVM2000AirReflection
] > 0) {
247
G4cout
<<
" Polished VM2000 Air reflection: "
<< std::setw(8)
248
<<
fBoundaryProcs
[
PolishedVM2000AirReflection
] <<
G4endl
;
249
}
250
if
(
fBoundaryProcs
[
PolishedVM2000GlueReflection
] > 0) {
251
G4cout
<<
" Polished VM2000 Glue reflection: "
<< std::setw(8)
252
<<
fBoundaryProcs
[
PolishedVM2000GlueReflection
] <<
G4endl
;
253
}
254
// LBNL etched
255
if
(
fBoundaryProcs
[
EtchedLumirrorAirReflection
] > 0) {
256
G4cout
<<
" Etched Lumirror Air reflection: "
<< std::setw(8)
257
<<
fBoundaryProcs
[
EtchedLumirrorAirReflection
] <<
G4endl
;
258
}
259
if
(
fBoundaryProcs
[
EtchedLumirrorGlueReflection
] > 0) {
260
G4cout
<<
" Etched Lumirror Glue reflection: "
<< std::setw(8)
261
<<
fBoundaryProcs
[
EtchedLumirrorGlueReflection
] <<
G4endl
;
262
}
263
if
(
fBoundaryProcs
[
EtchedAirReflection
] > 0) {
264
G4cout
<<
" Etched Air reflection: "
<< std::setw(8)
265
<<
fBoundaryProcs
[
EtchedAirReflection
] <<
G4endl
;
266
}
267
if
(
fBoundaryProcs
[
EtchedTeflonAirReflection
] > 0) {
268
G4cout
<<
" Etched Teflon Air reflection: "
<< std::setw(8)
269
<<
fBoundaryProcs
[
EtchedTeflonAirReflection
] <<
G4endl
;
270
}
271
if
(
fBoundaryProcs
[
EtchedTiOAirReflection
] > 0) {
272
G4cout
<<
" Etched TiO Air reflection: "
<< std::setw(8)
273
<<
fBoundaryProcs
[
EtchedTiOAirReflection
] <<
G4endl
;
274
}
275
if
(
fBoundaryProcs
[
EtchedTyvekAirReflection
] > 0) {
276
G4cout
<<
" Etched Tyvek Air reflection: "
<< std::setw(8)
277
<<
fBoundaryProcs
[
EtchedTyvekAirReflection
] <<
G4endl
;
278
}
279
if
(
fBoundaryProcs
[
EtchedVM2000AirReflection
] > 0) {
280
G4cout
<<
" Etched VM2000 Air reflection: "
<< std::setw(8)
281
<<
fBoundaryProcs
[
EtchedVM2000AirReflection
] <<
G4endl
;
282
}
283
if
(
fBoundaryProcs
[
EtchedVM2000GlueReflection
] > 0) {
284
G4cout
<<
" Etched VM2000 Glue reflection: "
<< std::setw(8)
285
<<
fBoundaryProcs
[
EtchedVM2000GlueReflection
] <<
G4endl
;
286
}
287
// LBNL ground
288
if
(
fBoundaryProcs
[
GroundLumirrorAirReflection
] > 0) {
289
G4cout
<<
" Ground Lumirror Air reflection: "
<< std::setw(8)
290
<<
fBoundaryProcs
[
GroundLumirrorAirReflection
] <<
G4endl
;
291
}
292
if
(
fBoundaryProcs
[
GroundLumirrorGlueReflection
] > 0) {
293
G4cout
<<
" Ground Lumirror Glue reflection: "
<< std::setw(8)
294
<<
fBoundaryProcs
[
GroundLumirrorGlueReflection
] <<
G4endl
;
295
}
296
if
(
fBoundaryProcs
[
GroundAirReflection
] > 0) {
297
G4cout
<<
" Ground Air reflection: "
<< std::setw(8)
298
<<
fBoundaryProcs
[
GroundAirReflection
] <<
G4endl
;
299
}
300
if
(
fBoundaryProcs
[
GroundTeflonAirReflection
] > 0) {
301
G4cout
<<
" Ground Teflon Air reflection: "
<< std::setw(8)
302
<<
fBoundaryProcs
[
GroundTeflonAirReflection
] <<
G4endl
;
303
}
304
if
(
fBoundaryProcs
[
GroundTiOAirReflection
] > 0) {
305
G4cout
<<
" Ground TiO Air reflection: "
<< std::setw(8)
306
<<
fBoundaryProcs
[
GroundTiOAirReflection
] <<
G4endl
;
307
}
308
if
(
fBoundaryProcs
[
GroundTyvekAirReflection
] > 0) {
309
G4cout
<<
" Ground Tyvek Air reflection: "
<< std::setw(8)
310
<<
fBoundaryProcs
[
GroundTyvekAirReflection
] <<
G4endl
;
311
}
312
if
(
fBoundaryProcs
[
GroundVM2000AirReflection
] > 0) {
313
G4cout
<<
" Ground VM2000 Air reflection: "
<< std::setw(8)
314
<<
fBoundaryProcs
[
GroundVM2000AirReflection
] <<
G4endl
;
315
}
316
if
(
fBoundaryProcs
[
GroundVM2000GlueReflection
] > 0) {
317
G4cout
<<
" Ground VM2000 Glue reflection: "
<< std::setw(8)
318
<<
fBoundaryProcs
[
GroundVM2000GlueReflection
] <<
G4endl
;
319
}
320
321
G4int
sum
= std::accumulate(
fBoundaryProcs
.begin(),
fBoundaryProcs
.end(), 0);
322
G4cout
<<
" Sum: "
<< std::setw(8) << sum <<
G4endl
;
323
G4cout
<<
" Unaccounted for: "
<< std::setw(8)
324
<<
fTotalSurface
- sum <<
G4endl
;
325
326
G4cout
<<
"---------------------------------\n"
;
327
328
G4cout
.setf(mode, std::ios::floatfield);
329
G4cout
.precision(prec);
330
}
geant4
tree
geant4-10.6-release
examples
extended
optical
OpNovice2
src
Run.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:55
using
1.8.2 with
ECCE GitHub integration