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
G4VMultipleScattering.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4VMultipleScattering.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
// GEANT4 Class header file
30
//
31
//
32
// File name: G4VMultipleScattering
33
//
34
// Author: Vladimir Ivanchenko on base of Laszlo Urban code
35
//
36
// Creation date: 12.03.2002
37
//
38
// Modifications:
39
//
40
// 16-07-03 Update GetRange interface (V.Ivanchenko)
41
//
42
//
43
// Class Description:
44
//
45
// It is the generic process of multiple scattering it includes common
46
// part of calculations for all charged particles
47
//
48
// 26-11-03 bugfix in AlongStepDoIt (L.Urban)
49
// 25-05-04 add protection against case when range is less than steplimit (VI)
50
// 30-06-04 make destructor virtual (V.Ivanchenko)
51
// 27-08-04 Add InitialiseForRun method (V.Ivanchneko)
52
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
53
// 15-04-05 optimize internal interfaces (V.Ivanchenko)
54
// 15-04-05 remove boundary flag (V.Ivanchenko)
55
// 07-10-05 error in a protection in GetContinuousStepLimit corrected (L.Urban)
56
// 27-10-05 introduce virtual function MscStepLimitation() (V.Ivanchenko)
57
// 26-01-06 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
58
// 17-02-06 Save table of transport cross sections not mfp (V.Ivanchenko)
59
// 07-03-06 Move step limit calculation to model (V.Ivanchenko)
60
// 13-05-06 Add method to access model by index (V.Ivanchenko)
61
// 12-02-07 Add get/set skin (V.Ivanchenko)
62
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
63
// 15-07-08 Reorder class members for further multi-thread development (VI)
64
// 07-04-09 Moved msc methods from G4VEmModel to G4VMscModel (VI)
65
//
66
67
// -------------------------------------------------------------------
68
//
69
70
#ifndef G4VMultipleScattering_h
71
#define G4VMultipleScattering_h 1
72
73
#include "
G4VContinuousDiscreteProcess.hh
"
74
#include "
globals.hh
"
75
#include "
G4Material.hh
"
76
#include "
G4ParticleChangeForMSC.hh
"
77
#include "
G4Track.hh
"
78
#include "
G4Step.hh
"
79
#include "
G4EmModelManager.hh
"
80
#include "
G4VMscModel.hh
"
81
#include "
G4EmParameters.hh
"
82
#include "
G4MscStepLimitType.hh
"
83
84
class
G4ParticleDefinition
;
85
class
G4VEnergyLossProcess
;
86
class
G4LossTableManager
;
87
class
G4SafetyHelper
;
88
89
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
90
91
class
G4VMultipleScattering
:
public
G4VContinuousDiscreteProcess
92
{
93
public
:
94
95
G4VMultipleScattering
(
const
G4String
&
name
=
"msc"
,
96
G4ProcessType
type =
fElectromagnetic
);
97
98
virtual
~G4VMultipleScattering
();
99
100
//------------------------------------------------------------------------
101
// Virtual methods to be implemented for the concrete model
102
//------------------------------------------------------------------------
103
104
virtual
G4bool
IsApplicable
(
const
G4ParticleDefinition
&
p
)
override
= 0;
105
106
// obsolete
107
virtual
void
PrintInfo
() {};
108
109
virtual
void
ProcessDescription
(std::ostream& outFile)
const override
;
110
111
protected
:
112
113
virtual
void
InitialiseProcess
(
const
G4ParticleDefinition
*) = 0;
114
115
virtual
void
StreamProcessInfo
(std::ostream&)
const
{};
116
117
public
:
118
119
//------------------------------------------------------------------------
120
// Generic methods common to all ContinuousDiscrete processes
121
//------------------------------------------------------------------------
122
123
// Initialise for build of tables
124
void
PreparePhysicsTable
(
const
G4ParticleDefinition
&)
override
;
125
126
// Build physics table during initialisation
127
void
BuildPhysicsTable
(
const
G4ParticleDefinition
&)
override
;
128
129
// Store PhysicsTable in a file.
130
// Return false in case of failure at I/O
131
G4bool
StorePhysicsTable
(
const
G4ParticleDefinition
*,
132
const
G4String
& directory,
133
G4bool
ascii =
false
)
override
;
134
135
// Retrieve Physics from a file.
136
// (return true if the Physics Table can be build by using file)
137
// (return false if the process has no functionality or in case of failure)
138
// File name should is constructed as processName+particleName and the
139
// should be placed under the directory specifed by the argument.
140
G4bool
RetrievePhysicsTable
(
const
G4ParticleDefinition
*,
141
const
G4String
& directory,
142
G4bool
ascii)
override
;
143
144
// This is called in the beginning of tracking for a new track
145
void
StartTracking
(
G4Track
*)
override
;
146
147
// The function overloads the corresponding function of the base
148
// class.It limits the step near to boundaries only
149
// and invokes the method GetMscContinuousStepLimit at every step.
150
G4double
AlongStepGetPhysicalInteractionLength
(
151
const
G4Track
&,
152
G4double
previousStepSize,
153
G4double
currentMinimalStep,
154
G4double
& currentSafety,
155
G4GPILSelection
* selection)
override
;
156
157
// The function overloads the corresponding function of the base
158
// class.
159
G4double
PostStepGetPhysicalInteractionLength
(
160
const
G4Track
&,
161
G4double
previousStepSize,
162
G4ForceCondition
*
condition
)
override
;
163
164
// Along step actions
165
G4VParticleChange
*
AlongStepDoIt
(
const
G4Track
&,
const
G4Step
&)
override
;
166
167
// Post step actions
168
G4VParticleChange
*
PostStepDoIt
(
const
G4Track
&,
const
G4Step
&)
override
;
169
170
// This method does not used for tracking, it is intended only for tests
171
G4double
ContinuousStepLimit
(
const
G4Track
&
track
,
172
G4double
previousStepSize,
173
G4double
currentMinimalStep,
174
G4double
& currentSafety);
175
176
//------------------------------------------------------------------------
177
// Specific methods to set, access, modify models
178
//------------------------------------------------------------------------
179
180
// Select model in run time
181
inline
G4VEmModel
*
SelectModel
(
G4double
kinEnergy,
size_t
idx
);
182
183
public
:
184
185
// Add model for region, smaller value of order defines which
186
// model will be selected for a given energy interval
187
void
AddEmModel
(
G4int
order,
G4VEmModel
*,
const
G4Region
* region =
nullptr
);
188
189
// Assign a model to a process local list, to enable the list in run time
190
// the derived process should execute AddEmModel(..) for all such models
191
void
SetEmModel
(
G4VMscModel
*,
size_t
index = 0);
192
193
// return a model from the local list
194
G4VMscModel
*
EmModel
(
size_t
index = 0)
const
;
195
196
// Access to run time models by index
197
inline
G4VEmModel
*
GetModelByIndex
(
G4int
idx
= 0,
G4bool
ver =
false
)
const
;
198
199
//------------------------------------------------------------------------
200
// Get/Set parameters for simulation of multiple scattering
201
//------------------------------------------------------------------------
202
203
void
SetIonisation
(
G4VEnergyLossProcess
*);
204
205
inline
G4bool
LateralDisplasmentFlag
()
const
;
206
inline
void
SetLateralDisplasmentFlag
(
G4bool
val);
207
208
inline
G4double
Skin
()
const
;
209
inline
void
SetSkin
(
G4double
val);
210
211
inline
G4double
RangeFactor
()
const
;
212
inline
void
SetRangeFactor
(
G4double
val);
213
214
inline
G4double
GeomFactor
()
const
;
215
216
inline
G4double
PolarAngleLimit
()
const
;
217
218
inline
G4MscStepLimitType
StepLimitType
()
const
;
219
inline
void
SetStepLimitType
(
G4MscStepLimitType
val);
220
221
inline
G4double
LowestKinEnergy
()
const
;
222
inline
void
SetLowestKinEnergy
(
G4double
val);
223
224
inline
const
G4ParticleDefinition
*
FirstParticle
()
const
;
225
226
//------------------------------------------------------------------------
227
// Run time methods
228
//------------------------------------------------------------------------
229
230
protected
:
231
232
// This method is not used for tracking, it returns mean free path value
233
G4double
GetMeanFreePath
(
const
G4Track
&
track
,
234
G4double
,
235
G4ForceCondition
*
condition
)
override
;
236
237
// This method is not used for tracking, it returns step limit
238
G4double
GetContinuousStepLimit
(
const
G4Track
&
track
,
239
G4double
previousStepSize,
240
G4double
currentMinimalStep,
241
G4double
& currentSafety)
override
;
242
243
// return number of already added models
244
inline
G4int
NumberOfModels
()
const
;
245
246
private
:
247
248
// hide assignment operator
249
G4VMultipleScattering
(
G4VMultipleScattering
&) =
delete
;
250
G4VMultipleScattering
&
251
operator=
(
const
G4VMultipleScattering
&
right
) =
delete
;
252
253
// Print out of generic class parameters
254
void
StreamInfo
(std::ostream& outFile,
const
G4ParticleDefinition
&,
255
G4bool
rst=
false
)
const
;
256
257
// ======== Parameters of the class fixed at construction =========
258
259
G4EmModelManager
*
modelManager
;
260
G4LossTableManager
*
emManager
;
261
G4EmParameters
*
theParameters
;
262
263
// ======== Parameters of the class fixed at initialisation =======
264
265
G4SafetyHelper
*
safetyHelper
;
266
267
std::vector<G4VMscModel*>
mscModels
;
268
G4int
numberOfModels
;
269
270
const
G4ParticleDefinition
*
firstParticle
;
271
const
G4ParticleDefinition
*
currParticle
;
272
273
G4MscStepLimitType
stepLimit
;
274
275
G4double
facrange
;
276
G4double
lowestKinEnergy
;
277
278
G4bool
latDisplacement
;
279
G4bool
isIon
;
280
G4bool
fDispBeyondSafety
;
281
282
// ======== Cached values - may be state dependent ================
283
284
protected
:
285
286
G4ParticleChangeForMSC
fParticleChange
;
287
288
private
:
289
290
// cache
291
G4VMscModel
*
currentModel
;
292
G4VEnergyLossProcess
*
fIonisation
;
293
294
G4double
geomMin
;
295
G4double
minDisplacement2
;
296
G4double
physStepLimit
;
297
G4double
tPathLength
;
298
G4double
gPathLength
;
299
300
G4ThreeVector
fNewPosition
;
301
G4ThreeVector
fNewDirection
;
302
G4bool
fPositionChanged
;
303
G4bool
isActive
;
304
};
305
306
// ======== Run time inline methods ================
307
308
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
309
310
inline
G4VEmModel
*
311
G4VMultipleScattering::SelectModel
(
G4double
kinEnergy,
size_t
coupleIndex)
312
{
313
return
modelManager
->
SelectModel
(kinEnergy, coupleIndex);
314
}
315
316
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
317
318
inline
G4bool
G4VMultipleScattering::LateralDisplasmentFlag
()
const
319
{
320
return
latDisplacement
;
321
}
322
323
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
324
325
inline
void
G4VMultipleScattering::SetLateralDisplasmentFlag
(
G4bool
val)
326
{
327
latDisplacement
= val;
328
}
329
330
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
331
332
inline
G4double
G4VMultipleScattering::Skin
()
const
333
{
334
return
theParameters
->
MscSkin
();
335
}
336
337
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
338
339
inline
void
G4VMultipleScattering::SetSkin
(
G4double
val)
340
{
341
theParameters
->
SetMscSkin
(val);
342
}
343
344
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
345
346
inline
G4double
G4VMultipleScattering::RangeFactor
()
const
347
{
348
return
facrange
;
349
}
350
351
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
352
353
inline
void
G4VMultipleScattering::SetRangeFactor
(
G4double
val)
354
{
355
if
(val > 0.0 && val < 1.0) {
356
facrange
= val;
357
theParameters
->
SetMscRangeFactor
(val);
358
}
359
}
360
361
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
362
363
inline
G4double
G4VMultipleScattering::GeomFactor
()
const
364
{
365
return
theParameters
->
MscGeomFactor
();
366
}
367
368
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
369
370
inline
G4double
G4VMultipleScattering::PolarAngleLimit
()
const
371
{
372
return
theParameters
->
MscThetaLimit
();
373
}
374
375
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
376
377
inline
G4MscStepLimitType
G4VMultipleScattering::StepLimitType
()
const
378
{
379
return
stepLimit
;
380
}
381
382
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
383
384
inline
void
G4VMultipleScattering::SetStepLimitType
(
G4MscStepLimitType
val)
385
{
386
stepLimit
= val;
387
if
(val ==
fMinimal
) {
SetRangeFactor
(0.2); }
388
theParameters
->
SetMscStepLimitType
(val);
389
}
390
391
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
392
393
inline
G4double
G4VMultipleScattering::LowestKinEnergy
()
const
394
{
395
return
lowestKinEnergy
;
396
}
397
398
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
399
400
inline
void
G4VMultipleScattering::SetLowestKinEnergy
(
G4double
val)
401
{
402
lowestKinEnergy
= val;
403
}
404
405
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
406
407
inline
const
G4ParticleDefinition
*
G4VMultipleScattering::FirstParticle
()
const
408
{
409
return
firstParticle
;
410
}
411
412
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
413
414
inline
G4int
G4VMultipleScattering::NumberOfModels
()
const
415
{
416
return
modelManager
->
NumberOfModels
();
417
}
418
419
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
420
421
inline
G4VEmModel
*
422
G4VMultipleScattering::GetModelByIndex
(
G4int
idx
,
G4bool
ver)
const
423
{
424
return
modelManager
->
GetModel
(idx, ver);
425
}
426
427
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
428
429
#endif
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
utils
include
G4VMultipleScattering.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:35
using
1.8.2 with
ECCE GitHub integration