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
G4VProcess.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4VProcess.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
// GEANT 4 class header file
31
//
32
// History: first implementation, based on object model of
33
// 2nd December 1995, G.Cosmo
34
//
35
// Class Description
36
// This class is the virtual class for physics process objects.
37
// It defines public methods which describe the behavior of
38
// a physics process.
39
//
40
// ------------------------------------------------------------
41
// New Physics scheme 18 Dec. 1996 H.Kurahige
42
// ------------------------------------------------------------
43
// change DoIt/GetPIL arguments type 20 Mar. 1997 H.Kurashige
44
// modified AlongStepGPIL 17 Dec. 1997 H.Kurashige
45
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
46
// Add process trype 27 Mar. 1998 H.Kurashige
47
// Remove thePhysicsTable 2 Aug. 1998 H.Kurashige
48
// Add PILfactor and GPIL 3 Nov. 2000 H.Kurashige
49
// Add Store/RetrievePhysicsTable 8 Nov. 2000 H.Kurashige
50
// Modify Store/RetrievePhysicsTable methods 9 Mar. 2001 H.Kurashige
51
// Added PreparePhysicsTable 20 Aug. 2004 H.Kurashige
52
// Added isXXXXDoItIsEnabled 2 Oct. 2007 H.Kurashige
53
// Added ProcessSubType 15 Nov. 2007 H.Kurashige
54
55
#ifndef G4VProcess_h
56
#define G4VProcess_h 1
57
58
#include "
globals.hh
"
59
#include <cmath>
60
#include "
G4ios.hh
"
61
62
class
G4ParticleDefinition
;
63
class
G4DynamicParticle
;
64
class
G4Track
;
65
class
G4Step
;
66
67
#include "
G4PhysicsTable.hh
"
68
#include "
G4VParticleChange.hh
"
69
#include "
G4ForceCondition.hh
"
70
#include "
G4GPILSelection.hh
"
71
#include "
G4ParticleChange.hh
"
72
#include "
G4ProcessType.hh
"
73
74
class
G4VProcess
75
{
76
// A virtual class for physics process objects. It defines
77
// public methods which describe the behavior of a
78
// physics process.
79
80
private
:
81
// hide default constructor and assignment operator as private
82
// do not hide default constructor for alpha version
83
// G4VProcess G4VProcess();
84
G4VProcess
&
operator=
(
const
G4VProcess
&
right
);
85
86
public
:
// with description
87
// constructor requires the process name and type
88
G4VProcess
(
const
G4String
& aName =
"NoName"
,
89
G4ProcessType
aType =
fNotDefined
);
90
91
// copy constructor copys the name but does not copy the
92
// physics table (0 pointer is assigned)
93
G4VProcess
(
const
G4VProcess
&right);
94
95
public
:
96
// destructor
97
virtual
~G4VProcess
();
98
99
// equal opperators
100
G4bool
operator==
(
const
G4VProcess
&right)
const
;
101
G4bool
operator!=
(
const
G4VProcess
&right)
const
;
102
103
public
:
// with description
105
// DoIt /////////////////
107
virtual
G4VParticleChange
*
PostStepDoIt
(
108
const
G4Track
&
track
,
109
const
G4Step
& stepData
110
) = 0;
111
112
virtual
G4VParticleChange
*
AlongStepDoIt
(
113
const
G4Track
& track,
114
const
G4Step
& stepData
115
) = 0;
116
virtual
G4VParticleChange
*
AtRestDoIt
(
117
const
G4Track
& track,
118
const
G4Step
& stepData
119
) = 0;
120
// A virtual base class function that has to be overridden
121
// by any subclass. The DoIt method actually performs the
122
// physics process and determines either momentum change
123
// of the production of secondaries etc.
124
// arguments
125
// const G4Track& track:
126
// reference to the current G4Track information
127
// const G4Step& stepData:
128
// reference to the current G4Step information
129
131
// GPIL //////////////
133
virtual
G4double
AlongStepGetPhysicalInteractionLength
(
134
const
G4Track
& track,
135
G4double
previousStepSize,
136
G4double
currentMinimumStep,
137
G4double
& proposedSafety,
138
G4GPILSelection
* selection) = 0;
139
140
virtual
G4double
AtRestGetPhysicalInteractionLength
(
141
const
G4Track
& track,
142
G4ForceCondition
*
condition
143
) = 0;
144
145
virtual
G4double
PostStepGetPhysicalInteractionLength
(
146
const
G4Track
& track,
147
G4double
previousStepSize,
148
G4ForceCondition
* condition
149
) = 0;
150
151
// Returns the Step-size (actual length) which is allowed
152
// by "this" process. (for AtRestGetPhysicalInteractionLength,
153
// return value is Step-time) The NumberOfInteractionLengthLeft is
154
// recalculated by using previousStepSize and the Step-size is
155
// calucalted accoding to the resultant NumberOfInteractionLengthLeft.
156
// using NumberOfInteractionLengthLeft, which is recalculated at
157
// arguments
158
// const G4Track& track:
159
// reference to the current G4Track information
160
// G4double* previousStepSize:
161
// the Step-size (actual length) of the previous Step
162
// of this track. Negative calue indicates that
163
// NumberOfInteractionLengthLeft must be reset.
164
// the current physical interaction legth of this process
165
// G4ForceCondition* condition:
166
// the flag indicates DoIt of this process is forced
167
// to be called
168
// Forced: Corresponding DoIt is forced
169
// NotForced: Corresponding DoIt is called
170
// if the Step size of this Step is determined
171
// by this process
172
// !! AlongStepDoIt is always called !!
173
// G4double& currentMinimumStep:
174
// this value is used for transformation of
175
// true path length to geometrical path length
176
177
G4double
GetCurrentInteractionLength
()
const
;
178
// Returns currentInteractionLength
179
181
void
SetPILfactor
(
G4double
value
);
182
G4double
GetPILfactor
()
const
;
183
// Set/Get factor for PhysicsInteractionLength
184
// which is passed to G4SteppingManager for both AtRest and PostStep
185
186
// These three GPIL methods are used by Stepping Manager.
187
// They invoke virtual GPIL methods listed above.
188
// As for AtRest and PostStep the returned value is multipled by thePILfactor
189
//
190
G4double
AlongStepGPIL
(
const
G4Track
& track,
191
G4double
previousStepSize,
192
G4double
currentMinimumStep,
193
G4double
& proposedSafety,
194
G4GPILSelection
* selection );
195
196
G4double
AtRestGPIL
(
const
G4Track
& track,
197
G4ForceCondition
* condition );
198
199
G4double
PostStepGPIL
(
const
G4Track
& track,
200
G4double
previousStepSize,
201
G4ForceCondition
* condition );
202
204
virtual
G4bool
IsApplicable
(
const
G4ParticleDefinition
&){
return
true
;}
205
// Returns true if this process object is applicable to
206
// the particle type
207
// Process will not be registered to a particle if IsApplicable is false
208
209
virtual
void
BuildPhysicsTable
(
const
G4ParticleDefinition
&){}
210
// Messaged by the Particle definition (via the Process manager)
211
// whenever cross section tables have to be rebuilt (i.e. if new
212
// materials have been defined).
213
// It is overloaded by individual processes when they need physics
214
// tables.
215
216
virtual
void
PreparePhysicsTable
(
const
G4ParticleDefinition
&){}
217
// Messaged by the Particle definition (via the Process manager)
218
// whenever cross section tables have to be prepare for rebuilt
219
// (i.e. if new materials have been defined).
220
// It is overloaded by individual processes when they need physics
221
// tables.
222
223
// Processes which Build physics tables independent of cuts
224
// (for example in their constructors)
225
// should preferably use private
226
// void BuildThePhysicsTable() and void PreparePhysicsTable().
227
// Not another BuildPhysicsTable, please.
228
229
230
virtual
G4bool
StorePhysicsTable
(
const
G4ParticleDefinition
* ,
231
const
G4String
&,
G4bool
){
return
true
;}
232
// Store PhysicsTable in a file.
233
// (return false in case of failure at I/O )
234
235
virtual
G4bool
RetrievePhysicsTable
(
const
G4ParticleDefinition
* ,
236
const
G4String
&,
G4bool
){
return
false
;}
237
// Retrieve Physics from a file.
238
// (return true if the Physics Table can be build by using file)
239
// (return false if the process has no functionality or in case of failure)
240
// File name should be defined by each process
241
// and the file should be placed under the directory specifed by the argument.
242
const
G4String
&
GetPhysicsTableFileName
(
const
G4ParticleDefinition
* ,
243
const
G4String
& directory,
244
const
G4String
& tableName,
245
G4bool
ascii =
false
);
246
// this method is utility for Store/RetreivePhysicsTable
247
249
const
G4String
&
GetProcessName
()
const
;
250
// Returns the name of the process.
251
252
G4ProcessType
GetProcessType
()
const
;
253
// Returns the process type.
254
255
void
SetProcessType
(
G4ProcessType
);
256
// Set the process type.
257
258
G4int
GetProcessSubType
()
const
;
259
// Returns the process sub type.
260
261
void
SetProcessSubType
(
G4int
);
262
// Set the process sub type.
263
264
static
const
G4String
&
GetProcessTypeName
(
G4ProcessType
);
265
// Returns the process type name
266
267
virtual
void
StartTracking
(
G4Track
*);
268
virtual
void
EndTracking
();
269
// inform Start/End of tracking for each track to the physics process
270
271
public
:
272
virtual
void
SetProcessManager
(
const
G4ProcessManager
*);
273
// A process manager set its own pointer when the process is registered
274
// the process Manager
275
virtual
const
G4ProcessManager
*
GetProcessManager
();
276
// Get the process manager which the process belongs to
277
278
protected
:
279
const
G4ProcessManager
*
aProcessManager
;
280
281
protected
:
282
G4VParticleChange
*
pParticleChange
;
283
// The pointer to G4VParticleChange object
284
// which is modified and returned by address by the DoIt() method.
285
// This pointer should be set in each physics process
286
// after construction of derived class object.
287
288
G4ParticleChange
aParticleChange
;
289
// This object is kept for compatibility with old scheme
290
// This will be removed in future
291
292
G4double
theNumberOfInteractionLengthLeft
;
293
// The flight length left for the current tracking particle
294
// in unit of "Interaction length".
295
296
G4double
currentInteractionLength
;
297
// The InteractionLength in the current material
298
299
G4double
theInitialNumberOfInteractionLength
;
300
// The initial value when ResetNumberOfInteractionLengthLeft is invoked
301
302
public
:
// with description
303
virtual
void
ResetNumberOfInteractionLengthLeft
();
304
// reset (determine the value of)NumberOfInteractionLengthLeft
305
306
G4double
GetNumberOfInteractionLengthLeft
()
const
;
307
// get NumberOfInteractionLengthLeft
308
309
G4double
GetTotalNumberOfInteractionLengthTraversed
()
const
;
310
// get NumberOfInteractionLength
311
// after ResetNumberOfInteractionLengthLeft is invoked
312
313
protected
:
// with description
314
void
SubtractNumberOfInteractionLengthLeft
(
315
G4double
previousStepSize
316
);
317
// subtract NumberOfInteractionLengthLeft by the value corresponding to
318
// previousStepSize
319
320
void
ClearNumberOfInteractionLengthLeft
();
321
// clear NumberOfInteractionLengthLeft
322
// !!! This method should be at the end of PostStepDoIt()
323
// !!! and AtRestDoIt
324
325
public
:
// with description
326
// These methods indicate which DoIt is enabled
327
// These methods are used by G4ProcessManager to check
328
// that ordering parameters are set properly
329
G4bool
isAtRestDoItIsEnabled
()
const
;
330
G4bool
isAlongStepDoItIsEnabled
()
const
;
331
G4bool
isPostStepDoItIsEnabled
()
const
;
332
333
protected
:
334
G4String
theProcessName
;
335
// The name of the process
336
337
G4String
thePhysicsTableFileName
;
338
339
G4ProcessType
theProcessType
;
340
// The type of the process
341
342
G4int
theProcessSubType
;
343
// The sub type of the process
344
345
G4double
thePILfactor
;
346
// factor for PhysicsInteractionLength
347
// which is passed to G4SteppingManager
348
349
G4bool
enableAtRestDoIt
;
350
G4bool
enableAlongStepDoIt
;
351
G4bool
enablePostStepDoIt
;
352
353
public
:
// with description
354
virtual
void
DumpInfo
()
const
;
355
// dump out process information
356
357
virtual
void
ProcessDescription
(std::ostream& outfile)
const
;
358
// write out to html file for automatic documentation
359
360
public
:
// with description
361
void
SetVerboseLevel
(
G4int
value);
362
G4int
GetVerboseLevel
()
const
;
363
// set/get controle flag for output message
364
// 0: Silent
365
// 1: Warning message
366
// 2: More
367
368
369
protected
:
370
G4int
verboseLevel
;
371
// controle flag for output message
372
373
private
:
374
G4VProcess
*
masterProcessShadow
;
375
//For multi-threaded: poitner to the instance of this process
376
// for the master thread
377
public
:
378
virtual
void
SetMasterProcess
(
G4VProcess
* masterP);
379
// Sets the master thread process instance
380
const
G4VProcess
*
GetMasterProcess
()
const
;
381
// Returns the master thread process instnace
382
// Can be used to initialize worker type processes
383
// instances from master one (e.g. to share a read-only table)
384
// if ( this != GetMasterProcess() ) { /*worker*/ }
385
// else { /* master or sequential */ }
386
387
virtual
void
BuildWorkerPhysicsTable
(
const
G4ParticleDefinition
&
part
);
388
// Messaged by the Particle definition (via the Process manager)
389
// in worker threads. See BuildWorkerBhyiscsTable method.
390
// Can be used to share among threads physics tables. Use GetMasterProcess
391
// to get pointer of master process from worker thread.
392
// By default this method makes a forward call to
393
// BuildPhysicsTable
394
395
virtual
void
PrepareWorkerPhysicsTable
(
const
G4ParticleDefinition
&);
396
// Messaged by the Particle definition (via the Process manager)
397
// in worker threads. See PreparephysicsTable
398
// Can be used to share among threads physics tables. Use GetMasterProcess
399
// to get pointer of master process from worker thread
400
// By default this method makes a forward call
401
// to PreparePhysicsTable
402
};
403
404
// -----------------------------------------
405
// inlined function members implementation
406
// -----------------------------------------
407
#include "
Randomize.hh
"
408
409
inline
410
const
G4String
&
G4VProcess::GetProcessName
()
const
411
{
412
return
theProcessName
;
413
}
414
415
inline
416
G4ProcessType
G4VProcess::GetProcessType
()
const
417
{
418
return
theProcessType
;
419
}
420
421
inline
422
void
G4VProcess::SetProcessType
(
G4ProcessType
aType)
423
{
424
theProcessType
= aType;
425
}
426
427
inline
428
G4int
G4VProcess::GetProcessSubType
()
const
429
{
430
return
theProcessSubType
;
431
}
432
433
inline
434
void
G4VProcess::SetProcessSubType
(
G4int
value
)
435
{
436
theProcessSubType
=
value
;
437
}
438
439
inline
void
G4VProcess::SetVerboseLevel
(
G4int
value
)
440
{
441
verboseLevel
=
value
;
442
}
443
444
inline
G4int
G4VProcess::GetVerboseLevel
()
const
445
{
446
return
verboseLevel
;
447
}
448
449
inline
void
G4VProcess::ClearNumberOfInteractionLengthLeft
()
450
{
451
theInitialNumberOfInteractionLength
= -1.0;
452
theNumberOfInteractionLengthLeft
= -1.0;
453
}
454
455
inline
G4double
G4VProcess::GetNumberOfInteractionLengthLeft
()
const
456
{
457
return
theNumberOfInteractionLengthLeft
;
458
}
459
460
inline
G4double
G4VProcess::GetTotalNumberOfInteractionLengthTraversed
()
const
461
{
462
return
theInitialNumberOfInteractionLength
-
theNumberOfInteractionLengthLeft
;}
463
464
inline
G4double
G4VProcess::GetCurrentInteractionLength
()
const
465
{
466
return
currentInteractionLength
;
467
}
468
469
inline
void
G4VProcess::SetPILfactor
(
G4double
value
)
470
{
471
if
(value>0.) {
472
thePILfactor
=
value
;
473
}
474
}
475
476
inline
G4double
G4VProcess::GetPILfactor
()
const
477
{
478
return
thePILfactor
;
479
}
480
481
inline
G4double
G4VProcess::AlongStepGPIL
(
const
G4Track
&
track
,
482
G4double
previousStepSize,
483
G4double
currentMinimumStep,
484
G4double
& proposedSafety,
485
G4GPILSelection
* selection )
486
{
487
G4double
value
488
=
AlongStepGetPhysicalInteractionLength
(track, previousStepSize, currentMinimumStep, proposedSafety, selection);
489
return
value
;
490
}
491
492
inline
G4double
G4VProcess::AtRestGPIL
(
const
G4Track
&
track
,
493
G4ForceCondition
*
condition
)
494
{
495
G4double
value
496
=
AtRestGetPhysicalInteractionLength
(track, condition);
497
return
thePILfactor
*
value
;
498
}
499
500
inline
G4double
G4VProcess::PostStepGPIL
(
const
G4Track
&
track
,
501
G4double
previousStepSize,
502
G4ForceCondition
*
condition
)
503
{
504
G4double
value
505
=
PostStepGetPhysicalInteractionLength
(track, previousStepSize, condition);
506
return
thePILfactor
*
value
;
507
}
508
509
inline
510
void
G4VProcess::SetProcessManager
(
const
G4ProcessManager
* procMan)
511
{
512
aProcessManager
= procMan;
513
}
514
515
inline
516
const
G4ProcessManager
*
G4VProcess::GetProcessManager
()
517
{
518
return
aProcessManager
;
519
}
520
521
inline
522
G4bool
G4VProcess::isAtRestDoItIsEnabled
()
const
523
{
524
return
enableAtRestDoIt
;
525
}
526
527
inline
528
G4bool
G4VProcess::isAlongStepDoItIsEnabled
()
const
529
{
530
return
enableAlongStepDoIt
;
531
}
532
533
inline
534
G4bool
G4VProcess::isPostStepDoItIsEnabled
()
const
535
{
536
return
enablePostStepDoIt
;
537
}
538
539
inline
540
const
G4VProcess
*
G4VProcess::GetMasterProcess
()
const
541
{
542
return
masterProcessShadow
;
543
}
544
545
inline
546
void
G4VProcess::SubtractNumberOfInteractionLengthLeft
(
547
G4double
previousStepSize )
548
{
549
if
(
currentInteractionLength
>0.0) {
550
theNumberOfInteractionLengthLeft
-= previousStepSize/
currentInteractionLength
;
551
if
(
theNumberOfInteractionLengthLeft
<0.) {
552
theNumberOfInteractionLengthLeft
=
CLHEP::perMillion
;
553
}
554
555
}
else
{
556
#ifdef G4VERBOSE
557
if
(
verboseLevel
>0) {
558
G4cerr
<<
"G4VProcess::SubtractNumberOfInteractionLengthLeft()"
;
559
G4cerr
<<
" ["
<<
theProcessName
<<
"]"
<<
G4endl
;
560
G4cerr
<<
" currentInteractionLength = "
<<
currentInteractionLength
<<
" [mm]"
;
561
G4cerr
<<
" previousStepSize = "
<< previousStepSize <<
" [mm]"
;
562
G4cerr
<<
G4endl
;
563
}
564
#endif
565
G4String
msg =
"Negative currentInteractionLength for "
;
566
msg +=
theProcessName
;
567
G4Exception
(
"G4VProcess::SubtractNumberOfInteractionLengthLeft()"
,
568
"ProcMan201"
,
EventMustBeAborted
,
569
msg);
570
}
571
}
572
573
#endif
geant4
tree
geant4-10.6-release
source
processes
management
include
G4VProcess.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:52
using
1.8.2 with
ECCE GitHub integration