Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
extended
field
field04
src
F04PhysicsList.cc
Go to the documentation of this file.
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
#include "
F04PhysicsList.hh
"
31
#include "
F04PhysicsListMessenger.hh
"
32
33
#include "
F04ExtraPhysics.hh
"
34
#include "
G4OpticalPhysics.hh
"
35
36
#include "
G4LossTableManager.hh
"
37
38
#include "
G4ProcessManager.hh
"
39
#include "
G4ParticleTypes.hh
"
40
#include "
G4ParticleTable.hh
"
41
42
#include "
G4PhysListFactory.hh
"
43
44
#include "
G4Gamma.hh
"
45
#include "
G4Electron.hh
"
46
#include "
G4Positron.hh
"
47
48
#include "
F04StepMax.hh
"
49
50
#include "
G4ProcessTable.hh
"
51
52
#include "
G4PionDecayMakeSpin.hh
"
53
#include "
G4DecayWithSpin.hh
"
54
55
#include "
G4DecayTable.hh
"
56
#include "
G4MuonDecayChannelWithSpin.hh
"
57
#include "
G4MuonRadiativeDecayChannelWithSpin.hh
"
58
59
#include "
G4SystemOfUnits.hh
"
60
61
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62
63
F04PhysicsList::F04PhysicsList
(
G4String
physName) :
G4VModularPhysicsList
()
64
{
65
G4LossTableManager::Instance
();
66
67
defaultCutValue
= 1.*
mm
;
68
fCutForGamma =
defaultCutValue
;
69
fCutForElectron =
defaultCutValue
;
70
fCutForPositron =
defaultCutValue
;
71
72
fMessenger =
new
F04PhysicsListMessenger
(
this
);
73
74
SetVerboseLevel
(1);
75
76
G4PhysListFactory
factory;
77
G4VModularPhysicsList
* phys = NULL;
78
79
if
(factory.
IsReferencePhysList
(physName))
80
phys =factory.
GetReferencePhysList
(physName);
81
82
// Physics List is defined via environment variable PHYSLIST
83
if
(!phys) phys = factory.
ReferencePhysList
();
84
85
if
(!phys)
G4Exception
(
"WLSPhysicsList::WLSPhysicsList"
,
"InvalidSetup"
,
86
FatalException
,
"PhysicsList does not exist"
);
87
88
for
(
G4int
i = 0; ; ++i) {
89
G4VPhysicsConstructor
* elem =
90
const_cast<
G4VPhysicsConstructor
*
>
(phys->
GetPhysics
(i));
91
if
(elem == NULL)
break
;
92
G4cout
<<
"RegisterPhysics: "
<< elem->
GetPhysicsName
() <<
G4endl
;
93
RegisterPhysics
(elem);
94
}
95
96
RegisterPhysics
(
new
F04ExtraPhysics
());
97
RegisterPhysics
(
new
G4OpticalPhysics
());
98
99
fStepMaxProcess =
new
F04StepMax
();
100
fMaxChargedStep =
DBL_MAX
;
101
}
102
103
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104
105
F04PhysicsList::~F04PhysicsList
()
106
{
107
delete
fMessenger;
108
109
delete
fStepMaxProcess;
110
}
111
112
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113
114
void
F04PhysicsList::ConstructParticle
()
115
{
116
G4VModularPhysicsList::ConstructParticle
();
117
118
G4DecayTable
* muonPlusDecayTable =
new
G4DecayTable
();
119
muonPlusDecayTable ->
Insert
(
new
120
G4MuonDecayChannelWithSpin
(
"mu+"
,0.986));
121
muonPlusDecayTable ->
Insert
(
new
122
G4MuonRadiativeDecayChannelWithSpin
(
"mu+"
,0.014));
123
G4MuonPlus::MuonPlusDefinition
() -> SetDecayTable(muonPlusDecayTable);
124
125
G4DecayTable
* muonMinusDecayTable =
new
G4DecayTable
();
126
muonMinusDecayTable ->
Insert
(
new
127
G4MuonDecayChannelWithSpin
(
"mu-"
,0.986));
128
muonMinusDecayTable ->
Insert
(
new
129
G4MuonRadiativeDecayChannelWithSpin
(
"mu-"
,0.014));
130
G4MuonMinus::MuonMinusDefinition
() -> SetDecayTable(muonMinusDecayTable);
131
}
132
133
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134
135
void
F04PhysicsList::ConstructProcess
()
136
{
137
G4VModularPhysicsList::ConstructProcess
();
138
139
G4DecayWithSpin
* decayWithSpin =
new
G4DecayWithSpin
();
140
141
G4ProcessTable
* processTable =
G4ProcessTable::GetProcessTable
();
142
143
G4VProcess
* decay;
144
decay = processTable->
FindProcess
(
"Decay"
,
G4MuonPlus::MuonPlus
());
145
146
G4ProcessManager
* pmanager;
147
pmanager =
G4MuonPlus::MuonPlus
()->
GetProcessManager
();
148
149
if
(pmanager) {
150
if
(decay) pmanager->
RemoveProcess
(decay);
151
pmanager->
AddProcess
(decayWithSpin);
152
// set ordering for PostStepDoIt and AtRestDoIt
153
pmanager ->
SetProcessOrdering
(decayWithSpin,
idxPostStep
);
154
pmanager ->
SetProcessOrdering
(decayWithSpin,
idxAtRest
);
155
}
156
157
decay = processTable->
FindProcess
(
"Decay"
,
G4MuonMinus::MuonMinus
());
158
159
pmanager =
G4MuonMinus::MuonMinus
()->
GetProcessManager
();
160
161
if
(pmanager) {
162
if
(decay) pmanager->
RemoveProcess
(decay);
163
pmanager->
AddProcess
(decayWithSpin);
164
// set ordering for PostStepDoIt and AtRestDoIt
165
pmanager ->
SetProcessOrdering
(decayWithSpin,
idxPostStep
);
166
pmanager ->
SetProcessOrdering
(decayWithSpin,
idxAtRest
);
167
}
168
169
G4PionDecayMakeSpin
* poldecay =
new
G4PionDecayMakeSpin
();
170
171
decay = processTable->
FindProcess
(
"Decay"
,
G4PionPlus::PionPlus
());
172
173
pmanager =
G4PionPlus::PionPlus
()->
GetProcessManager
();
174
175
if
(pmanager) {
176
if
(decay) pmanager->
RemoveProcess
(decay);
177
pmanager->
AddProcess
(poldecay);
178
// set ordering for PostStepDoIt and AtRestDoIt
179
pmanager ->
SetProcessOrdering
(poldecay,
idxPostStep
);
180
pmanager ->
SetProcessOrdering
(poldecay,
idxAtRest
);
181
}
182
183
decay = processTable->
FindProcess
(
"Decay"
,
G4PionMinus::PionMinus
());
184
185
pmanager =
G4PionMinus::PionMinus
()->
GetProcessManager
();
186
187
if
(pmanager) {
188
if
(decay) pmanager->
RemoveProcess
(decay);
189
pmanager->
AddProcess
(poldecay);
190
// set ordering for PostStepDoIt and AtRestDoIt
191
pmanager ->
SetProcessOrdering
(poldecay,
idxPostStep
);
192
pmanager ->
SetProcessOrdering
(poldecay,
idxAtRest
);
193
}
194
195
AddStepMax
();
196
}
197
198
/*
199
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
200
201
void F04PhysicsList::RemoveFromPhysicsList(const G4String& name)
202
{
203
G4bool success = false;
204
for (G4PhysConstVector::iterator p = physicsVector->begin();
205
p != physicsVector->end(); ++p) {
206
G4VPhysicsConstructor* e = (*p);
207
if (e->GetPhysicsName() == name) {
208
physicsVector->erase(p);
209
success = true;
210
break;
211
}
212
}
213
if (!success) {
214
std::ostringstream message;
215
message << "PhysicsList::RemoveFromPhysicsList "<< name << "not found";
216
G4Exception(message.str().c_str());
217
}
218
}
219
220
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
221
222
void F04PhysicsList::ClearPhysics()
223
{
224
for (G4PhysConstVector::iterator p = physicsVector->begin();
225
p != physicsVector->end(); ++p) {
226
delete (*p);
227
}
228
physicsVector->clear();
229
}
230
*/
231
232
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
233
234
void
F04PhysicsList::SetCuts
()
235
{
236
if
(
verboseLevel
>0) {
237
G4cout
<<
"F04PhysicsList::SetCuts:"
;
238
G4cout
<<
"CutLength : "
<<
G4BestUnit
(
defaultCutValue
,
"Length"
)
239
<<
G4endl
;
240
}
241
242
// set cut values for gamma at first and for e- second and next for e+,
243
// because some processes for e+/e- need cut values for gamma
244
SetCutValue
(fCutForGamma,
"gamma"
);
245
SetCutValue
(fCutForElectron,
"e-"
);
246
SetCutValue
(fCutForPositron,
"e+"
);
247
248
if
(
verboseLevel
>0)
DumpCutValuesTable
();
249
}
250
251
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
252
253
void
F04PhysicsList::SetCutForGamma
(
G4double
cut)
254
{
255
fCutForGamma = cut;
256
SetParticleCuts
(fCutForGamma,
G4Gamma::Gamma
());
257
}
258
259
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
260
261
void
F04PhysicsList::SetCutForElectron
(
G4double
cut)
262
{
263
fCutForElectron = cut;
264
SetParticleCuts
(fCutForElectron,
G4Electron::Electron
());
265
}
266
267
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
268
269
void
F04PhysicsList::SetCutForPositron
(
G4double
cut)
270
{
271
fCutForPositron = cut;
272
SetParticleCuts
(fCutForPositron,
G4Positron::Positron
());
273
}
274
275
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
276
277
void
F04PhysicsList::SetStepMax
(
G4double
step)
278
{
279
fMaxChargedStep = step ;
280
fStepMaxProcess->
SetStepMax
(fMaxChargedStep);
281
}
282
283
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
284
285
F04StepMax
*
F04PhysicsList::GetStepMaxProcess
()
286
{
287
return
fStepMaxProcess;
288
}
289
290
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
291
292
void
F04PhysicsList::AddStepMax
()
293
{
294
// Step limitation seen as a process
295
296
theParticleIterator
->
reset
();
297
while
((*
theParticleIterator
)()){
298
G4ParticleDefinition
* particle =
theParticleIterator
->
value
();
299
G4ProcessManager
* pmanager = particle->
GetProcessManager
();
300
301
if
(fStepMaxProcess->
IsApplicable
(*particle) && !particle->
IsShortLived
())
302
{
303
if
(pmanager) pmanager ->
AddDiscreteProcess
(fStepMaxProcess);
304
}
305
}
306
}
Generated on Sat May 25 2013 14:32:26 for Geant4 by
1.8.4