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
PurgMagPhysicsList.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PurgMagPhysicsList.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
// Code developed by:
27
// S.Larsson
28
//
29
// ********************************
30
// * *
31
// * PurgMagPhysicsList.cc *
32
// * *
33
// ********************************
34
//
35
//
36
//
37
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
38
39
#include "
PurgMagPhysicsList.hh
"
40
41
#include "
G4SystemOfUnits.hh
"
42
#include "
G4ParticleDefinition.hh
"
43
#include "
G4ParticleWithCuts.hh
"
44
#include "
G4ProcessManager.hh
"
45
#include "
G4ParticleTypes.hh
"
46
#include "
G4ParticleTable.hh
"
47
#include "
G4Material.hh
"
48
#include "
G4UnitsTable.hh
"
49
#include "
G4ios.hh
"
50
51
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52
53
PurgMagPhysicsList::PurgMagPhysicsList
():
G4VUserPhysicsList
()
54
{
55
defaultCutValue
= 1*
micrometer
;
56
cutForGamma
=
defaultCutValue
;
57
cutForElectron
=
defaultCutValue
;
58
cutForPositron
=
defaultCutValue
;
59
cutForProton
=
defaultCutValue
;
60
61
SetVerboseLevel
(1);
62
}
63
64
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
65
66
PurgMagPhysicsList::~PurgMagPhysicsList
()
67
{}
68
69
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
70
71
void
PurgMagPhysicsList::ConstructParticle
()
72
{
73
// In this method, static member functions should be called
74
// for all particles which you want to use.
75
// This ensures that objects of these particle types will be
76
// created in the program.
77
78
ConstructBosons
();
79
ConstructLeptons
();
80
ConstructBarions
();
81
}
82
83
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
84
85
void
PurgMagPhysicsList::ConstructBosons
()
86
{
87
88
// gamma
89
G4Gamma::GammaDefinition
();
90
91
// optical photon
92
G4OpticalPhoton::OpticalPhotonDefinition
();
93
}
94
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
95
96
void
PurgMagPhysicsList::ConstructLeptons
()
97
{
98
// leptons
99
G4Electron::ElectronDefinition
();
100
G4Positron::PositronDefinition
();
101
}
102
103
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
104
105
void
PurgMagPhysicsList::ConstructBarions
()
106
{
107
// barions
108
G4Proton::ProtonDefinition
();
109
G4AntiProton::AntiProtonDefinition
();
110
}
111
112
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
113
114
void
PurgMagPhysicsList::ConstructProcess
()
115
{
116
AddTransportation
();
117
ConstructEM
();
118
ConstructGeneral
();
119
}
120
121
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
122
123
#include "
G4eMultipleScattering.hh
"
124
#include "
G4hMultipleScattering.hh
"
125
// Bosons
126
#include "
G4PhotoElectricEffect.hh
"
127
#include "
G4ComptonScattering.hh
"
128
#include "
G4GammaConversion.hh
"
129
// Leptons
130
#include "
G4eIonisation.hh
"
131
#include "
G4eBremsstrahlung.hh
"
132
#include "
G4eplusAnnihilation.hh
"
133
134
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
135
136
void
PurgMagPhysicsList::ConstructEM
()
137
{
138
auto
particleIterator
=
GetParticleIterator
();
139
particleIterator
->reset();
140
while
( (*
particleIterator
)() )
141
{
142
G4ParticleDefinition
*
particle
=
particleIterator
->value();
143
G4ProcessManager
* pmanager = particle->
GetProcessManager
();
144
G4String
particleName = particle->
GetParticleName
();
145
146
147
if
(particleName ==
"gamma"
) {
148
//gamma
149
pmanager->
AddDiscreteProcess
(
new
G4GammaConversion
);
150
pmanager->
AddDiscreteProcess
(
new
G4ComptonScattering
);
151
pmanager->
AddDiscreteProcess
(
new
G4PhotoElectricEffect
);
152
153
}
else
if
(particleName ==
"e-"
) {
154
//electron
155
pmanager->
AddProcess
(
new
G4eBremsstrahlung
, -1,-1,3);
156
pmanager->
AddProcess
(
new
G4eIonisation
, -1, 2,2);
157
pmanager->
AddProcess
(
new
G4eMultipleScattering
, -1, 1,1);
158
159
}
else
if
(particleName ==
"e+"
) {
160
//positron
161
pmanager->
AddProcess
(
new
G4eBremsstrahlung
, -1,-1,3);
162
pmanager->
AddProcess
(
new
G4eIonisation
, -1, 2,2);
163
pmanager->
AddProcess
(
new
G4eMultipleScattering
, -1, 1,1);
164
pmanager->
AddProcess
(
new
G4eplusAnnihilation
, 0,-1,4);
165
166
}
else
if
(particleName ==
"proton"
) {
167
//proton
168
pmanager->
AddProcess
(
new
G4hMultipleScattering
, -1,1,1);
169
170
}
else
if
(particleName ==
"anti_proton"
) {
171
//antiproton
172
pmanager->
AddProcess
(
new
G4hMultipleScattering
, -1,1,1);
173
}
174
}
175
}
176
177
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
178
179
void
PurgMagPhysicsList::ConstructGeneral
()
180
{ }
181
182
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
183
184
void
PurgMagPhysicsList::SetCuts
()
185
{
186
if
(
verboseLevel
>0){
187
G4cout
<<
"PurgMagPhysicsList::SetCuts:"
;
188
G4cout
<<
"CutLength : "
<<
G4BestUnit
(
defaultCutValue
,
"Length"
) <<
G4endl
;
189
}
190
191
// set cut values for gamma at first and for e- second and next for e+,
192
// because some processes for e+/e- need cut values for gamma
193
SetCutValue
(
cutForGamma
,
"gamma"
);
194
SetCutValue
(
cutForElectron
,
"e-"
);
195
SetCutValue
(
cutForPositron
,
"e+"
);
196
197
// set cut values for proton and anti_proton before all other hadrons
198
// because some processes for hadrons need cut values for proton/anti_proton
199
SetCutValue
(
cutForProton
,
"proton"
);
200
SetCutValue
(
cutForProton
,
"anti_proton"
);
201
202
// SetCutValueForOthers(defaultCutValue);
203
204
if
(
verboseLevel
>0)
DumpCutValuesTable
();
205
}
206
207
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
208
209
void
PurgMagPhysicsList::SetGammaLowLimit
(
G4double
lowcut)
210
{
211
if
(
verboseLevel
>0){
212
G4cout
<<
"PurgMagPhysicsList::SetCuts:"
;
213
G4cout
<<
"Gamma cut in energy: "
<< lowcut*
MeV
<<
" (MeV)"
<<
G4endl
;
214
}
215
216
// G4Gamma::SetEnergyRange(lowcut,1e5);
217
SetGELowLimit
(lowcut);
218
}
219
220
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
221
222
void
PurgMagPhysicsList::SetElectronLowLimit
(
G4double
lowcut)
223
{
224
if
(
verboseLevel
>0){
225
226
G4cout
<<
"PurgMagPhysicsList::SetCuts:"
;
227
G4cout
<<
"Electron cut in energy: "
<< lowcut*
MeV
<<
" (MeV)"
<<
G4endl
;
228
}
229
230
// G4Electron::SetEnergyRange(lowcut,1e5);
231
SetGELowLimit
(lowcut);
232
}
233
234
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
235
236
void
PurgMagPhysicsList::SetPositronLowLimit
(
G4double
lowcut)
237
{
238
if
(
verboseLevel
>0){
239
240
G4cout
<<
"PurgMagPhysicsList::SetCuts:"
;
241
G4cout
<<
"Positron cut in energy: "
<< lowcut*
MeV
<<
" (MeV)"
<<
G4endl
;
242
}
243
244
G4cerr
<<
"PurgMagPhysicsList::SetPositronLowLimit: Not currently able to set Positron LowLimit."
<<
G4endl
;
245
G4Exception
(
"PurgMagPhysicsList::SetPositronLowLimit()"
,
"PurMag001"
,
246
FatalException
,
"Positron Low Limit: not implemented in PurgMagPhysicsList"
);
247
//
248
// G4Positron::SetEnergyRange(lowcut,1e5);
249
}
250
251
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
252
253
void
PurgMagPhysicsList::SetProtonLowLimit
(
G4double
lowcut)
254
{
255
if
(
verboseLevel
>0){
256
257
G4cout
<<
"PurgMagPhysicsList::SetCuts:"
;
258
G4cout
<<
"Proton cut in energy: "
<< lowcut*
MeV
<<
" (MeV)"
<<
G4endl
;
259
}
260
261
G4cerr
<<
"PurgMagPhysicsList::SetProtonLowLimit: Not currently able to set Proton LowLimit."
<<
G4endl
;
262
G4Exception
(
"PurgMagPhysicsList::SetProtonLowLimit()"
,
"PurMag002"
,
263
FatalException
,
"Proton Low Limit: not implemented in PurgMagPhysicsList"
);
264
//
265
// G4Proton::SetEnergyRange(lowcut,1e5);
266
// G4AntiProton::SetEnergyRange(lowcut,1e5);
267
}
268
269
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
270
271
void
PurgMagPhysicsList::SetGEPLowLimit
(
G4double
lowcut)
272
{
273
if
(
verboseLevel
>0){
274
G4cout
<<
"PurgMagPhysicsList::SetGEPLowLimit:"
;
275
G4cout
<<
"Gamma and Electron cut in energy: "
<< lowcut*
MeV
<<
" (MeV)"
<<
G4endl
;
276
}
277
278
// G4Gamma::SetEnergyRange(lowcut,1e5);
279
// G4Electron::SetEnergyRange(lowcut,1e5);
280
// G4Positron::SetEnergyRange(lowcut,1e5);
281
this->
SetGELowLimit
(lowcut);
282
283
G4cerr
<<
" SetGEPLowLimit : Uncertain whether setting Positron low limit "
<<
G4endl
;
284
}
285
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
286
287
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
288
void
PurgMagPhysicsList::SetGELowLimit
(
G4double
lowcut)
289
{
290
if
(
verboseLevel
>0){
291
G4cout
<<
"PurgMagPhysicsList::SetGELowLimit:"
;
292
G4cout
<<
"Gamma and Electron cut in energy: "
<< lowcut*
MeV
<<
" (MeV)"
<<
G4endl
;
293
}
294
295
G4ProductionCutsTable::GetProductionCutsTable
()->
SetEnergyRange
(lowcut,1
e5
);
296
}
297
void
PurgMagPhysicsList::SetGammaCut
(
G4double
val)
298
{
299
ResetCuts
();
300
cutForGamma
= val;
301
}
302
303
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
304
305
void
PurgMagPhysicsList::SetElectronCut
(
G4double
val)
306
{
307
// ResetCuts();
308
cutForElectron
= val;
309
}
310
311
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
312
313
void
PurgMagPhysicsList::SetPositronCut
(
G4double
val)
314
{
315
// ResetCuts();
316
cutForPositron
= val;
317
}
318
319
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
320
321
void
PurgMagPhysicsList::SetProtonCut
(
G4double
val)
322
{
323
//ResetCuts();
324
cutForProton
= val;
325
}
326
327
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
328
329
330
331
332
333
geant4
tree
geant4-10.6-release
examples
advanced
purging_magnet
src
PurgMagPhysicsList.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:00
using
1.8.2 with
ECCE GitHub integration