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
Run.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Run.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
//
26
// This example is provided by the Geant4-DNA collaboration
27
// Any report or published results obtained using the Geant4-DNA software
28
// shall cite the following Geant4-DNA collaboration publications:
29
// Phys. Med. 31 (2015) 861-874
30
// Med. Phys. 37 (2010) 4692-4708
31
// The Geant4-DNA web site is available at http://geant4-dna.org
32
//
33
//
36
37
#include "Run.hh"
38
#include "DetectorConstruction.hh"
39
#include "HistoManager.hh"
40
#include "PrimaryGeneratorAction.hh"
41
42
#include "
G4Material.hh
"
43
#include "
G4SystemOfUnits.hh
"
44
#include "
G4UnitsTable.hh
"
45
46
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47
48
Run::Run
(
const
DetectorConstruction
* detector)
49
:
G4Run
(),
50
fDetector(detector),
51
fParticle(0), fEkin(0.),
52
fEdeposit(0.), fEdeposit2(0.)
53
{}
54
55
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
57
Run::~Run
()
58
{}
59
60
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61
62
void
Run::SetPrimary
(
G4ParticleDefinition
*
particle
,
G4double
energy
)
63
{
64
fParticle
=
particle
;
65
fEkin
=
energy
;
66
}
67
68
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
70
void
Run::AddEdep
(
G4double
e
)
71
{
72
fEdeposit
+=
e
;
73
fEdeposit2
+= e*
e
;
74
}
75
76
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
78
void
Run::Merge
(
const
G4Run
* run)
79
{
80
const
Run
* localRun =
static_cast<
const
Run
*
>
(run);
81
82
// pass information about primary particle
83
fParticle
= localRun->
fParticle
;
84
fEkin
= localRun->
fEkin
;
85
86
// accumulate sums
87
fEdeposit
+= localRun->
fEdeposit
;
88
fEdeposit2
+= localRun->
fEdeposit2
;
89
90
G4Run::Merge
(run);
91
}
92
93
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94
95
void
Run::EndOfRun
()
96
{
97
std::ios::fmtflags mode =
G4cout
.flags();
98
G4cout
.setf(std::ios::fixed,std::ios::floatfield);
99
G4int
prec
=
G4cout
.precision(2);
100
101
//run conditions
102
//
103
G4String
partName =
fParticle
->
GetParticleName
();
104
G4Material
*
material
=
fDetector
->
GetAbsorMaterial
();
105
G4double
density = material->
GetDensity
();
106
107
G4cout
<<
"\n ======================== run summary =====================\n"
;
108
G4cout
109
<<
"\n The run is "
<<
numberOfEvent
<<
" "
<< partName <<
" of "
110
<<
G4BestUnit
(
fEkin
,
"Energy"
) <<
" through a volume of "
111
<< material->
GetName
() <<
" (density: "
112
<<
G4BestUnit
(density,
"Volumic Mass"
) <<
") of mass "
113
<<
G4BestUnit
(
fDetector
->
GetAbsorMass
(),
"Mass"
)
114
<<
G4endl
;
115
116
if
(
numberOfEvent
== 0) {
117
G4cout
.setf(mode,std::ios::floatfield);
118
G4cout
.precision(prec);
119
return
;
120
}
121
122
G4cout
.precision(3);
123
G4cout
124
<<
"\n Total Energy deposited = "
<<
G4BestUnit
(
fEdeposit
,
"Energy"
)
125
<<
G4endl
;
126
127
/*
128
G4double dose=fEdeposit/fDetector->GetAbsorMass();
129
G4double rmsDose=rms/fDetector->GetAbsorMass();
130
131
G4cout.precision(3);
132
G4cout
133
<< "\n Dose = " << dose/gray << " Gy "
134
<< G4endl;
135
*/
136
137
G4cout
<<
G4endl
;
138
139
// normalize histograms
140
//
141
G4AnalysisManager
* analysisManager =
G4AnalysisManager::Instance
();
142
G4double
fac
= 1./(
numberOfEvent
*(
fEkin
/
eV
));
143
analysisManager->
ScaleH1
(1,fac);
144
analysisManager->
ScaleH1
(2,fac);
145
analysisManager->
ScaleH1
(3,fac);
146
147
}
148
149
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
medical
dna
slowing
src
Run.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:54
using
1.8.2 with
ECCE GitHub integration