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
extended
visualization
userVisAction
src
extended/visualization/userVisAction/src/B1RunAction.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: B1RunAction.cc 69587 2013-05-08 14:26:03Z gcosmo $
27
//
28
/// \file B1RunAction.cc
29
/// \brief Implementation of the B1RunAction class
30
31
#include "B1RunAction.hh"
32
#include "B1PrimaryGeneratorAction.hh"
33
#include "B1EventAction.hh"
34
#include "B1SteppingAction.hh"
35
// use of other actions
36
// - primary generator: to get info for printing about the primary
37
// - event action: to get and reset accumulated energy sums
38
// - stepping action: to get info about accounting volume
39
40
#include "
G4Run.hh
"
41
#include "
G4RunManager.hh
"
42
#include "
G4UnitsTable.hh
"
43
#include "
G4SystemOfUnits.hh
"
44
45
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46
47
B1RunAction::B1RunAction
()
48
:
G4UserRunAction
()
49
{
50
// add new units for dose
51
//
52
const
G4double
milligray = 1.e-3*
gray
;
53
const
G4double
microgray = 1.e-6*
gray
;
54
const
G4double
nanogray = 1.e-9*
gray
;
55
const
G4double
picogray = 1.e-12*
gray
;
56
57
new
G4UnitDefinition
(
"milligray"
,
"milliGy"
,
"Dose"
, milligray);
58
new
G4UnitDefinition
(
"microgray"
,
"microGy"
,
"Dose"
, microgray);
59
new
G4UnitDefinition
(
"nanogray"
,
"nanoGy"
,
"Dose"
, nanogray);
60
new
G4UnitDefinition
(
"picogray"
,
"picoGy"
,
"Dose"
, picogray);
61
}
62
63
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64
65
B1RunAction::~B1RunAction
()
66
{}
67
68
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
70
void
B1RunAction::BeginOfRunAction
(
const
G4Run
* aRun)
71
{
72
G4cout
<<
"### Run "
<< aRun->
GetRunID
() <<
" start."
<<
G4endl
;
73
74
//inform the runManager to save random number seed
75
G4RunManager::GetRunManager
()->
SetRandomNumberStore
(
false
);
76
77
//initialize event cumulative quantities
78
B1EventAction::Instance
()->
Reset
();
79
}
80
81
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82
83
void
B1RunAction::EndOfRunAction
(
const
G4Run
* aRun)
84
{
85
G4int
nofEvents = aRun->
GetNumberOfEvent
();
86
if
(nofEvents == 0)
return
;
87
88
// Compute dose
89
//
90
G4double
energySum =
B1EventAction::Instance
()->
GetEnergySum
();
91
G4double
energy2Sum =
B1EventAction::Instance
()->
GetEnergy2Sum
();
92
G4double
rms = energy2Sum - energySum*energySum/nofEvents;
93
if
(rms > 0.) rms = std::sqrt(rms);
else
rms = 0.;
94
95
G4double
mass =
B1SteppingAction::Instance
()->
GetVolume
()->
GetMass
();
96
G4double
dose = energySum/mass;
97
G4double
rmsDose = rms/mass;
98
99
// Run conditions
100
//
101
const
G4ParticleGun
* particleGun
102
=
B1PrimaryGeneratorAction::Instance
()->
GetParticleGun
();
103
G4String
particleName
104
= particleGun->
GetParticleDefinition
()->
GetParticleName
();
105
G4double
particleEnergy = particleGun->
GetParticleEnergy
();
106
107
// Print
108
//
109
G4cout
110
<<
"\n--------------------End of Run------------------------------\n"
111
<<
" The run consists of "
<< nofEvents <<
" "
<< particleName <<
" of "
112
<<
G4BestUnit
(particleEnergy,
"Energy"
)
113
<<
"\n Dose in scoring volume "
114
<<
B1SteppingAction::Instance
()->
GetVolume
()->
GetName
() <<
" : "
115
<<
G4BestUnit
(dose,
"Dose"
)
116
<<
" +- "
<<
G4BestUnit
(rmsDose,
"Dose"
)
117
<<
"\n------------------------------------------------------------\n"
118
<<
G4endl
;
119
}
120
121
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1RunAction::EndOfRunAction
virtual void EndOfRunAction(const G4Run *)
Definition:
basic/B1/src/B1RunAction.cc:82
G4LogicalVolume::GetName
G4String GetName() const
G4RunManager.hh
B1RunAction::B1RunAction
B1RunAction()
Definition:
basic/B1/src/B1RunAction.cc:44
B1PrimaryGeneratorAction::Instance
static const B1PrimaryGeneratorAction * Instance()
Definition:
extended/visualization/userVisAction/src/B1PrimaryGeneratorAction.cc:49
G4UnitsTable.hh
G4UnitDefinition
Definition:
G4UnitsTable.hh:64
B1SteppingAction::GetVolume
G4LogicalVolume * GetVolume() const
Definition:
extended/visualization/userVisAction/include/B1SteppingAction.hh:66
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:398
B1SteppingAction::Instance
static B1SteppingAction * Instance()
Definition:
extended/visualization/userVisAction/src/B1SteppingAction.cc:45
G4int
int G4int
Definition:
G4Types.hh:78
G4ParticleDefinition::GetParticleName
const G4String & GetParticleName() const
Definition:
G4ParticleDefinition.hh:159
B1EventAction::Reset
void Reset()
Definition:
extended/visualization/userVisAction/src/B1EventAction.cc:96
G4cout
G4GLOB_DLL std::ostream G4cout
B1EventAction::GetEnergySum
G4double GetEnergySum() const
Definition:
extended/visualization/userVisAction/include/B1EventAction.hh:62
G4Run::GetNumberOfEvent
G4int GetNumberOfEvent() const
Definition:
G4Run.hh:79
G4Run::GetRunID
G4int GetRunID() const
Definition:
G4Run.hh:76
G4Run
Definition:
G4Run.hh:46
B1RunAction::BeginOfRunAction
virtual void BeginOfRunAction(const G4Run *)
Definition:
basic/B1/src/B1RunAction.cc:74
B1EventAction::Instance
static B1EventAction * Instance()
Definition:
extended/visualization/userVisAction/src/B1EventAction.cc:46
G4RunManager::GetRunManager
static G4RunManager * GetRunManager()
Definition:
G4RunManager.cc:74
B1EventAction::GetEnergy2Sum
G4double GetEnergy2Sum() const
Definition:
extended/visualization/userVisAction/include/B1EventAction.hh:63
G4Run.hh
B1PrimaryGeneratorAction::GetParticleGun
const G4ParticleGun * GetParticleGun() const
Definition:
basic/B1/include/B1PrimaryGeneratorAction.hh:57
B1RunAction::~B1RunAction
virtual ~B1RunAction()
Definition:
basic/B1/src/B1RunAction.cc:62
G4ParticleGun::GetParticleDefinition
G4ParticleDefinition * GetParticleDefinition() const
Definition:
G4ParticleGun.hh:106
G4UserRunAction
Definition:
G4UserRunAction.hh:52
G4ParticleGun
Definition:
G4ParticleGun.hh:62
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4LogicalVolume::GetMass
G4double GetMass(G4bool forced=false, G4bool propagate=true, G4Material *parMaterial=0)
Definition:
G4LogicalVolume.cc:301
G4double
double G4double
Definition:
G4Types.hh:76
G4SystemOfUnits.hh
G4ParticleGun::GetParticleEnergy
G4double GetParticleEnergy() const
Definition:
G4ParticleGun.hh:110
python.hepunit.gray
gray
Definition:
hepunit.py:219
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