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
G4LossTableManager.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4LossTableManager.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
// GEANT4 Class header file
29
//
30
//
31
// File name: G4LossTableManager
32
//
33
// Author: Vladimir Ivanchenko on base of G4LossTables class
34
// and Maria Grazia Pia ideas
35
//
36
// Creation date: 03.01.2002
37
//
38
// Modifications by V.Ivanchenko
39
//
40
// Class Description:
41
//
42
// A utility static class, responsable for the energy loss tables
43
// for each particle
44
//
45
// Energy loss processes have to register their tables with this
46
// class. The responsibility of creating and deleting the tables
47
// remains with the energy loss classes.
48
49
// -------------------------------------------------------------------
50
//
51
52
#ifndef G4LossTableManager_h
53
#define G4LossTableManager_h 1
54
55
#include <map>
56
#include <vector>
57
#include "
globals.hh
"
58
#include "
G4ThreadLocalSingleton.hh
"
59
#include "
G4VEnergyLossProcess.hh
"
60
61
class
G4PhysicsTable
;
62
class
G4MaterialCutsCouple
;
63
class
G4ParticleDefinition
;
64
class
G4Region
;
65
class
G4EmSaturation
;
66
class
G4EmConfigurator
;
67
class
G4ElectronIonPair
;
68
class
G4NIELCalculator
;
69
class
G4VMultipleScattering
;
70
class
G4VEmProcess
;
71
class
G4EmCorrections
;
72
class
G4LossTableBuilder
;
73
class
G4VAtomDeexcitation
;
74
class
G4VSubCutProducer
;
75
76
class
G4LossTableManager
77
{
78
79
friend
class
G4ThreadLocalSingleton
<
G4LossTableManager
>;
80
81
public
:
82
83
static
G4LossTableManager
*
Instance
();
84
85
~G4LossTableManager
();
86
87
//-------------------------------------------------
88
// initialisation before a new run
89
//-------------------------------------------------
90
91
void
PreparePhysicsTable
(
const
G4ParticleDefinition
* aParticle,
92
G4VEnergyLossProcess
*
p
,
G4bool
theMaster);
93
94
void
PreparePhysicsTable
(
const
G4ParticleDefinition
* aParticle,
95
G4VEmProcess
*
p
,
G4bool
theMaster);
96
97
void
PreparePhysicsTable
(
const
G4ParticleDefinition
* aParticle,
98
G4VMultipleScattering
*
p
,
G4bool
theMaster);
99
100
void
BuildPhysicsTable
(
const
G4ParticleDefinition
* aParticle);
101
102
void
BuildPhysicsTable
(
const
G4ParticleDefinition
* aParticle,
103
G4VEnergyLossProcess
*
p
);
104
105
void
LocalPhysicsTables
(
const
G4ParticleDefinition
* aParticle,
106
G4VEnergyLossProcess
*
p
);
107
108
void
DumpHtml
();
109
110
//-------------------------------------------------
111
// Run time access to DEDX, range, energy for a given particle,
112
// energy, and G4MaterialCutsCouple
113
//-------------------------------------------------
114
115
inline
G4double
GetDEDX
(
116
const
G4ParticleDefinition
*aParticle,
117
G4double
kineticEnergy,
118
const
G4MaterialCutsCouple
*couple);
119
120
inline
G4double
GetSubDEDX
(
121
const
G4ParticleDefinition
*aParticle,
122
G4double
kineticEnergy,
123
const
G4MaterialCutsCouple
*couple);
124
125
inline
G4double
GetRange
(
126
const
G4ParticleDefinition
*aParticle,
127
G4double
kineticEnergy,
128
const
G4MaterialCutsCouple
*couple);
129
130
inline
G4double
GetCSDARange
(
131
const
G4ParticleDefinition
*aParticle,
132
G4double
kineticEnergy,
133
const
G4MaterialCutsCouple
*couple);
134
135
inline
G4double
GetRangeFromRestricteDEDX
(
136
const
G4ParticleDefinition
*aParticle,
137
G4double
kineticEnergy,
138
const
G4MaterialCutsCouple
*couple);
139
140
inline
G4double
GetEnergy
(
141
const
G4ParticleDefinition
*aParticle,
142
G4double
range,
143
const
G4MaterialCutsCouple
*couple);
144
145
inline
G4double
GetDEDXDispersion
(
146
const
G4MaterialCutsCouple
*couple,
147
const
G4DynamicParticle
* dp,
148
G4double
&
length
);
149
150
//-------------------------------------------------
151
// Methods to be called only at initialisation
152
// and at the end of the job
153
//-------------------------------------------------
154
155
void
Register
(
G4VEnergyLossProcess
*
p
);
156
157
void
DeRegister
(
G4VEnergyLossProcess
*
p
);
158
159
void
Register
(
G4VMultipleScattering
*
p
);
160
161
void
DeRegister
(
G4VMultipleScattering
*
p
);
162
163
void
Register
(
G4VEmProcess
*
p
);
164
165
void
DeRegister
(
G4VEmProcess
*
p
);
166
167
void
Register
(
G4VProcess
*
p
);
168
169
void
DeRegister
(
G4VProcess
*
p
);
170
171
void
Register
(
G4VEmModel
*
p
);
172
173
void
DeRegister
(
G4VEmModel
*
p
);
174
175
void
Register
(
G4VEmFluctuationModel
*
p
);
176
177
void
DeRegister
(
G4VEmFluctuationModel
*
p
);
178
179
void
RegisterExtraParticle
(
const
G4ParticleDefinition
* aParticle,
180
G4VEnergyLossProcess
*
p
);
181
182
void
SetVerbose
(
G4int
val);
183
184
void
SetAtomDeexcitation
(
G4VAtomDeexcitation
*);
185
186
void
SetSubCutProducer
(
G4VSubCutProducer
*);
187
188
void
SetNIELCalculator
(
G4NIELCalculator
*);
189
190
//-------------------------------------------------
191
// Access methods
192
//-------------------------------------------------
193
194
inline
G4bool
IsMaster
()
const
;
195
196
G4VEnergyLossProcess
*
GetEnergyLossProcess
(
const
G4ParticleDefinition
*);
197
198
const
std::vector<G4VEnergyLossProcess*>&
GetEnergyLossProcessVector
();
199
200
const
std::vector<G4VEmProcess*>&
GetEmProcessVector
();
201
202
const
std::vector<G4VMultipleScattering*>&
GetMultipleScatteringVector
();
203
204
G4EmSaturation
*
EmSaturation
();
205
206
G4EmConfigurator
*
EmConfigurator
();
207
208
G4ElectronIonPair
*
ElectronIonPair
();
209
210
G4NIELCalculator
*
NIELCalculator
();
211
212
inline
G4EmCorrections
*
EmCorrections
();
213
214
inline
G4VAtomDeexcitation
*
AtomDeexcitation
();
215
216
inline
G4VSubCutProducer
*
SubCutProducer
();
217
218
inline
G4LossTableBuilder
*
GetTableBuilder
();
219
220
inline
void
SetGammaGeneralProcess
(
G4VEmProcess
*);
221
222
inline
G4VEmProcess
*
GetGammaGeneralProcess
();
223
224
inline
void
SetElectronGeneralProcess
(
G4VEnergyLossProcess
*);
225
226
inline
G4VEnergyLossProcess
*
GetElectronGeneralProcess
();
227
228
private
:
229
230
//-------------------------------------------------
231
// Private methods and members
232
//-------------------------------------------------
233
234
G4LossTableManager
();
235
236
void
Clear
();
237
238
void
ResetParameters
();
239
240
G4VEnergyLossProcess
*
BuildTables
(
const
G4ParticleDefinition
* aParticle);
241
242
void
CopyTables
(
const
G4ParticleDefinition
* aParticle,
243
G4VEnergyLossProcess
*);
244
245
void
ParticleHaveNoLoss
(
const
G4ParticleDefinition
* aParticle);
246
247
void
CopyDEDXTables
();
248
249
void
PrintEWarning
(
G4String
,
G4double
);
250
251
G4LossTableManager
(
G4LossTableManager
&) =
delete
;
252
G4LossTableManager
&
operator=
(
const
G4LossTableManager
&
right
) =
delete
;
253
254
static
G4ThreadLocal
G4LossTableManager
*
instance
;
255
256
typedef
const
G4ParticleDefinition
*
PD
;
257
258
std::map<PD,G4VEnergyLossProcess*,std::less<PD> >
loss_map
;
259
260
std::vector<G4VEnergyLossProcess*>
loss_vector
;
261
std::vector<PD>
part_vector
;
262
std::vector<PD>
base_part_vector
;
263
std::vector<G4bool>
tables_are_built
;
264
std::vector<G4bool>
isActive
;
265
std::vector<G4PhysicsTable*>
dedx_vector
;
266
std::vector<G4PhysicsTable*>
range_vector
;
267
std::vector<G4PhysicsTable*>
inv_range_vector
;
268
std::vector<G4VMultipleScattering*>
msc_vector
;
269
std::vector<G4VEmProcess*>
emp_vector
;
270
std::vector<G4VEmModel*>
mod_vector
;
271
std::vector<G4VEmFluctuationModel*>
fmod_vector
;
272
std::vector<G4VProcess*>
p_vector
;
273
274
// cache
275
G4VEnergyLossProcess
*
currentLoss
;
276
PD
currentParticle
;
277
PD
theElectron
;
278
PD
theGenericIon
;
279
PD
firstParticle
;
280
281
G4int
n_loss
;
282
G4int
run
;
283
284
G4bool
all_tables_are_built
;
285
G4bool
startInitialisation
;
286
G4bool
isMaster
;
287
G4LossTableBuilder
*
tableBuilder
;
288
G4EmCorrections
*
emCorrections
;
289
G4EmConfigurator
*
emConfigurator
;
290
G4ElectronIonPair
*
emElectronIonPair
;
291
G4NIELCalculator
*
nielCalculator
;
292
G4VAtomDeexcitation
*
atomDeexcitation
;
293
G4VSubCutProducer
*
subcutProducer
;
294
295
G4EmParameters
*
theParameters
;
296
G4VEmProcess
*
gGeneral
;
297
G4VEnergyLossProcess
*
eGeneral
;
298
299
G4int
verbose
;
300
};
301
302
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
303
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
304
305
inline
306
G4double
G4LossTableManager::GetDEDX
(
const
G4ParticleDefinition
*aParticle,
307
G4double
kineticEnergy,
308
const
G4MaterialCutsCouple
*couple)
309
{
310
if
(aParticle !=
currentParticle
) {
GetEnergyLossProcess
(aParticle); }
311
return
currentLoss
?
currentLoss
->
GetDEDX
(kineticEnergy, couple) : 0.0;
312
}
313
314
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
315
316
inline
317
G4double
G4LossTableManager::GetSubDEDX
(
const
G4ParticleDefinition
*aParticle,
318
G4double
kineticEnergy,
319
const
G4MaterialCutsCouple
*couple)
320
{
321
if
(aParticle !=
currentParticle
) {
GetEnergyLossProcess
(aParticle); }
322
return
currentLoss
?
currentLoss
->
GetDEDXForSubsec
(kineticEnergy, couple) : 0.0;
323
}
324
325
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
326
327
inline
328
G4double
G4LossTableManager::GetCSDARange
(
const
G4ParticleDefinition
*aParticle,
329
G4double
kineticEnergy,
330
const
G4MaterialCutsCouple
*couple)
331
{
332
if
(aParticle !=
currentParticle
) {
GetEnergyLossProcess
(aParticle); }
333
return
currentLoss
?
currentLoss
->
GetCSDARange
(kineticEnergy, couple) :
DBL_MAX
;
334
}
335
336
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
337
338
inline
339
G4double
G4LossTableManager::GetRangeFromRestricteDEDX
(
340
const
G4ParticleDefinition
*aParticle,
341
G4double
kineticEnergy,
342
const
G4MaterialCutsCouple
*couple)
343
{
344
if
(aParticle !=
currentParticle
) {
GetEnergyLossProcess
(aParticle); }
345
return
currentLoss
?
currentLoss
->
GetRangeForLoss
(kineticEnergy, couple) :
DBL_MAX
;
346
}
347
348
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
349
350
inline
351
G4double
G4LossTableManager::GetRange
(
const
G4ParticleDefinition
*aParticle,
352
G4double
kineticEnergy,
353
const
G4MaterialCutsCouple
*couple)
354
{
355
if
(aParticle !=
currentParticle
) {
GetEnergyLossProcess
(aParticle); }
356
return
currentLoss
?
currentLoss
->
GetRange
(kineticEnergy, couple) :
DBL_MAX
;
357
}
358
359
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
360
361
inline
362
G4double
G4LossTableManager::GetEnergy
(
const
G4ParticleDefinition
*aParticle,
363
G4double
range,
364
const
G4MaterialCutsCouple
*couple)
365
{
366
if
(aParticle !=
currentParticle
) {
GetEnergyLossProcess
(aParticle); }
367
return
currentLoss
?
currentLoss
->
GetKineticEnergy
(range, couple) : 0.0;
368
}
369
370
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
371
372
inline
373
G4double
G4LossTableManager::GetDEDXDispersion
(
374
const
G4MaterialCutsCouple
*couple,
375
const
G4DynamicParticle
* dp,
376
G4double
&
length
)
377
{
378
const
G4ParticleDefinition
* aParticle = dp->
GetParticleDefinition
();
379
if
(aParticle !=
currentParticle
) {
GetEnergyLossProcess
(aParticle); }
380
return
currentLoss
?
currentLoss
->
GetDEDXDispersion
(couple, dp, length) : 0.0;
381
}
382
383
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
384
385
inline
G4bool
G4LossTableManager::IsMaster
()
const
386
{
387
return
isMaster
;
388
}
389
390
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
391
392
inline
G4EmCorrections
*
G4LossTableManager::EmCorrections
()
393
{
394
return
emCorrections
;
395
}
396
397
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
398
399
inline
G4VAtomDeexcitation
*
G4LossTableManager::AtomDeexcitation
()
400
{
401
return
atomDeexcitation
;
402
}
403
404
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
405
406
inline
G4VSubCutProducer
*
G4LossTableManager::SubCutProducer
()
407
{
408
return
subcutProducer
;
409
}
410
411
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
412
413
inline
G4LossTableBuilder
*
G4LossTableManager::GetTableBuilder
()
414
{
415
return
tableBuilder
;
416
}
417
418
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
419
420
inline
void
G4LossTableManager::SetGammaGeneralProcess
(
G4VEmProcess
* ptr)
421
{
422
gGeneral
= ptr;
423
}
424
425
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
426
427
inline
G4VEmProcess
*
G4LossTableManager::GetGammaGeneralProcess
()
428
{
429
return
gGeneral
;
430
}
431
432
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
433
434
inline
435
void
G4LossTableManager::SetElectronGeneralProcess
(
G4VEnergyLossProcess
* ptr)
436
{
437
eGeneral
= ptr;
438
}
439
440
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
441
442
inline
G4VEnergyLossProcess
*
G4LossTableManager::GetElectronGeneralProcess
()
443
{
444
return
eGeneral
;
445
}
446
447
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
448
449
#endif
450
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
utils
include
G4LossTableManager.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:35
using
1.8.2 with
ECCE GitHub integration