ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
RunAction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RunAction.cc
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
//---------------------------------------------------------------------------
31
//
32
// ClassName: RunAction
33
//
34
// Author: V.Ivanchenko 01.09.2010
35
//
36
//----------------------------------------------------------------------------
37
//
38
39
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41
42
#include "RunAction.hh"
43
#include "Run.hh"
44
#include "TestParameters.hh"
45
#include "
G4Run.hh
"
46
#include "
G4RunManager.hh
"
47
#include "
G4SystemOfUnits.hh
"
48
49
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50
51
RunAction::RunAction
()
52
:
G4UserRunAction
(), fAnalysisManager(0), fRun(0)
53
{
54
TestParameters::GetPointer
();
55
fAnalysisManager
=
G4AnalysisManager::Instance
();
56
fAnalysisManager
->
SetFileName
(
"testem8"
);
57
fAnalysisManager
->
SetVerboseLevel
(1);
58
fAnalysisManager
->
SetActivation
(
true
);
59
}
60
61
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62
63
RunAction::~RunAction
()
64
{}
65
66
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67
68
void
RunAction::Book
()
69
{
70
// Always creating analysis manager
71
TestParameters
* param =
TestParameters::GetPointer
();
72
G4int
nBinsE = param->
GetNumberBins
();
73
G4int
nBinsCluster = param->
GetNumberBinsCluster
();
74
G4int
nMaxCluster = param->
GetMaxCluster
();
75
G4double
maxEnergy = param->
GetMaxEnergy
();
76
G4double
factorALICE = param->
GetFactorALICE
();
77
78
//G4cout << "### maxenergy(keV)= " << maxEnergy/keV
79
// << " factorALICE= " << factorALICE << G4endl;
80
81
// Creating an 1-dimensional histograms in the root directory of the tree
82
fAnalysisManager
->
SetFirstHistoId
(1);
83
fAnalysisManager
->
CreateH1
(
"h1"
,
"Energy deposition in detector (keV)"
,
84
nBinsE,0.0,maxEnergy/
keV
);
85
fAnalysisManager
->
CreateH1
(
"h2"
,
"Number of primary clusters"
,
86
nBinsCluster,0.0,
G4double
(nMaxCluster));
87
fAnalysisManager
->
CreateH1
(
"h3"
,
"Energy deposition in detector (ADC)"
,
88
nBinsE,0.0,maxEnergy*factorALICE);
89
fAnalysisManager
->
OpenFile
();
90
}
91
92
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93
94
G4Run
*
RunAction::GenerateRun
()
95
{
96
fRun
=
new
Run
();
97
return
fRun
;
98
}
99
100
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101
102
void
RunAction::BeginOfRunAction
(
const
G4Run
* aRun)
103
{
104
G4int
id
= aRun->
GetRunID
();
105
G4cout
<<
"### Run "
<<
id
<<
" start analysis activation: "
106
<<
G4endl
;
107
108
fRun
->
BeginOfRun
();
109
110
//histograms
111
Book
();
112
}
113
114
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115
116
void
RunAction::EndOfRunAction
(
const
G4Run
*)
117
{
118
// print Run summary
119
G4cout
<<
"RunAction: End of run actions are started "
<<
isMaster
120
<<
" Nevt= "
<<
fRun
->
GetNumberOfEvent
()
121
<<
" Edep= "
<<
fRun
->
GetStat
()->
mean
() <<
G4endl
;
122
if
(
isMaster
) {
123
fRun
->
EndOfRun
();
124
}
125
// save histos and close analysis
126
if
(
fAnalysisManager
->
IsActive
()) {
127
fAnalysisManager
->
Write
();
128
fAnalysisManager
->
CloseFile
();
129
}
130
//delete fAnalysisManager;
131
}
132
133
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
electromagnetic
TestEm8
src
RunAction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:52
using
1.8.2 with
ECCE GitHub integration