Geant4
10.02.p03
examples/extended/radioactivedecay/rdecay01/src/RunAction.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
//
28
//
29
//
30
// $Id: RunAction.cc 78307 2013-12-11 10:55:57Z gcosmo $
31
//
32
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34
35
#include "RunAction.hh"
36
#include "Run.hh"
37
#include "PrimaryGeneratorAction.hh"
38
#include "HistoManager.hh"
39
40
#include "
G4Run.hh
"
41
#include "
G4RunManager.hh
"
42
#include "
G4UnitsTable.hh
"
43
#include "
G4PhysicalConstants.hh
"
44
#include "
G4SystemOfUnits.hh
"
45
#include <iomanip>
46
47
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48
49
RunAction::RunAction
(
PrimaryGeneratorAction
* kin)
50
:
G4UserRunAction
(),
51
fPrimary(kin), fRun(0), fHistoManager(0)
52
{
53
fHistoManager
=
new
HistoManager
();
54
}
55
56
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57
58
RunAction::~RunAction
()
59
{
60
delete
fHistoManager
;
61
}
62
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63
64
G4Run
*
RunAction::GenerateRun
()
65
{
66
fRun
=
new
Run
();
67
return
fRun
;
68
}
69
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70
71
void
RunAction::BeginOfRunAction
(
const
G4Run
*)
72
{
73
// keep run condition
74
if
(
fPrimary
) {
75
G4ParticleDefinition
* particle
76
=
fPrimary
->
GetParticleGun
()->
GetParticleDefinition
();
77
G4double
energy
=
fPrimary
->
GetParticleGun
()->
GetParticleEnergy
();
78
fRun
->
SetPrimary
(particle, energy);
79
}
80
81
//histograms
82
//
83
G4AnalysisManager
* analysisManager = G4AnalysisManager::Instance();
84
if
( analysisManager->IsActive() ) {
85
analysisManager->OpenFile();
86
}
87
88
//inform the runManager to save random number seed
89
//
90
G4RunManager::GetRunManager
()->
SetRandomNumberStore
(
false
);
91
}
92
93
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94
95
void
RunAction::EndOfRunAction
(
const
G4Run
*)
96
{
97
if
(
isMaster
)
fRun
->
EndOfRun
();
98
99
//save histograms
100
//
101
G4AnalysisManager
* analysisManager = G4AnalysisManager::Instance();
102
if
( analysisManager->IsActive() ) {
103
analysisManager->Write();
104
analysisManager->CloseFile();
105
}
106
}
107
108
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction
RunAction()
Definition:
examples/advanced/microelectronics/src/RunAction.cc:42
PrimaryGeneratorAction
PrimaryGeneratorAction class.
Definition:
environments/g4py/examples/demos/TestEm0/module/PrimaryGeneratorAction.hh:43
RunAction::BeginOfRunAction
void BeginOfRunAction(const G4Run *)
Definition:
environments/g4py/examples/demos/TestEm0/module/RunAction.cc:57
G4RunManager.hh
G4UnitsTable.hh
HistoManager
Definition:
advanced/amsEcal/include/HistoManager.hh:44
G4RunManager::SetRandomNumberStore
void SetRandomNumberStore(G4bool flag)
Definition:
G4RunManager.hh:400
RunAction::GenerateRun
virtual G4Run * GenerateRun()
Definition:
examples/advanced/amsEcal/src/RunAction.cc:66
G4ParticleDefinition
Definition:
G4ParticleDefinition.hh:72
RunAction::fHistoManager
HistoManager * fHistoManager
Definition:
examples/advanced/amsEcal/include/RunAction.hh:66
energy
double energy
Definition:
plottest35.C:25
G4ParticleGun::GetParticleEnergy
G4double GetParticleEnergy() const
Definition:
G4ParticleGun.hh:110
RunAction::EndOfRunAction
void EndOfRunAction(const G4Run *)
Definition:
environments/g4py/examples/demos/TestEm0/module/RunAction.cc:260
G4Run
Definition:
G4Run.hh:46
G4Hbook::G4AnalysisManager
ExG4HbookAnalysisManager G4AnalysisManager
Definition:
g4hbook_defs.hh:66
RunAction::~RunAction
~RunAction()
Definition:
environments/g4py/examples/demos/TestEm0/module/RunAction.cc:52
G4PhysicalConstants.hh
G4RunManager::GetRunManager
static G4RunManager * GetRunManager()
Definition:
G4RunManager.cc:79
G4UserRunAction::isMaster
G4bool isMaster
Definition:
G4UserRunAction.hh:64
PrimaryGeneratorAction::GetParticleGun
G4ParticleGun * GetParticleGun()
Definition:
environments/g4py/examples/demos/TestEm0/module/PrimaryGeneratorAction.hh:53
G4Run.hh
G4UserRunAction
Definition:
G4UserRunAction.hh:52
Run::EndOfRun
void EndOfRun()
Definition:
advanced/amsEcal/src/Run.cc:147
Run::SetPrimary
void SetPrimary(G4ParticleDefinition *particle, G4double energy)
Definition:
advanced/amsEcal/src/Run.cc:77
G4double
double G4double
Definition:
G4Types.hh:76
Run
Definition:
advanced/amsEcal/include/Run.hh:46
G4SystemOfUnits.hh
G4ParticleGun::GetParticleDefinition
G4ParticleDefinition * GetParticleDefinition() const
Definition:
G4ParticleGun.hh:106
RunAction::fRun
Run * fRun
Definition:
examples/advanced/amsEcal/include/RunAction.hh:65
RunAction::fPrimary
PrimaryGeneratorAction * fPrimary
Definition:
examples/advanced/amsEcal/include/RunAction.hh:64
Geant4
Geant4.10.02.p03
examples
extended
radioactivedecay
rdecay01
src
RunAction.cc
Generated by
1.8.13