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
G4EmExtraParameters.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4EmExtraParameters.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
// GEANT4 Class file
29
//
30
//
31
// File name: G4EmExtraParameters
32
//
33
// Author: Vladimir Ivanchenko
34
//
35
// Creation date: 07.05.2019
36
//
37
// -------------------------------------------------------------------
38
//
39
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
40
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41
42
#include "
G4EmExtraParameters.hh
"
43
#include "
G4PhysicalConstants.hh
"
44
#include "
G4UnitsTable.hh
"
45
#include "
G4SystemOfUnits.hh
"
46
#include "
G4VEmProcess.hh
"
47
#include "
G4VEnergyLossProcess.hh
"
48
#include "
G4EmExtraParametersMessenger.hh
"
49
#include "
G4RegionStore.hh
"
50
#include "
G4Region.hh
"
51
52
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
53
54
G4EmExtraParameters::G4EmExtraParameters
()
55
{
56
theMessenger
=
new
G4EmExtraParametersMessenger
(
this
);
57
Initialise
();
58
}
59
60
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
61
62
G4EmExtraParameters::~G4EmExtraParameters
()
63
{
64
delete
theMessenger
;
65
}
66
67
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
68
69
void
G4EmExtraParameters::Initialise
()
70
{
71
quantumEntanglement
=
false
;
72
directionalSplitting
=
false
;
73
directionalSplittingTarget
.
set
(0.,0.,0.);
74
directionalSplittingRadius
= 0.;
75
76
dRoverRange
= 0.2;
77
finalRange
=
CLHEP::mm
;
78
dRoverRangeMuHad
= 0.2;
79
finalRangeMuHad
= 0.1*
CLHEP::mm
;
80
81
m_regnamesForced
.clear();
82
m_procForced
.clear();
83
m_lengthForced
.clear();
84
m_weightForced
.clear();
85
m_regnamesSubCut
.clear();
86
m_subCuts
.clear();
87
}
88
89
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
90
91
92
void
G4EmExtraParameters::PrintWarning
(
G4ExceptionDescription
& ed)
const
93
{
94
G4Exception
(
"G4EmExtraParameters"
,
"em0044"
,
JustWarning
, ed);
95
}
96
97
G4String
G4EmExtraParameters::CheckRegion
(
const
G4String
&
reg
)
const
98
{
99
G4String
r
=
reg
;
100
if
(r ==
""
|| r ==
"world"
|| r ==
"World"
) {
101
r =
"DefaultRegionForTheWorld"
;
102
}
103
return
r
;
104
}
105
106
void
G4EmExtraParameters::SetStepFunction
(
G4double
v1
,
G4double
v2
)
107
{
108
if
(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
109
dRoverRange
=
v1
;
110
finalRange
=
v2
;
111
}
else
{
112
G4ExceptionDescription
ed;
113
ed <<
"Values of step function are out of range: "
114
<< v1 <<
", "
<< v2/
CLHEP::mm
<<
" mm - are ignored"
;
115
PrintWarning
(ed);
116
}
117
}
118
119
G4double
G4EmExtraParameters::GetStepFunctionP1
()
const
120
{
121
return
dRoverRange
;
122
}
123
124
G4double
G4EmExtraParameters::GetStepFunctionP2
()
const
125
{
126
return
finalRange
;
127
}
128
129
void
G4EmExtraParameters::SetStepFunctionMuHad
(
G4double
v1
,
G4double
v2
)
130
{
131
if
(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
132
dRoverRangeMuHad
=
v1
;
133
finalRangeMuHad
=
v2
;
134
}
else
{
135
G4ExceptionDescription
ed;
136
ed <<
"Values of step function are out of range: "
137
<< v1 <<
", "
<< v2/
CLHEP::mm
<<
" mm - are ignored"
;
138
PrintWarning
(ed);
139
}
140
}
141
142
G4double
G4EmExtraParameters::GetStepFunctionMuHadP1
()
const
143
{
144
return
dRoverRangeMuHad
;
145
}
146
147
G4double
G4EmExtraParameters::GetStepFunctionMuHadP2
()
const
148
{
149
return
finalRangeMuHad
;
150
}
151
152
void
G4EmExtraParameters::AddPAIModel
(
const
G4String
&
particle
,
153
const
G4String
& region,
154
const
G4String
& type)
155
{
156
G4String
r
=
CheckRegion
(region);
157
G4int
nreg =
m_regnamesPAI
.size();
158
for
(
G4int
i=0; i<nreg; ++i) {
159
if
((
m_particlesPAI
[i] == particle ||
160
m_particlesPAI
[i] ==
"all"
||
161
particle ==
"all"
) &&
162
(
m_regnamesPAI
[i] == r ||
163
m_regnamesPAI
[i] ==
"DefaultRegionForTheWorld"
||
164
r ==
"DefaultRegionForTheWorld"
) ) {
165
166
m_typesPAI
[i] = type;
167
if
(particle ==
"all"
) {
m_particlesPAI
[i] =
particle
; }
168
if
(r ==
"DefaultRegionForTheWorld"
) {
m_regnamesPAI
[i] =
r
; }
169
return
;
170
}
171
}
172
m_particlesPAI
.push_back(particle);
173
m_regnamesPAI
.push_back(r);
174
m_typesPAI
.push_back(type);
175
}
176
177
const
std::vector<G4String>&
G4EmExtraParameters::ParticlesPAI
()
const
178
{
179
return
m_particlesPAI
;
180
}
181
182
const
std::vector<G4String>&
G4EmExtraParameters::RegionsPAI
()
const
183
{
184
return
m_regnamesPAI
;
185
}
186
187
const
std::vector<G4String>&
G4EmExtraParameters::TypesPAI
()
const
188
{
189
return
m_typesPAI
;
190
}
191
192
void
G4EmExtraParameters::AddPhysics
(
const
G4String
& region,
193
const
G4String
& type)
194
{
195
G4String
r
=
CheckRegion
(region);
196
G4int
nreg =
m_regnamesPhys
.size();
197
for
(
G4int
i=0; i<nreg; ++i) {
198
if
(r ==
m_regnamesPhys
[i]) {
return
; }
199
}
200
m_regnamesPhys
.push_back(r);
201
m_typesPhys
.push_back(type);
202
}
203
204
const
std::vector<G4String>&
G4EmExtraParameters::RegionsPhysics
()
const
205
{
206
return
m_regnamesPhys
;
207
}
208
209
const
std::vector<G4String>&
G4EmExtraParameters::TypesPhysics
()
const
210
{
211
return
m_typesPhys
;
212
}
213
214
void
G4EmExtraParameters::SetSubCutoff
(
G4bool
val,
const
G4String
& region)
215
{
216
G4String
r
=
CheckRegion
(region);
217
G4int
nreg =
m_regnamesSubCut
.size();
218
for
(
G4int
i=0; i<nreg; ++i) {
219
if
(r ==
m_regnamesSubCut
[i]) {
220
m_subCuts
[i] = val;
221
return
;
222
}
223
}
224
m_regnamesSubCut
.push_back(r);
225
m_subCuts
.push_back(val);
226
}
227
228
void
229
G4EmExtraParameters::SetProcessBiasingFactor
(
const
G4String
& procname,
230
G4double
val,
G4bool
wflag)
231
{
232
if
(val > 0.0) {
233
G4int
n
=
m_procBiasedXS
.size();
234
for
(
G4int
i=0; i<
n
; ++i) {
235
if
(procname ==
m_procBiasedXS
[i]) {
236
m_factBiasedXS
[i] = val;
237
m_weightBiasedXS
[i]= wflag;
238
return
;
239
}
240
}
241
m_procBiasedXS
.push_back(procname);
242
m_factBiasedXS
.push_back(val);
243
m_weightBiasedXS
.push_back(wflag);
244
}
else
{
245
G4ExceptionDescription
ed;
246
ed <<
"Process: "
<< procname <<
" XS biasing factor "
247
<< val <<
" is negative - ignored"
;
248
PrintWarning
(ed);
249
}
250
}
251
252
void
253
G4EmExtraParameters::ActivateForcedInteraction
(
const
G4String
& procname,
254
const
G4String
& region,
255
G4double
length
,
256
G4bool
wflag)
257
{
258
G4String
r
=
CheckRegion
(region);
259
if
(length >= 0.0) {
260
G4int
n
=
m_procForced
.size();
261
for
(
G4int
i=0; i<
n
; ++i) {
262
if
(procname ==
m_procForced
[i] && r ==
m_regnamesForced
[i] ) {
263
m_lengthForced
[i] =
length
;
264
m_weightForced
[i]= wflag;
265
return
;
266
}
267
}
268
m_regnamesForced
.push_back(r);
269
m_procForced
.push_back(procname);
270
m_lengthForced
.push_back(length);
271
m_weightForced
.push_back(wflag);
272
}
else
{
273
G4ExceptionDescription
ed;
274
ed <<
"Process: "
<< procname <<
" in region "
<< r
275
<<
" : forced interacttion length= "
276
<< length <<
" is negative - ignored"
;
277
PrintWarning
(ed);
278
}
279
}
280
281
void
282
G4EmExtraParameters::ActivateSecondaryBiasing
(
const
G4String
& procname,
283
const
G4String
& region,
284
G4double
factor,
285
G4double
energyLim)
286
{
287
G4String
r
=
CheckRegion
(region);
288
if
(factor >= 0.0 && energyLim >= 0.0) {
289
G4int
n
=
m_procBiasedSec
.size();
290
for
(
G4int
i=0; i<
n
; ++i) {
291
if
(procname ==
m_procBiasedSec
[i] && r ==
m_regnamesBiasedSec
[i] ) {
292
m_factBiasedSec
[i] = factor;
293
m_elimBiasedSec
[i] = energyLim;
294
return
;
295
}
296
}
297
m_regnamesBiasedSec
.push_back(r);
298
m_procBiasedSec
.push_back(procname);
299
m_factBiasedSec
.push_back(factor);
300
m_elimBiasedSec
.push_back(energyLim);
301
}
else
{
302
G4ExceptionDescription
ed;
303
ed <<
"Process: "
<< procname <<
" in region "
<< r
304
<<
" : secondary bised factor= "
305
<< factor <<
", Elim= "
<< energyLim <<
" - ignored"
;
306
PrintWarning
(ed);
307
}
308
}
309
310
void
G4EmExtraParameters::DefineRegParamForLoss
(
G4VEnergyLossProcess
* ptr,
311
G4bool
isElectron
)
const
312
{
313
if
(isElectron) { ptr->
SetStepFunction
(
dRoverRange
,
finalRange
,
false
); }
314
else
{ ptr->
SetStepFunction
(
dRoverRangeMuHad
,
finalRangeMuHad
,
false
); }
315
316
G4RegionStore
* regionStore =
G4RegionStore::GetInstance
();
317
G4int
n
=
m_regnamesSubCut
.size();
318
for
(
G4int
i=0; i<
n
; ++i) {
319
const
G4Region
*
reg
= regionStore->
GetRegion
(
m_regnamesSubCut
[i],
false
);
320
if
(reg) { ptr->
ActivateSubCutoff
(
m_subCuts
[i], reg); }
321
}
322
n =
m_procBiasedXS
.size();
323
for
(
G4int
i=0; i<
n
; ++i) {
324
if
(ptr->
GetProcessName
() ==
m_procBiasedXS
[i]) {
325
ptr->
SetCrossSectionBiasingFactor
(
m_factBiasedXS
[i],
326
m_weightBiasedXS
[i]);
327
break
;
328
}
329
}
330
n =
m_procForced
.size();
331
for
(
G4int
i=0; i<
n
; ++i) {
332
if
(ptr->
GetProcessName
() ==
m_procForced
[i]) {
333
ptr->
ActivateForcedInteraction
(
m_lengthForced
[i],
334
m_regnamesForced
[i],
335
m_weightForced
[i]);
336
break
;
337
}
338
}
339
n =
m_procBiasedSec
.size();
340
for
(
G4int
i=0; i<
n
; ++i) {
341
if
(ptr->
GetProcessName
() ==
m_procBiasedSec
[i]) {
342
ptr->
ActivateSecondaryBiasing
(
m_regnamesBiasedSec
[i],
343
m_factBiasedSec
[i],
344
m_elimBiasedSec
[i]);
345
break
;
346
}
347
}
348
}
349
350
void
G4EmExtraParameters::DefineRegParamForEM
(
G4VEmProcess
* ptr)
const
351
{
352
G4int
n
=
m_procBiasedXS
.size();
353
for
(
G4int
i=0; i<
n
; ++i) {
354
if
(ptr->
GetProcessName
() ==
m_procBiasedXS
[i]) {
355
ptr->
SetCrossSectionBiasingFactor
(
m_factBiasedXS
[i],
356
m_weightBiasedXS
[i]);
357
break
;
358
}
359
}
360
n =
m_procForced
.size();
361
for
(
G4int
i=0; i<
n
; ++i) {
362
if
(ptr->
GetProcessName
() ==
m_procForced
[i]) {
363
ptr->
ActivateForcedInteraction
(
m_lengthForced
[i],
364
m_regnamesForced
[i],
365
m_weightForced
[i]);
366
break
;
367
}
368
}
369
n =
m_procBiasedSec
.size();
370
for
(
G4int
i=0; i<
n
; ++i) {
371
if
(ptr->
GetProcessName
() ==
m_procBiasedSec
[i]) {
372
ptr->
ActivateSecondaryBiasing
(
m_regnamesBiasedSec
[i],
373
m_factBiasedSec
[i],
374
m_elimBiasedSec
[i]);
375
break
;
376
}
377
}
378
}
379
380
G4bool
G4EmExtraParameters::QuantumEntanglement
()
381
{
382
return
quantumEntanglement
;
383
}
384
385
void
G4EmExtraParameters::SetQuantumEntanglement
(
G4bool
v
)
386
{
387
quantumEntanglement
=
v
;
388
}
389
390
G4bool
G4EmExtraParameters::GetDirectionalSplitting
() {
391
return
directionalSplitting
;
392
}
393
394
void
G4EmExtraParameters::SetDirectionalSplitting
(
G4bool
v
)
395
{
396
directionalSplitting
=
v
;
397
}
398
399
void
400
G4EmExtraParameters::SetDirectionalSplittingTarget
(
const
G4ThreeVector
&
v
)
401
{
402
directionalSplittingTarget
=
v
;
403
}
404
405
G4ThreeVector
G4EmExtraParameters::GetDirectionalSplittingTarget
()
const
406
{
407
return
directionalSplittingTarget
;
408
}
409
410
void
G4EmExtraParameters::SetDirectionalSplittingRadius
(
G4double
r
)
411
{
412
directionalSplittingRadius
=
r
;
413
}
414
415
G4double
G4EmExtraParameters::GetDirectionalSplittingRadius
()
416
{
417
return
directionalSplittingRadius
;
418
}
419
420
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
utils
src
G4EmExtraParameters.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:35
using
1.8.2 with
ECCE GitHub integration