Geant4
10.02.p01
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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 94031 2015-11-05 11:54:38Z ihrivnac $
27
//
30
31
#include "
B3aRunAction.hh
"
32
#include "B3PrimaryGeneratorAction.hh"
33
34
#include "
G4RunManager.hh
"
35
#include "
G4Run.hh
"
36
#include "
G4ParameterManager.hh
"
37
#include "
G4UnitsTable.hh
"
38
#include "
G4SystemOfUnits.hh
"
39
40
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41
42
B3aRunAction::B3aRunAction
()
43
:
G4UserRunAction
(),
44
fGoodEvents(
"GoodEvents"
, 0),
45
fSumDose(
"SumDose"
, 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 parameter to the parameter manager
60
G4ParameterManager
* parameterManager =
G4ParameterManager::Instance
();
61
parameterManager->
RegisterParameter
(
fGoodEvents
);
62
parameterManager->
RegisterParameter
(
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 parameters to their initial values
77
G4ParameterManager
* parameterManager =
G4ParameterManager::Instance
();
78
parameterManager->
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 parameters
92
G4ParameterManager
* parameterManager =
G4ParameterManager::Instance
();
93
parameterManager->
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:362
G4RunManager.hh
B3aRunAction::B3aRunAction
B3aRunAction()
Definition:
B3aRunAction.cc:42
B3aRunAction.hh
Definition of the B3aRunAction class.
B3aRunAction::fGoodEvents
G4Parameter< G4int > fGoodEvents
Definition:
B3aRunAction.hh:50
B3aRunAction::fSumDose
G4Parameter< G4double > fSumDose
Definition:
B3aRunAction.hh:54
G4UnitsTable.hh
G4UnitDefinition
Definition:
G4UnitsTable.hh:64
G4ParameterManager::Instance
static G4ParameterManager * Instance()
Definition:
G4ParameterManager.cc:45
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:400
G4ParticleDefinition
Definition:
G4ParticleDefinition.hh:111
G4int
int G4int
Definition:
G4Types.hh:78
milligray
static const double milligray
Definition:
G4SIunits.hh:308
G4ParticleDefinition::GetParticleName
const G4String & GetParticleName() const
Definition:
G4ParticleDefinition.hh:159
microgray
static const double microgray
Definition:
G4SIunits.hh:309
B3PrimaryGeneratorAction
The primary generator action class with particle gum.
Definition:
B3PrimaryGeneratorAction.hh:47
B3aRunAction::BeginOfRunAction
virtual void BeginOfRunAction(const G4Run *)
Definition:
B3aRunAction.cc:72
G4cout
G4GLOB_DLL std::ostream G4cout
G4Run::GetNumberOfEvent
G4int GetNumberOfEvent() const
Definition:
G4Run.hh:79
G4ParameterManager
Definition:
G4ParameterManager.hh:45
G4UserRunAction::IsMaster
G4bool IsMaster() const
Definition:
G4UserRunAction.hh:69
G4Run::GetRunID
G4int GetRunID() const
Definition:
G4Run.hh:76
G4Run
Definition:
G4Run.hh:46
G4ParameterManager::Reset
void Reset()
Definition:
G4ParameterManager.cc:154
gray
static const double gray
Definition:
G4SIunits.hh:306
G4RunManager::GetRunManager
static G4RunManager * GetRunManager()
Definition:
G4RunManager.cc:79
B3aRunAction::EndOfRunAction
virtual void EndOfRunAction(const G4Run *)
Definition:
B3aRunAction.cc:86
G4Run.hh
G4Parameter::GetValue
T GetValue() const
G4ParameterManager::Merge
void Merge()
Definition:
G4ParameterManager.cc:119
G4ParticleGun::GetParticleDefinition
G4ParticleDefinition * GetParticleDefinition() const
Definition:
G4ParticleGun.hh:106
G4UserRunAction
Definition:
G4UserRunAction.hh:52
G4ParameterManager.hh
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4double
double G4double
Definition:
G4Types.hh:76
G4SystemOfUnits.hh
B3aRunAction::~B3aRunAction
virtual ~B3aRunAction()
Definition:
B3aRunAction.cc:67
G4ParameterManager::RegisterParameter
void RegisterParameter(G4Parameter< T > ¶meter)
G4String
Definition:
G4String.hh:45
geant4.10.02.p01
examples
basic
B3
B3a
src
B3aRunAction.cc
Generated on Thu Mar 3 2016 14:40:43 for Geant4 by
1.8.8