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
B3bRunAction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file B3bRunAction.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
//
26
//
29
30
#include "
B3bRunAction.hh
"
31
#include "
B3bRun.hh
"
32
#include "B3PrimaryGeneratorAction.hh"
33
34
#include "
G4Run.hh
"
35
#include "
G4RunManager.hh
"
36
#include "
G4UnitsTable.hh
"
37
#include "
G4SystemOfUnits.hh
"
38
39
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40
41
B3bRunAction::B3bRunAction
()
42
:
G4UserRunAction
()
43
{
44
//add new units for dose
45
//
46
const
G4double
milligray
= 1.e-3*
gray
;
47
const
G4double
microgray
= 1.e-6*
gray
;
48
const
G4double
nanogray = 1.e-9*
gray
;
49
const
G4double
picogray = 1.e-12*
gray
;
50
51
new
G4UnitDefinition
(
"milligray"
,
"milliGy"
,
"Dose"
, milligray);
52
new
G4UnitDefinition
(
"microgray"
,
"microGy"
,
"Dose"
, microgray);
53
new
G4UnitDefinition
(
"nanogray"
,
"nanoGy"
,
"Dose"
, nanogray);
54
new
G4UnitDefinition
(
"picogray"
,
"picoGy"
,
"Dose"
, picogray);
55
}
56
57
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58
59
B3bRunAction::~B3bRunAction
()
60
{ }
61
62
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63
64
G4Run
*
B3bRunAction::GenerateRun
()
65
{
return
new
B3bRun
; }
66
67
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68
69
void
B3bRunAction::BeginOfRunAction
(
const
G4Run
* run)
70
{
71
G4cout
<<
"### Run "
<< run->
GetRunID
() <<
" start."
<<
G4endl
;
72
73
//inform the runManager to save random number seed
74
G4RunManager::GetRunManager
()->
SetRandomNumberStore
(
false
);
75
}
76
77
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78
79
void
B3bRunAction::EndOfRunAction
(
const
G4Run
* run)
80
{
81
G4int
nofEvents = run->
GetNumberOfEvent
();
82
if
(nofEvents == 0)
return
;
83
84
// Run conditions
85
// note: There is no primary generator action object for "master"
86
// run manager for multi-threaded mode.
87
const
B3PrimaryGeneratorAction
* generatorAction
88
=
static_cast<
const
B3PrimaryGeneratorAction
*
>
(
89
G4RunManager::GetRunManager
()->
GetUserPrimaryGeneratorAction
());
90
G4String
partName;
91
if
(generatorAction)
92
{
93
G4ParticleDefinition
*
particle
94
= generatorAction->
GetParticleGun
()->
GetParticleDefinition
();
95
partName = particle->
GetParticleName
();
96
}
97
98
//results
99
//
100
const
B3bRun
* b3Run =
static_cast<
const
B3bRun
*
>
(run);
101
G4int
nbGoodEvents = b3Run->
GetNbGoodEvents
();
102
G4double
sumDose
= b3Run->
GetSumDose
();
103
G4StatAnalysis
statDose = b3Run->
GetStatDose
();
104
105
//print
106
//
107
if
(
IsMaster
())
108
{
109
G4cout
110
<<
G4endl
111
<<
"--------------------End of Global Run-----------------------"
112
<<
G4endl
113
<<
" The run was "
<< nofEvents <<
" events "
;
114
}
115
else
116
{
117
G4cout
118
<<
G4endl
119
<<
"--------------------End of Local Run------------------------"
120
<<
G4endl
121
<<
" The run was "
<< nofEvents <<
" "
<< partName;
122
}
123
statDose /=
gray
;
124
G4cout
125
<<
"; Nb of 'good' e+ annihilations: "
<< nbGoodEvents <<
G4endl
126
<<
" Total dose in patient : "
<<
G4BestUnit
(sumDose,
"Dose"
) <<
G4endl
127
<<
" Total dose in patient : "
<< statDose <<
" Gy"
<<
G4endl
128
<<
"------------------------------------------------------------"
<<
G4endl
129
<<
G4endl
;
130
}
131
132
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
basic
B3
B3b
src
B3bRunAction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:02
using
1.8.2 with
ECCE GitHub integration