Geant4.10
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4.10.00.p01
examples
basic
B3
src
B3RunAction.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: B3RunAction.cc 71323 2013-06-13 16:54:23Z gcosmo $
27
//
28
/// \file B3RunAction.cc
29
/// \brief Implementation of the B3RunAction class
30
31
#include "
B3RunAction.hh
"
32
#include "
B3PrimaryGeneratorAction.hh
"
33
#include "
B3Run.hh
"
34
35
#include "
G4Run.hh
"
36
#include "
G4RunManager.hh
"
37
#include "
G4UnitsTable.hh
"
38
#include "
G4SystemOfUnits.hh
"
39
40
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41
42
B3RunAction::B3RunAction
()
43
:
G4UserRunAction
()
44
{
45
//add new units for dose
46
//
47
const
G4double
milligray = 1.e-3*
gray
;
48
const
G4double
microgray = 1.e-6*
gray
;
49
const
G4double
nanogray = 1.e-9*
gray
;
50
const
G4double
picogray = 1.e-12*
gray
;
51
52
new
G4UnitDefinition
(
"milligray"
,
"milliGy"
,
"Dose"
, milligray);
53
new
G4UnitDefinition
(
"microgray"
,
"microGy"
,
"Dose"
, microgray);
54
new
G4UnitDefinition
(
"nanogray"
,
"nanoGy"
,
"Dose"
, nanogray);
55
new
G4UnitDefinition
(
"picogray"
,
"picoGy"
,
"Dose"
, picogray);
56
}
57
58
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59
60
B3RunAction::~B3RunAction
()
61
{ }
62
63
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64
65
G4Run
*
B3RunAction::GenerateRun
()
66
{
return
new
B3Run
; }
67
68
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
70
void
B3RunAction::BeginOfRunAction
(
const
G4Run
* run)
71
{
72
G4cout
<<
"### Run "
<< run->
GetRunID
() <<
" start."
<<
G4endl
;
73
74
//inform the runManager to save random number seed
75
G4RunManager::GetRunManager
()->
SetRandomNumberStore
(
false
);
76
}
77
78
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79
80
void
B3RunAction::EndOfRunAction
(
const
G4Run
* run)
81
{
82
G4int
nofEvents = run->
GetNumberOfEvent
();
83
if
(nofEvents == 0)
return
;
84
85
// Run conditions
86
// note: There is no primary generator action object for "master"
87
// run manager for multi-threaded mode.
88
const
B3PrimaryGeneratorAction
* generatorAction
89
=
static_cast<
const
B3PrimaryGeneratorAction
*
>
(
90
G4RunManager::GetRunManager
()->
GetUserPrimaryGeneratorAction
());
91
G4String
partName;
92
if
(generatorAction)
93
{
94
G4ParticleDefinition
* particle
95
= generatorAction->
GetParticleGun
()->
GetParticleDefinition
();
96
partName = particle->
GetParticleName
();
97
}
98
99
//results
100
//
101
const
B3Run
* b3Run =
static_cast<
const
B3Run
*
>
(run);
102
G4int
nbGoodEvents = b3Run->
GetNbGoodEvents
();
103
G4double
sumDose = b3Run->
GetSumDose
();
104
105
//print
106
//
107
if
(
IsMaster
())
108
{
109
G4cout
110
<<
"\n--------------------End of Global Run-----------------------"
111
<<
" \n The run was "
<< nofEvents <<
" events "
;
112
}
113
else
114
{
115
G4cout
116
<<
"\n--------------------End of Local Run------------------------"
117
<<
" \n The run was "
<< nofEvents <<
" "
<< partName;
118
}
119
G4cout
120
<<
"; Nb of 'good' e+ annihilations: "
<< nbGoodEvents
121
<<
"\n Total dose in patient : "
<<
G4BestUnit
(sumDose,
"Dose"
)
122
<<
"\n------------------------------------------------------------\n"
123
<<
G4endl
;
124
}
125
126
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4RunManager::GetUserPrimaryGeneratorAction
const G4VUserPrimaryGeneratorAction * GetUserPrimaryGeneratorAction() const
Definition:
G4RunManager.hh:360
G4RunManager.hh
B3RunAction::GenerateRun
virtual G4Run * GenerateRun()
Definition:
B3RunAction.cc:65
G4UnitsTable.hh
G4UnitDefinition
Definition:
G4UnitsTable.hh:64
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
B3RunAction::EndOfRunAction
virtual void EndOfRunAction(const G4Run *)
Definition:
B3RunAction.cc:80
G4RunManager::SetRandomNumberStore
void SetRandomNumberStore(G4bool flag)
Definition:
G4RunManager.hh:398
B3RunAction::~B3RunAction
virtual ~B3RunAction()
Definition:
B3RunAction.cc:60
G4ParticleDefinition
Definition:
G4ParticleDefinition.hh:111
G4int
int G4int
Definition:
G4Types.hh:78
G4ParticleDefinition::GetParticleName
const G4String & GetParticleName() const
Definition:
G4ParticleDefinition.hh:159
B3PrimaryGeneratorAction
Definition:
B3PrimaryGeneratorAction.hh:47
G4cout
G4GLOB_DLL std::ostream G4cout
G4Run::GetNumberOfEvent
G4int GetNumberOfEvent() const
Definition:
G4Run.hh:79
G4UserRunAction::IsMaster
G4bool IsMaster() const
Definition:
G4UserRunAction.hh:69
G4Run::GetRunID
G4int GetRunID() const
Definition:
G4Run.hh:76
G4Run
Definition:
G4Run.hh:46
B3RunAction::BeginOfRunAction
virtual void BeginOfRunAction(const G4Run *)
Definition:
B3RunAction.cc:70
G4RunManager::GetRunManager
static G4RunManager * GetRunManager()
Definition:
G4RunManager.cc:74
B3RunAction.hh
Definition of the B3RunAction class.
B3Run::GetSumDose
G4double GetSumDose() const
Definition:
B3Run.hh:53
B3Run
Definition:
B3Run.hh:42
G4Run.hh
G4ParticleGun::GetParticleDefinition
G4ParticleDefinition * GetParticleDefinition() const
Definition:
G4ParticleGun.hh:106
G4UserRunAction
Definition:
G4UserRunAction.hh:52
B3Run::GetNbGoodEvents
G4int GetNbGoodEvents() const
Definition:
B3Run.hh:52
B3PrimaryGeneratorAction.hh
Definition of the B3PrimaryGeneratorAction class.
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4double
double G4double
Definition:
G4Types.hh:76
G4SystemOfUnits.hh
python.hepunit.gray
gray
Definition:
hepunit.py:219
B3RunAction::B3RunAction
B3RunAction()
Definition:
B3RunAction.cc:42
B3Run.hh
Definition of the B3Run class.
G4String
Definition:
examples/extended/parallel/TopC/ParN02/AnnotatedFiles/G4String.hh:45
Generated on Wed Apr 30 2014 15:54:26 for Geant4.10 by
1.8.7