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
G4BiasingProcessInterface.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4BiasingProcessInterface.hh
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
//
30
// G4BiasingProcessInterface
31
//
32
// Class Description:
33
// A wrapper process making the interface between the tracking
34
// and the G4VBiasingOperator objects attached to volumes.
35
// If this process holds a physics process, it forwards
36
// tracking calls to this process in volume where not biasing
37
// occurs. In volumes with biasing (with a G4VBiasingOperator
38
// attached) the process gets what to do messaging the biasing
39
// operator :
40
// - at the PostStepGPIL level, for getting an occurrence biasing
41
// operation. If such an operation is returned to the process
42
// this operation will be messaged at several places.
43
// - at the PostStepDoIt level, to get a possible final state
44
// biasing operation
45
// If the process does not hold a physics process, it is meant
46
// as handling "non physics" biasing operations: pure splitting
47
// or pure kiling for example (ie not brem splitting).
48
//
49
//--------------------------------------------------------------------
50
// Initial version Sep. 2013 M. Verderi
51
// Use of "shared data" class Sep. 2014 M. Verderi
52
53
54
#ifndef G4BiasingProcessInterface_h
55
#define G4BiasingProcessInterface_h
56
57
#include "
globals.hh
"
58
#include "
G4VProcess.hh
"
59
#include "
G4Cache.hh
"
60
#include "
G4BiasingProcessSharedData.hh
"
61
62
class
G4VBiasingInteractionLaw
;
63
class
G4InteractionLawPhysical
;
64
class
G4VBiasingOperator
;
65
class
G4VBiasingOperation
;
66
class
G4ParticleChangeForOccurenceBiasing
;
67
class
G4ParticleChangeForNothing
;
68
69
class
G4BiasingProcessInterface
:
public
G4VProcess
{
70
public
:
71
// --------------------------------------------------------------------------------
72
// -- constructor for dealing with biasing options not affecting physics processes:
73
// --------------------------------------------------------------------------------
74
G4BiasingProcessInterface
(
G4String
name
=
"biasWrapper(0)"
);
75
// ---------------------------------------------------------------
76
// -- constructor to transform the behaviour of a physics process:
77
// ---------------------------------------------------------------
78
// -- wrappedProcess pointer MUST NOT be null.
79
G4BiasingProcessInterface
(
G4VProcess
* wrappedProcess,
80
G4bool
wrappedIsAtRest,
G4bool
wrappedIsAlongStep,
G4bool
wrappedIsPostStep,
81
G4String
useThisName =
""
);
82
~G4BiasingProcessInterface
();
83
// -- pointer of wrapped physics process:
84
G4VProcess
*
GetWrappedProcess
()
const
{
return
fWrappedProcess
;}
85
86
// ---------------------
87
// -- Biasing interface:
88
// ---------------------
89
// -- Helper methods:
90
// ------------------
91
// -- Current step and previous step biasing operator, if any:
92
G4VBiasingOperator
*
GetCurrentBiasingOperator
()
const
{
return
fSharedData
-> fCurrentBiasingOperator; }
93
G4VBiasingOperator
*
GetPreviousBiasingOperator
()
const
{
return
fSharedData
->
fPreviousBiasingOperator
; }
94
// -- current and previous operation:
95
G4VBiasingOperation
*
GetCurrentNonPhysicsBiasingOperation
()
const
{
return
fNonPhysicsBiasingOperation
; }
96
G4VBiasingOperation
*
GetPreviousNonPhysicsBiasingOperation
()
const
{
return
fPreviousNonPhysicsBiasingOperation
; }
97
G4VBiasingOperation
*
GetCurrentOccurenceBiasingOperation
()
const
{
return
fOccurenceBiasingOperation
; }
98
G4VBiasingOperation
*
GetPreviousOccurenceBiasingOperation
()
const
{
return
fPreviousOccurenceBiasingOperation
; }
99
G4VBiasingOperation
*
GetCurrentFinalStateBiasingOperation
()
const
{
return
fFinalStateBiasingOperation
; }
100
G4VBiasingOperation
*
GetPreviousFinalStateBiasingOperation
()
const
{
return
fPreviousFinalStateBiasingOperation
; }
101
102
// -- Lists of processes cooperating under a same particle type/G4ProcessManager.
103
// -- The vector ordering is:
104
// -- - random, before first "run/beamOn"
105
// -- - that of the PostStepGetPhysicalInteractionLength() once "/run/beamOn" has been issued
106
const
std::vector< const G4BiasingProcessInterface* >&
GetBiasingProcessInterfaces
()
const
107
{
return
fSharedData
-> fPublicBiasingProcessInterfaces;}
108
const
std::vector< const G4BiasingProcessInterface* >&
GetPhysicsBiasingProcessInterfaces
()
const
109
{
return
fSharedData
-> fPublicPhysicsBiasingProcessInterfaces;}
110
const
std::vector< const G4BiasingProcessInterface* >&
GetNonPhysicsBiasingProcessInterfaces
()
const
111
{
return
fSharedData
->
fPublicNonPhysicsBiasingProcessInterfaces
;}
112
113
// -- Get shared data for this process:
114
const
G4BiasingProcessSharedData
*
GetSharedData
()
const
{
return
fSharedData
; }
115
// -- Get shared data associated to a G4ProcessManager:
116
static
const
G4BiasingProcessSharedData
*
GetSharedData
(
const
G4ProcessManager
* );
117
118
119
120
// ------------------
121
// -- Helper methods:
122
// ------------------
123
// ---- Tell is this process is first/last in the PostStep GPIL and DoIt lists.
124
// ---- If physOnly is true, only wrapper for physics processes are considered,
125
// ---- otherwise all G4BiasingProcessInterface processes of this particle are
126
// ---- considered.
127
// ---- These methods just return the corresponding flag values setup at
128
// ---- initialization phase by the next four ones.
129
// ---- Will not be updated if processes are activate/unactivated on the fly.
130
// ---- Use next methods (less fast) instead in this case.
131
G4bool
GetIsFirstPostStepGPILInterface
(
G4bool
physOnly =
true
)
const
;
132
G4bool
GetIsLastPostStepGPILInterface
(
G4bool
physOnly =
true
)
const
;
133
G4bool
GetIsFirstPostStepDoItInterface
(
G4bool
physOnly =
true
)
const
;
134
G4bool
GetIsLastPostStepDoItInterface
(
G4bool
physOnly =
true
)
const
;
135
// ---- Determine if the process is first/last in the PostStep GPIL and DoIt lists.
136
G4bool
IsFirstPostStepGPILInterface
(
G4bool
physOnly =
true
)
const
;
137
G4bool
IsLastPostStepGPILInterface
(
G4bool
physOnly =
true
)
const
;
138
G4bool
IsFirstPostStepDoItInterface
(
G4bool
physOnly =
true
)
const
;
139
G4bool
IsLastPostStepDoItInterface
(
G4bool
physOnly =
true
)
const
;
140
// -- Information about wrapped process:
141
G4bool
GetWrappedProcessIsAtRest
()
const
{
return
fWrappedProcessIsAtRest
; }
142
G4bool
GetWrappedProcessIsAlong
()
const
{
return
fWrappedProcessIsAlong
; }
143
G4bool
GetWrappedProcessIsPost
()
const
{
return
fWrappedProcessIsPost
; }
144
145
146
// -- Information methods:
147
G4double
GetPreviousStepSize
()
const
{
return
fPreviousStepSize
;}
148
G4double
GetCurrentMinimumStep
()
const
{
return
fCurrentMinimumStep
;}
149
G4double
GetProposedSafety
()
const
{
return
fProposedSafety
;}
150
void
SetProposedSafety
(
G4double
sft) {
fProposedSafety
= sft;}
151
// -- return the actual PostStep and AlongStep limits returned by the process to the tracking :
152
G4double
GetPostStepGPIL
()
const
{
return
fBiasingPostStepGPIL
; }
153
G4double
GetAlongStepGPIL
()
const
{
return
fWrappedProcessAlongStepGPIL
; }
154
155
156
// --------------------------------------------------------------
157
// -- G4VProcess interface --
158
// --------------------------------------------------------------
159
public
:
160
// -- Start/End tracking:
161
void
StartTracking
(
G4Track
*
track
);
162
void
EndTracking
();
163
164
// -- PostStep methods:
165
virtual
G4double
PostStepGetPhysicalInteractionLength
(
const
G4Track
&
track
,
166
G4double
previousStepSize,
167
G4ForceCondition
*
condition
);
168
virtual
G4VParticleChange
*
PostStepDoIt
(
const
G4Track
&
track
,
169
const
G4Step
&
step
);
170
// -- AlongStep methods:
171
virtual
G4double
AlongStepGetPhysicalInteractionLength
(
const
G4Track
&
track
,
172
G4double
previousStepSize,
173
G4double
currentMinimumStep,
174
G4double
& proposedSafety,
175
G4GPILSelection
* selection);
176
virtual
G4VParticleChange
*
AlongStepDoIt
(
const
G4Track
&
track
,
177
const
G4Step
&
step
);
178
// -- AtRest methods
179
virtual
G4double
AtRestGetPhysicalInteractionLength
(
const
G4Track
&,
180
G4ForceCondition
*);
181
virtual
G4VParticleChange
*
AtRestDoIt
(
const
G4Track
&,
182
const
G4Step
&);
183
184
virtual
G4bool
IsApplicable
(
const
G4ParticleDefinition
& pd);
185
virtual
void
BuildPhysicsTable
(
const
G4ParticleDefinition
& pd);
186
virtual
void
PreparePhysicsTable
(
const
G4ParticleDefinition
& pd);
187
virtual
G4bool
StorePhysicsTable
(
const
G4ParticleDefinition
* pd,
188
const
G4String
&
s
,
G4bool
f
);
189
virtual
G4bool
RetrievePhysicsTable
(
const
G4ParticleDefinition
* pd,
190
const
G4String
&
s
,
G4bool
f
);
191
// --
192
virtual
void
SetProcessManager
(
const
G4ProcessManager
*);
193
virtual
const
G4ProcessManager
*
GetProcessManager
();
194
// --
195
virtual
void
ResetNumberOfInteractionLengthLeft
();
196
// virtual void ClearNumberOfInteractionLengthLeft();
197
// --
198
// virtual void DumpInfo() const;
199
200
virtual
void
SetMasterProcess
(
G4VProcess
* masterP);
201
virtual
void
BuildWorkerPhysicsTable
(
const
G4ParticleDefinition
& pd);
202
virtual
void
PrepareWorkerPhysicsTable
(
const
G4ParticleDefinition
& pd);
203
204
205
private
:
206
// ---- Internal utility methods:
207
void
SetUpFirstLastFlags
();
208
void
ResetForUnbiasedTracking
();
209
void
ReorderBiasingVectorAsGPIL
();
210
211
G4Track
*
fCurrentTrack
;
212
G4double
fPreviousStepSize
;
213
G4double
fCurrentMinimumStep
;
214
G4double
fProposedSafety
;
215
216
G4VBiasingOperation
*
fOccurenceBiasingOperation
;
217
G4VBiasingOperation
*
fFinalStateBiasingOperation
;
218
G4VBiasingOperation
*
fNonPhysicsBiasingOperation
;
219
G4VBiasingOperation
*
fPreviousOccurenceBiasingOperation
;
220
G4VBiasingOperation
*
fPreviousFinalStateBiasingOperation
;
221
G4VBiasingOperation
*
fPreviousNonPhysicsBiasingOperation
;
222
223
G4bool
fResetWrappedProcessInteractionLength
;
224
225
G4VProcess
*
fWrappedProcess
;
226
const
G4bool
fIsPhysicsBasedBiasing
;
227
const
G4bool
fWrappedProcessIsAtRest
;
228
const
G4bool
fWrappedProcessIsAlong
;
229
const
G4bool
fWrappedProcessIsPost
;
230
231
232
G4double
fWrappedProcessPostStepGPIL
;
233
G4double
fBiasingPostStepGPIL
;
234
G4double
fWrappedProcessInteractionLength
;
// -- inverse of analog cross-section
235
G4ForceCondition
fWrappedProcessForceCondition
;
236
G4ForceCondition
fBiasingForceCondition
;
237
G4double
fWrappedProcessAlongStepGPIL
;
238
G4double
fBiasingAlongStepGPIL
;
239
G4GPILSelection
fWrappedProcessGPILSelection
;
240
G4GPILSelection
fBiasingGPILSelection
;
241
242
const
G4VBiasingInteractionLaw
*
fBiasingInteractionLaw
;
243
const
G4VBiasingInteractionLaw
*
fPreviousBiasingInteractionLaw
;
244
G4InteractionLawPhysical
*
fPhysicalInteractionLaw
;
245
G4ParticleChangeForOccurenceBiasing
*
fOccurenceBiasingParticleChange
;
246
G4ParticleChangeForNothing
*
fDummyParticleChange
;
247
G4bool
fFirstLastFlags
[8];
248
G4int
IdxFirstLast
(
G4int
firstLast,
G4int
GPILDoIt,
G4int
physAll)
const
249
{
250
// -- be careful : all arguments are *assumed* to be 0 or 1. No check
251
// -- for that is provided. Should be of pure internal usage.
252
return
4*firstLast + 2*GPILDoIt + physAll;
253
}
254
// -- method used to anticipate stepping manager calls to PostStepGPIL
255
// -- of wrapped processes : this method calls wrapped process PostStepGPIL
256
// -- and caches results for PostStepGPIL and condition.
257
void
InvokeWrappedProcessPostStepGPIL
(
const
G4Track
&
track
,
258
G4double
previousStepSize,
259
G4ForceCondition
*
condition
);
260
// -- the instance being "firstGPIL" does work shared by other instances:
261
G4bool
fIamFirstGPIL
;
262
263
264
// -- MUST be **thread local**:
265
static
G4Cache<G4bool>
fResetInteractionLaws
;
266
static
G4Cache<G4bool>
fCommonStart
;
267
static
G4Cache<G4bool>
fCommonEnd
;
268
static
G4Cache<G4bool>
fDoCommonConfigure
;
269
270
const
G4ProcessManager
*
fProcessManager
;
271
272
273
// -- the data shared among processes attached to a same process manager:
274
G4BiasingProcessSharedData
*
fSharedData
;
275
276
};
277
278
#endif
geant4
tree
geant4-10.6-release
source
processes
biasing
generic
include
G4BiasingProcessInterface.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:27
using
1.8.2 with
ECCE GitHub integration