Geant4
10.03.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
B3aRunAction.cc
Go to the documentation of this file.
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
// $Id: B3aRunAction.cc 99559 2016-09-27 07:02:21Z gcosmo $
27
//
30
31
#include "
B3aRunAction.hh
"
32
#include "B3PrimaryGeneratorAction.hh"
33
34
#include "
G4RunManager.hh
"
35
#include "
G4Run.hh
"
36
#include "
G4AccumulableManager.hh
"
37
#include "
G4UnitsTable.hh
"
38
#include "
G4SystemOfUnits.hh
"
39
40
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41
42
B3aRunAction::B3aRunAction
()
43
:
G4UserRunAction
(),
44
fGoodEvents(0),
45
fSumDose(0.)
46
{
47
//add new units for dose
48
//
49
const
G4double
milligray
= 1.e-3*
gray
;
50
const
G4double
microgray
= 1.e-6*
gray
;
51
const
G4double
nanogray = 1.e-9*
gray
;
52
const
G4double
picogray = 1.e-12*
gray
;
53
54
new
G4UnitDefinition
(
"milligray"
,
"milliGy"
,
"Dose"
, milligray);
55
new
G4UnitDefinition
(
"microgray"
,
"microGy"
,
"Dose"
, microgray);
56
new
G4UnitDefinition
(
"nanogray"
,
"nanoGy"
,
"Dose"
, nanogray);
57
new
G4UnitDefinition
(
"picogray"
,
"picoGy"
,
"Dose"
, picogray);
58
59
// Register accumulable to the accumulable manager
60
G4AccumulableManager
* accumulableManager =
G4AccumulableManager::Instance
();
61
accumulableManager->
RegisterAccumulable
(fGoodEvents);
62
accumulableManager->
RegisterAccumulable
(fSumDose);
63
}
64
65
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66
67
B3aRunAction::~B3aRunAction
()
68
{ }
69
70
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71
72
void
B3aRunAction::BeginOfRunAction
(
const
G4Run
* run)
73
{
74
G4cout
<<
"### Run "
<< run->
GetRunID
() <<
" start."
<<
G4endl
;
75
76
// reset accumulables to their initial values
77
G4AccumulableManager
* accumulableManager =
G4AccumulableManager::Instance
();
78
accumulableManager->
Reset
();
79
80
//inform the runManager to save random number seed
81
G4RunManager::GetRunManager
()->
SetRandomNumberStore
(
false
);
82
}
83
84
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85
86
void
B3aRunAction::EndOfRunAction
(
const
G4Run
* run)
87
{
88
G4int
nofEvents = run->
GetNumberOfEvent
();
89
if
(nofEvents == 0)
return
;
90
91
// Merge accumulables
92
G4AccumulableManager
* accumulableManager =
G4AccumulableManager::Instance
();
93
accumulableManager->
Merge
();
94
95
// Run conditions
96
// note: There is no primary generator action object for "master"
97
// run manager for multi-threaded mode.
98
const
B3PrimaryGeneratorAction
* generatorAction
99
=
static_cast<
const
B3PrimaryGeneratorAction
*
>
(
100
G4RunManager::GetRunManager
()->
GetUserPrimaryGeneratorAction
());
101
G4String
partName;
102
if
(generatorAction)
103
{
104
G4ParticleDefinition
* particle
105
= generatorAction->
GetParticleGun
()->
GetParticleDefinition
();
106
partName = particle->
GetParticleName
();
107
}
108
109
// Print results
110
//
111
if
(
IsMaster
())
112
{
113
G4cout
114
<<
G4endl
115
<<
"--------------------End of Global Run-----------------------"
116
<<
G4endl
117
<<
" The run was "
<< nofEvents <<
" events "
;
118
}
119
else
120
{
121
G4cout
122
<<
G4endl
123
<<
"--------------------End of Local Run------------------------"
124
<<
G4endl
125
<<
" The run was "
<< nofEvents <<
" "
<< partName;
126
}
127
G4cout
128
<<
"; Nb of 'good' e+ annihilations: "
<< fGoodEvents.
GetValue
() <<
G4endl
129
<<
" Total dose in patient : "
<<
G4BestUnit
(fSumDose.
GetValue
(),
"Dose"
)
130
<<
G4endl
131
<<
"------------------------------------------------------------"
<<
G4endl
132
<<
G4endl
;
133
}
134
135
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4RunManager::GetUserPrimaryGeneratorAction
const G4VUserPrimaryGeneratorAction * GetUserPrimaryGeneratorAction() const
Definition:
G4RunManager.hh:373
G4AccumulableManager::Reset
void Reset()
Definition:
G4AccumulableManager.cc:207
G4RunManager.hh
B3aRunAction::B3aRunAction
B3aRunAction()
Definition:
B3aRunAction.cc:42
B3aRunAction.hh
Definition of the B3aRunAction class.
G4UnitsTable.hh
G4UnitDefinition
Definition:
G4UnitsTable.hh:80
B3PrimaryGeneratorAction::GetParticleGun
const G4ParticleGun * GetParticleGun() const
Definition:
B3PrimaryGeneratorAction.hh:55
G4BestUnit
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
Definition:
G4SteppingVerbose.cc:53
G4RunManager::SetRandomNumberStore
void SetRandomNumberStore(G4bool flag)
Definition:
G4RunManager.hh:411
G4ParticleDefinition
Definition:
G4ParticleDefinition.hh:72
G4AccumulableManager::Merge
void Merge()
Definition:
G4AccumulableManager.cc:172
G4int
int G4int
Definition:
G4Types.hh:78
G4ParticleDefinition::GetParticleName
const G4String & GetParticleName() const
Definition:
G4ParticleDefinition.hh:120
G4AccumulableManager::Instance
static G4AccumulableManager * Instance()
Definition:
G4AccumulableManager.cc:45
microgray
static constexpr double microgray
Definition:
G4SIunits.hh:312
B3PrimaryGeneratorAction
Definition:
B3PrimaryGeneratorAction.hh:47
B3aRunAction::BeginOfRunAction
virtual void BeginOfRunAction(const G4Run *)
Definition:
B3aRunAction.cc:72
G4AccumulableManager::RegisterAccumulable
G4bool RegisterAccumulable(G4Accumulable< T > &accumulable)
G4cout
G4GLOB_DLL std::ostream G4cout
G4Run::GetNumberOfEvent
G4int GetNumberOfEvent() const
Definition:
G4Run.hh:79
gray
static constexpr double gray
Definition:
G4SIunits.hh:309
G4UserRunAction::IsMaster
G4bool IsMaster() const
Definition:
G4UserRunAction.hh:69
G4Run::GetRunID
G4int GetRunID() const
Definition:
G4Run.hh:76
G4Accumulable::GetValue
T GetValue() const
G4Run
Definition:
G4Run.hh:46
milligray
static constexpr double milligray
Definition:
G4SIunits.hh:311
G4AccumulableManager
Definition:
G4AccumulableManager.hh:44
G4RunManager::GetRunManager
static G4RunManager * GetRunManager()
Definition:
G4RunManager.cc:79
B3aRunAction::EndOfRunAction
virtual void EndOfRunAction(const G4Run *)
Definition:
B3aRunAction.cc:86
G4AccumulableManager.hh
G4Run.hh
G4ParticleGun::GetParticleDefinition
G4ParticleDefinition * GetParticleDefinition() const
Definition:
G4ParticleGun.hh:106
G4UserRunAction
Definition:
G4UserRunAction.hh:52
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4double
double G4double
Definition:
G4Types.hh:76
G4SystemOfUnits.hh
B3aRunAction::~B3aRunAction
virtual ~B3aRunAction()
Definition:
B3aRunAction.cc:67
G4String
Definition:
G4String.hh:45
source
geant4.10.03.p02
examples
basic
B3
B3a
src
B3aRunAction.cc
Generated on Tue Nov 28 2017 21:43:11 for Geant4 by
1.8.5