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
PhysicsList.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PhysicsList.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
//
28
//
29
//
30
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33
#include "PhysicsList.hh"
34
#include "PhysicsListMessenger.hh"
35
36
#include "PhysListEmStandard.hh"
37
38
#include "
G4EmStandardPhysics.hh
"
39
#include "
G4EmStandardPhysics_option1.hh
"
40
#include "
G4EmStandardPhysics_option2.hh
"
41
#include "
G4EmStandardPhysics_option3.hh
"
42
#include "
G4EmStandardPhysics_option4.hh
"
43
#include "
G4EmStandardPhysicsSS.hh
"
44
#include "
G4EmStandardPhysicsGS.hh
"
45
#include "
G4EmStandardPhysicsWVI.hh
"
46
#include "
G4EmLivermorePhysics.hh
"
47
#include "
G4EmPenelopePhysics.hh
"
48
#include "
G4EmLowEPPhysics.hh
"
49
50
#include "DetectorConstruction.hh"
51
52
#include "
G4LossTableManager.hh
"
53
#include "
G4UnitsTable.hh
"
54
#include "
G4SystemOfUnits.hh
"
55
#include "
G4EmParameters.hh
"
56
57
// particles
58
59
#include "
G4BosonConstructor.hh
"
60
#include "
G4LeptonConstructor.hh
"
61
#include "
G4MesonConstructor.hh
"
62
#include "
G4BosonConstructor.hh
"
63
#include "
G4BaryonConstructor.hh
"
64
#include "
G4IonConstructor.hh
"
65
#include "
G4ShortLivedConstructor.hh
"
66
67
#include "
G4PhysicsListHelper.hh
"
68
#include "
G4Decay.hh
"
69
#include "
G4RadioactiveDecay.hh
"
70
#include "
G4GenericIon.hh
"
71
#include "
G4NuclideTable.hh
"
72
73
#include "
G4ProcessManager.hh
"
74
#include "StepMax.hh"
75
#include "
G4Material.hh
"
76
77
#include "
G4Gamma.hh
"
78
#include "
G4Electron.hh
"
79
#include "
G4Proton.hh
"
80
#include "
G4GenericIon.hh
"
81
82
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83
84
PhysicsList::PhysicsList
(
DetectorConstruction
* det)
85
:
G4VModularPhysicsList
(), fEmPhysicsList(nullptr), fEmName(
" "
), fDet(det)
86
{
87
fMessenger
=
new
PhysicsListMessenger
(
this
);
88
SetVerboseLevel
(1);
89
90
// EM physics
91
AddPhysicsList
(
"emstandard_opt3"
);
92
93
// fix lower limit for cut
94
G4ProductionCutsTable::GetProductionCutsTable
()->
SetEnergyRange
(10*
eV
, 1*
GeV
);
95
SetDefaultCutValue
(1*
mm
);
96
}
97
98
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
99
100
PhysicsList::~PhysicsList
()
101
{
102
delete
fMessenger
;
103
}
104
105
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
106
107
void
PhysicsList::ConstructParticle
()
108
{
109
G4BosonConstructor
pBosonConstructor;
110
pBosonConstructor.
ConstructParticle
();
111
112
G4LeptonConstructor
pLeptonConstructor;
113
pLeptonConstructor.
ConstructParticle
();
114
115
G4MesonConstructor
pMesonConstructor;
116
pMesonConstructor.
ConstructParticle
();
117
118
G4BaryonConstructor
pBaryonConstructor;
119
pBaryonConstructor.
ConstructParticle
();
120
121
G4IonConstructor
pIonConstructor;
122
pIonConstructor.
ConstructParticle
();
123
124
G4ShortLivedConstructor
pShortLivedConstructor;
125
pShortLivedConstructor.
ConstructParticle
();
126
}
127
128
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
129
130
void
PhysicsList::ConstructProcess
()
131
{
132
// Transportation
133
//
134
AddTransportation
();
135
136
// Electromagnetic physics list
137
//
138
fEmPhysicsList
->
ConstructProcess
();
139
140
// Decay Process
141
//
142
AddDecay
();
143
144
// Decay Process
145
//
146
AddRadioactiveDecay
();
147
148
// step limitation (as a full process)
149
//
150
AddStepMax
();
151
152
// example of Get process
153
auto
process =
GetProcess
(
"RadioactiveDecay"
);
154
if
(process !=
nullptr
) {
155
G4cout
<<
"\n GetProcess : "
<< process->GetProcessName() <<
G4endl
;
156
}
157
}
158
159
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160
161
void
PhysicsList::AddPhysicsList
(
const
G4String
&
name
)
162
{
163
if
(
verboseLevel
>0) {
164
G4cout
<<
"PhysicsList::AddPhysicsList: <"
<< name <<
">"
<<
G4endl
;
165
}
166
167
if
(name ==
fEmName
)
return
;
168
169
if
(name ==
"local"
) {
170
fEmName
=
name
;
171
delete
fEmPhysicsList
;
172
fEmPhysicsList
=
new
PhysListEmStandard
(name);
173
174
}
else
if
(name ==
"emstandard_opt0"
) {
175
fEmName
=
name
;
176
delete
fEmPhysicsList
;
177
fEmPhysicsList
=
new
G4EmStandardPhysics
();
178
179
}
else
if
(name ==
"emstandard_opt1"
) {
180
fEmName
=
name
;
181
delete
fEmPhysicsList
;
182
fEmPhysicsList
=
new
G4EmStandardPhysics_option1
();
183
184
}
else
if
(name ==
"emstandard_opt2"
) {
185
fEmName
=
name
;
186
delete
fEmPhysicsList
;
187
fEmPhysicsList
=
new
G4EmStandardPhysics_option2
();
188
189
}
else
if
(name ==
"emstandard_opt3"
) {
190
fEmName
=
name
;
191
delete
fEmPhysicsList
;
192
fEmPhysicsList
=
new
G4EmStandardPhysics_option3
();
193
194
}
else
if
(name ==
"emstandard_opt4"
) {
195
fEmName
=
name
;
196
delete
fEmPhysicsList
;
197
fEmPhysicsList
=
new
G4EmStandardPhysics_option4
();
198
199
}
else
if
(name ==
"emstandardSS"
) {
200
fEmName
=
name
;
201
delete
fEmPhysicsList
;
202
fEmPhysicsList
=
new
G4EmStandardPhysicsSS
();
203
204
}
else
if
(name ==
"emstandardGS"
) {
205
fEmName
=
name
;
206
delete
fEmPhysicsList
;
207
fEmPhysicsList
=
new
G4EmStandardPhysicsGS
();
208
209
}
else
if
(name ==
"emstandardWVI"
) {
210
fEmName
=
name
;
211
delete
fEmPhysicsList
;
212
fEmPhysicsList
=
new
G4EmStandardPhysicsWVI
();
213
214
}
else
if
(name ==
"emlivermore"
) {
215
fEmName
=
name
;
216
delete
fEmPhysicsList
;
217
fEmPhysicsList
=
new
G4EmLivermorePhysics
();
218
219
}
else
if
(name ==
"empenelope"
) {
220
fEmName
=
name
;
221
delete
fEmPhysicsList
;
222
fEmPhysicsList
=
new
G4EmPenelopePhysics
();
223
224
}
else
if
(name ==
"emlowenergy"
) {
225
fEmName
=
name
;
226
delete
fEmPhysicsList
;
227
fEmPhysicsList
=
new
G4EmLowEPPhysics
();
228
229
}
else
{
230
231
G4cout
<<
"PhysicsList::AddPhysicsList: <"
<< name <<
">"
232
<<
" is not defined"
233
<<
G4endl
;
234
}
235
236
// Em options
237
//
238
G4EmParameters::Instance
()->
SetBuildCSDARange
(
true
);
239
G4EmParameters::Instance
()->
SetGeneralProcessActive
(
false
);
240
}
241
242
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
243
244
void
PhysicsList::AddDecay
()
245
{
246
G4PhysicsListHelper
* ph =
G4PhysicsListHelper::GetPhysicsListHelper
();
247
248
// Decay Process
249
//
250
G4Decay
* fDecayProcess =
new
G4Decay
();
251
252
auto
particleIterator
=
GetParticleIterator
();
253
particleIterator
->reset();
254
while
( (*
particleIterator
)() ){
255
G4ParticleDefinition
*
particle
=
particleIterator
->value();
256
if
(fDecayProcess->
IsApplicable
(*particle))
257
ph->
RegisterProcess
(fDecayProcess, particle);
258
}
259
}
260
261
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
262
263
void
PhysicsList::AddRadioactiveDecay
()
264
{
265
G4RadioactiveDecay
* radioactiveDecay =
new
G4RadioactiveDecay
();
266
267
radioactiveDecay->
SetARM
(
true
);
//Atomic Rearangement
268
269
G4PhysicsListHelper
* ph =
G4PhysicsListHelper::GetPhysicsListHelper
();
270
ph->
RegisterProcess
(radioactiveDecay,
G4GenericIon::GenericIon
());
271
272
// mandatory for G4NuclideTable
273
//
274
G4NuclideTable::GetInstance
()->
SetThresholdOfHalfLife
(0.1*
picosecond
);
275
}
276
277
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
278
279
void
PhysicsList::AddStepMax
()
280
{
281
// Step limitation seen as a process
282
StepMax
* stepMaxProcess =
new
StepMax
();
283
284
auto
particleIterator
=
GetParticleIterator
();
285
particleIterator
->reset();
286
while
((*
particleIterator
)()){
287
G4ParticleDefinition
*
particle
=
particleIterator
->value();
288
G4ProcessManager
* pmanager = particle->
GetProcessManager
();
289
290
if
(stepMaxProcess->
IsApplicable
(*particle))
291
{
292
pmanager ->
AddDiscreteProcess
(stepMaxProcess);
293
}
294
}
295
}
296
297
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
298
299
void
PhysicsList::GetRange
(
G4double
val)
300
{
301
G4LogicalVolume
* lBox =
fDet
->
GetWorld
()->
GetLogicalVolume
();
302
const
G4MaterialCutsCouple
* couple = lBox->
GetMaterialCutsCouple
();
303
const
G4Material
* currMat = lBox->
GetMaterial
();
304
305
G4ParticleDefinition
*
part
;
306
G4double
cut;
307
part =
G4Electron::Electron
();
308
cut =
G4LossTableManager::Instance
()->
GetRange
(part,val,couple);
309
G4cout
<<
"material : "
<< currMat->
GetName
() <<
G4endl
;
310
G4cout
<<
"particle : "
<< part->
GetParticleName
() <<
G4endl
;
311
G4cout
<<
"energy : "
<<
G4BestUnit
(val,
"Energy"
) <<
G4endl
;
312
G4cout
<<
"range : "
<<
G4BestUnit
(cut,
"Length"
) <<
G4endl
;
313
}
314
315
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
316
317
G4VProcess
*
PhysicsList::GetProcess
(
const
G4String
& processName)
const
318
{
319
G4ParticleDefinition
* particle =
G4GenericIon::GenericIon
();
320
G4ProcessVector
* procList = particle->
GetProcessManager
()->
GetProcessList
();
321
G4int
nbProc = particle->
GetProcessManager
()->
GetProcessListLength
();
322
for
(
G4int
k
=0;
k
<nbProc;
k
++) {
323
G4VProcess
* process = (*procList)[
k
];
324
if
(process->
GetProcessName
() == processName)
return
process;
325
}
326
return
nullptr
;
327
}
328
329
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
electromagnetic
TestEm1
src
PhysicsList.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:50
using
1.8.2 with
ECCE GitHub integration