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
G4ErrorRunManagerHelper.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4ErrorRunManagerHelper.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
//
27
// ------------------------------------------------------------
28
// GEANT 4 class implementation file
29
// ------------------------------------------------------------
30
//
31
32
#include "
G4Navigator.hh
"
33
34
#include "
G4Timer.hh
"
35
36
#include "
G4ErrorRunManagerHelper.hh
"
37
38
#include "
G4RunManagerKernel.hh
"
39
#include "
G4VUserDetectorConstruction.hh
"
40
#include "
G4ErrorPhysicsList.hh
"
41
#include "
G4TransportationManager.hh
"
42
#include "
G4RunManager.hh
"
43
44
//-----------------------------------------------------------------------
45
46
G4ThreadLocal
G4ErrorRunManagerHelper
*
47
G4ErrorRunManagerHelper::fRunManagerKernel
= 0;
48
49
//-----------------------------------------------------------------------
50
G4ErrorRunManagerHelper
*
G4ErrorRunManagerHelper::GetRunManagerKernel
()
51
{
return
fRunManagerKernel
; }
52
53
54
//-----------------------------------------------------------------------
55
G4ErrorRunManagerHelper::G4ErrorRunManagerHelper
()
56
{
57
if
(
fRunManagerKernel
) {
58
G4Exception
(
"G4ErrorRunManagerHelper::G4ErrorRunManagerHelper()"
,
59
"InvalidSetup"
,
FatalException
,
60
"G4eRunManageKernel constructed twice."
);
61
}
62
fRunManagerKernel
=
this
;
63
64
//----- Look if somebody has created a G4RunManagerKernel
65
theG4RunManagerKernel
=
G4RunManagerKernel::GetRunManagerKernel
();
66
if
(
theG4RunManagerKernel
== 0 ) {
67
//--- if not create it
68
theG4RunManagerKernel
=
new
G4RunManagerKernel
();
69
G4cout
<<
" creating G4RunManagerKernel "
<<
theG4RunManagerKernel
<<
G4endl
;
70
}
71
72
theG4RunManagerKernel
->
SetVerboseLevel
(2);
73
theUserPhysicsList
= 0;
74
theUserWorld
= 0;
75
76
}
77
78
79
//-----------------------------------------------------------------------
80
G4ErrorRunManagerHelper::~G4ErrorRunManagerHelper
()
81
{
82
}
83
84
85
//-----------------------------------------------------------------------
86
void
G4ErrorRunManagerHelper::SetUserInitialization
(
G4VUserDetectorConstruction
* userInit)
87
{
88
theUserWorld
= userInit->
Construct
();
89
}
90
91
92
//-----------------------------------------------------------------------
93
void
G4ErrorRunManagerHelper::SetUserInitialization
(
G4VPhysicalVolume
* userInit)
94
{
95
theUserWorld
= userInit;
96
}
97
98
99
//-----------------------------------------------------------------------
100
void
G4ErrorRunManagerHelper::SetUserInitialization
(
G4VUserPhysicsList
* userInit)
101
{
102
theUserPhysicsList
= userInit;
103
}
104
105
106
//-----------------------------------------------------------------------
107
void
G4ErrorRunManagerHelper::InitializeGeometry
()
108
{
109
//check if user world has been directly called or someone initialized the world volume already
110
//----- First option: geometry has been defined to GEANT4e
111
if
(
theUserWorld
!= 0 ) {
112
theG4RunManagerKernel
->
DefineWorldVolume
(
theUserWorld
);
113
114
//----- Second option: geometry has been defined to GEANT4, do nothing GEANT4 should take care
115
}
else
{
116
//--- Check that indeed geometry has been defined to GEANT4
117
if
(
G4TransportationManager::GetTransportationManager
()
118
->GetNavigatorForTracking()->GetWorldVolume() == 0 ) {
119
G4Exception
(
"G4ErrorRunManagerHelper::InitializeGeometry()"
,
120
"InvalisSetup"
,
FatalException
,
121
"No world defined in your geometry!"
);
122
}
123
124
}
125
}
126
127
128
//-----------------------------------------------------------------------
129
void
G4ErrorRunManagerHelper::InitializePhysics
()
130
{
131
132
G4cout
<<
" G4ErrorRunManagerHelper::InitializePhysics "
<<
G4endl
;
133
134
//----- First option: physics list has been defined to GEANT4e
135
if
(
theUserPhysicsList
!= 0 ) {
136
theG4RunManagerKernel
->
SetPhysics
(
theUserPhysicsList
);
137
theG4RunManagerKernel
->
InitializePhysics
();
138
}
else
{
139
//----- Second option: physics list has been defined to GEANT4, do nothing GEANT4 should take care
140
if
(
G4RunManager::GetRunManager
() != 0 &&
G4RunManager::GetRunManager
()->
GetUserPhysicsList
() != 0 ){
141
//--- Physics should be G4ErrorPhysicsList, else send a warning
142
if
( static_cast<const G4ErrorPhysicsList*>(
G4RunManager::GetRunManager
()->
GetUserPhysicsList
()) == 0 ) {
143
std::ostringstream
message
;
144
message <<
"Physics list is not G4ErrorPhysicsList. Are you sure?"
;
145
G4Exception
(
"G4ErrorRunManagerHelper::InitializePhysics()"
,
146
"GEANT4e-Notification"
,
JustWarning
, message);
147
}
148
}
else
{
149
//----- Third option: no physics list has been defined, define a G4ErrorPhysicsList
150
theG4RunManagerKernel
->
SetPhysics
(
new
G4ErrorPhysicsList
);
151
// theG4RunManagerKernel->SetPhysics(new ExN02PhysicsList);
152
theG4RunManagerKernel
->
InitializePhysics
();
153
}
154
}
155
156
}
157
158
159
//-----------------------------------------------------------------------
160
void
G4ErrorRunManagerHelper::RunInitialization
()
161
{
162
theG4RunManagerKernel
->
RunInitialization
();
163
}
164
165
166
//-----------------------------------------------------------------------
167
void
G4ErrorRunManagerHelper::SetUserAction
(
G4UserTrackingAction
* userAction)
168
{
169
170
G4EventManager::GetEventManager
()->
SetUserAction
( userAction );
171
}
172
173
174
//-----------------------------------------------------------------------
175
void
G4ErrorRunManagerHelper::SetUserAction
(
G4UserSteppingAction
* userAction)
176
{
177
G4EventManager::GetEventManager
()->
SetUserAction
( userAction );
178
}
179
180
181
//-----------------------------------------------------------------------
182
void
G4ErrorRunManagerHelper::RunTermination
()
183
{
184
theG4RunManagerKernel
->
RunTermination
();
185
}
186
geant4
tree
geant4-10.6-release
source
error_propagation
src
G4ErrorRunManagerHelper.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:13
using
1.8.2 with
ECCE GitHub integration