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
G4ProcessPlacer.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4ProcessPlacer.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
// ----------------------------------------------------------------------
29
// GEANT 4 class source file
30
//
31
// G4ProcessPlacer.cc
32
//
33
// ----------------------------------------------------------------------
34
35
#include "
G4ProcessPlacer.hh
"
36
#include "
G4ProcessManager.hh
"
37
#include "
G4VProcess.hh
"
38
#include "
G4ParticleTable.hh
"
39
40
G4ProcessPlacer::G4ProcessPlacer
(
const
G4String
&particlename)
41
: fParticleName(particlename)
42
{
43
}
44
45
G4ProcessPlacer::~G4ProcessPlacer
()
46
{
47
}
48
49
void
G4ProcessPlacer::RemoveProcess
(
G4VProcess
*process)
50
{
51
G4cout
<<
"=== G4ProcessPlacer::RemoveProcess: for: "
<<
fParticleName
52
<<
G4endl
;
53
G4cout
<<
" ProcessName: "
<< process->
GetProcessName
()
54
<<
", will be removed!"
<<
G4endl
;
55
56
G4cout
<<
" The initial AlongStep Vectors: "
<<
G4endl
;
57
PrintAlongStepGPILVec
();
58
PrintAlongStepDoItVec
();
59
60
G4cout
<<
" The initial PostStep Vectors: "
<<
G4endl
;
61
PrintPostStepGPILVec
();
62
PrintPostStepDoItVec
();
63
64
GetProcessManager
()->
RemoveProcess
(process);
65
66
G4cout
<<
" The final AlongStep Vectors: "
<<
G4endl
;
67
PrintAlongStepGPILVec
();
68
PrintAlongStepDoItVec
();
69
70
G4cout
<<
" The final PostStep Vectors: "
<<
G4endl
;
71
PrintPostStepGPILVec
();
72
PrintPostStepDoItVec
();
73
74
G4cout
<<
"================================================"
<<
G4endl
;
75
76
}
77
78
void
G4ProcessPlacer::AddProcessAs
(
G4VProcess
*process,
SecondOrLast
sol)
79
{
80
G4cout
<<
" Modifying Process Order for ProcessName: "
<< process->
GetProcessName
() <<
G4endl
;
81
82
G4cout
<<
" The initial AlongStep Vectors: "
<<
G4endl
;
83
PrintAlongStepGPILVec
();
84
PrintAlongStepDoItVec
();
85
86
G4cout
<<
"The initial PostStep Vectors: "
<<
G4endl
;
87
PrintPostStepGPILVec
();
88
PrintPostStepDoItVec
();
89
90
if
(sol ==
eLast
)
91
{
92
GetProcessManager
()->
AddProcess
(process,
ordInActive
,
ordInActive
,
ordLast
);
93
}
94
else
if
(sol ==
eSecond
)
95
{
96
// get transportation process
97
G4VProcess
*transportation =
98
(* (
GetProcessManager
()->
GetProcessList
()))[0];
99
100
if
(!transportation)
101
{
102
G4Exception
(
"G4ProcessPlacer::AddProcessAs"
,
"Bias0001"
,
RunMustBeAborted
,
" could not get process id=0"
);
103
}
104
if
(transportation->
GetProcessName
() !=
"Transportation"
&& transportation->
GetProcessName
() !=
"Transportation8"
&& transportation->
GetProcessName
() !=
"CoupledTransportation"
)
105
{
106
// G4cout << " GOT HERE CoupledTransportation" << G4endl;
107
G4cout
<< transportation->
GetProcessName
() <<
G4endl
;
108
G4Exception
(
"G4ProcessPlacer::AddProcessAs"
,
"Bias0002"
,
RunMustBeAborted
,
" process id=0 is not Transportation"
);
109
}
110
111
// place the given proces as first for the moment
112
// 31/5/11 previously set to first, then transportation set ahead of it,
113
// which is more conveniently correctly set with placing it second!
114
GetProcessManager
()->
AddProcess
(process);
115
GetProcessManager
()->
SetProcessOrderingToSecond
(process,
116
idxAlongStep
);
117
GetProcessManager
()->
SetProcessOrderingToSecond
(process,
118
idxPostStep
);
119
// xx test
120
// if(process->GetProcessName() == "ImportanceProcess")
121
//bug31/10/07 GetProcessManager()->SetProcessOrdering(process,
122
//bug31/10/07 idxAlongStep, 1);
123
// place transportation first again
124
// GetProcessManager()->SetProcessOrderingToFirst(transportation,
125
// idxAlongStep);
126
// GetProcessManager()->SetProcessOrderingToFirst(transportation,
127
// idxPostStep);
128
}
129
130
// for verification inly
131
G4cout
<<
" The final AlongStep Vectors: "
<<
G4endl
;
132
PrintAlongStepGPILVec
();
133
PrintAlongStepDoItVec
();
134
135
G4cout
<<
"The final PostStep Vectors: "
<<
G4endl
;
136
PrintPostStepGPILVec
();
137
PrintPostStepDoItVec
();
138
139
G4cout
<<
"================================================"
<<
G4endl
;
140
}
141
142
void
G4ProcessPlacer::AddProcessAsSecondDoIt
(
G4VProcess
*process)
143
{
144
G4cout
<<
"=== G4ProcessPlacer::AddProcessAsSecondDoIt: for: "
145
<<
fParticleName
<<
G4endl
;
146
AddProcessAs
(process,
eSecond
);
147
}
148
149
void
G4ProcessPlacer::AddProcessAsLastDoIt
(
G4VProcess
*process)
150
{
151
G4cout
<<
"=== G4ProcessPlacer::AddProcessAsLastDoIt: for: "
152
<<
fParticleName
<<
G4endl
;
153
AddProcessAs
(process,
eLast
);
154
}
155
156
G4ProcessManager
*
G4ProcessPlacer::GetProcessManager
()
157
{
158
// get particle iterator to add processes ---------------------
159
G4ParticleTable
* theParticleTable = 0;
160
G4ParticleTable::G4PTblDicIterator
*
theParticleIterator
= 0;
161
theParticleTable =
G4ParticleTable::GetParticleTable
();
162
theParticleIterator = theParticleTable->
GetIterator
();
163
// -------------------------------------------------------
164
G4ProcessManager
*processmanager = 0;
165
// find process manager ---------------------------
166
theParticleIterator->
reset
();
167
while
( (*theParticleIterator)() )
/* while checked for unending loop, 30.05.2016, Marc Verderi */
168
{
169
G4ParticleDefinition
*
particle
= theParticleIterator->
value
();
170
if
(particle->
GetParticleName
() ==
fParticleName
)
171
{
172
processmanager = particle->
GetProcessManager
();
173
break
;
174
}
175
}
176
// ---------------------------------------------------------
177
if
(!processmanager)
178
{
179
G4Exception
(
"G4ProcessPlacer::GetProcessManager()"
,
"InvalidSetup"
,
180
FatalException
,
"NULL pointer to Process Manager ! Sampler.Configure() must be after PhysicsList instantiation"
);
181
}
182
return
processmanager;
183
}
184
185
void
G4ProcessPlacer::PrintAlongStepGPILVec
()
186
{
187
G4cout
<<
"GPIL Vector: "
<<
G4endl
;
188
G4ProcessVector
* processGPILVec =
189
GetProcessManager
()->
GetAlongStepProcessVector
(
typeGPIL
);
190
PrintProcVec
(processGPILVec);
191
}
192
193
void
G4ProcessPlacer::PrintAlongStepDoItVec
()
194
{
195
G4cout
<<
"DoIt Vector: "
<<
G4endl
;
196
G4ProcessVector
* processDoItVec =
197
GetProcessManager
()->
GetAlongStepProcessVector
(
typeDoIt
);
198
PrintProcVec
(processDoItVec);
199
}
200
201
202
void
G4ProcessPlacer::PrintPostStepGPILVec
()
203
{
204
G4cout
<<
"GPIL Vector: "
<<
G4endl
;
205
G4ProcessVector
* processGPILVec =
206
GetProcessManager
()->
GetPostStepProcessVector
(
typeGPIL
);
207
PrintProcVec
(processGPILVec);
208
}
209
210
void
G4ProcessPlacer::PrintPostStepDoItVec
()
211
{
212
G4cout
<<
"DoIt Vector: "
<<
G4endl
;
213
G4ProcessVector
* processDoItVec =
214
GetProcessManager
()->
GetPostStepProcessVector
(
typeDoIt
);
215
PrintProcVec
(processDoItVec);
216
}
217
218
219
void
G4ProcessPlacer::PrintProcVec
(
G4ProcessVector
* processVec)
220
{
221
if
(!processVec)
222
{
223
G4Exception
(
"G4ProcessPlacer::G4ProcessPlacer()"
,
"InvalidArgument"
,
224
FatalException
,
"NULL pointer to process-vector !"
);
225
}
226
size_t
len
= processVec->
length
();
227
if
(len==0)
228
{
229
G4Exception
(
"G4ProcessPlacer::G4ProcessPlacer()"
,
"InvalidSetup"
,
230
FatalException
,
"Length of process-vector is zero !"
);
231
}
232
for
(
size_t
i=0; i<
len
; i++)
233
{
234
G4VProcess
*
p
= (*processVec)[i];
235
if
(p)
236
{
237
G4cout
<<
" "
<< p->
GetProcessName
() <<
G4endl
;
238
}
239
else
240
{
241
G4cout
<<
" "
<<
"no process found for position: "
<< i
242
<<
", in vector of length: "
<< len <<
G4endl
;
243
}
244
}
245
}
geant4
tree
geant4-10.6-release
source
processes
biasing
management
src
G4ProcessPlacer.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:28
using
1.8.2 with
ECCE GitHub integration