source: trunk/examples/extended/electromagnetic/TestEm11/src/PhysicsList.cc@ 1303

Last change on this file since 1303 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

File size: 9.7 KB
Line 
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// $Id: PhysicsList.cc,v 1.7 2009/09/22 14:20:31 maire Exp $
27// GEANT4 tag $Name: geant4-09-03-cand-01 $
28//
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#include "PhysicsList.hh"
33#include "PhysicsListMessenger.hh"
34
35#include "PhysListEmStandard.hh"
36
37#include "G4EmStandardPhysics.hh"
38#include "G4EmStandardPhysics_option1.hh"
39#include "G4EmStandardPhysics_option2.hh"
40#include "G4EmStandardPhysics_option3.hh"
41#include "G4EmLivermorePhysics.hh"
42#include "G4EmPenelopePhysics.hh"
43
44#include "G4LossTableManager.hh"
45#include "G4UnitsTable.hh"
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48
49PhysicsList::PhysicsList() : G4VModularPhysicsList()
50{
51 G4LossTableManager::Instance();
52 defaultCutValue = 1.*mm;
53 cutForGamma = defaultCutValue;
54 cutForElectron = defaultCutValue;
55 cutForPositron = defaultCutValue;
56
57 stepMaxProcess = 0;
58
59 pMessenger = new PhysicsListMessenger(this);
60
61 SetVerboseLevel(1);
62
63 // EM physics
64 emPhysicsList = new PhysListEmStandard(emName = "local");
65
66}
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
70PhysicsList::~PhysicsList()
71{
72 delete pMessenger;
73 delete emPhysicsList;
74}
75
76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
78// Bosons
79#include "G4ChargedGeantino.hh"
80#include "G4Geantino.hh"
81#include "G4Gamma.hh"
82#include "G4OpticalPhoton.hh"
83
84// leptons
85#include "G4MuonPlus.hh"
86#include "G4MuonMinus.hh"
87#include "G4NeutrinoMu.hh"
88#include "G4AntiNeutrinoMu.hh"
89
90#include "G4Electron.hh"
91#include "G4Positron.hh"
92#include "G4NeutrinoE.hh"
93#include "G4AntiNeutrinoE.hh"
94
95// Mesons
96#include "G4PionPlus.hh"
97#include "G4PionMinus.hh"
98#include "G4PionZero.hh"
99#include "G4Eta.hh"
100#include "G4EtaPrime.hh"
101
102#include "G4KaonPlus.hh"
103#include "G4KaonMinus.hh"
104#include "G4KaonZero.hh"
105#include "G4AntiKaonZero.hh"
106#include "G4KaonZeroLong.hh"
107#include "G4KaonZeroShort.hh"
108
109// Baryons
110#include "G4Proton.hh"
111#include "G4AntiProton.hh"
112#include "G4Neutron.hh"
113#include "G4AntiNeutron.hh"
114
115// Nuclei
116#include "G4Alpha.hh"
117#include "G4Deuteron.hh"
118#include "G4Triton.hh"
119#include "G4He3.hh"
120#include "G4GenericIon.hh"
121
122//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
123
124void PhysicsList::ConstructParticle()
125{
126// pseudo-particles
127 G4Geantino::GeantinoDefinition();
128 G4ChargedGeantino::ChargedGeantinoDefinition();
129
130// gamma
131 G4Gamma::GammaDefinition();
132
133// optical photon
134 G4OpticalPhoton::OpticalPhotonDefinition();
135
136// leptons
137 G4Electron::ElectronDefinition();
138 G4Positron::PositronDefinition();
139 G4MuonPlus::MuonPlusDefinition();
140 G4MuonMinus::MuonMinusDefinition();
141
142 G4NeutrinoE::NeutrinoEDefinition();
143 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
144 G4NeutrinoMu::NeutrinoMuDefinition();
145 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
146
147// mesons
148 G4PionPlus::PionPlusDefinition();
149 G4PionMinus::PionMinusDefinition();
150 G4PionZero::PionZeroDefinition();
151 G4Eta::EtaDefinition();
152 G4EtaPrime::EtaPrimeDefinition();
153 G4KaonPlus::KaonPlusDefinition();
154 G4KaonMinus::KaonMinusDefinition();
155 G4KaonZero::KaonZeroDefinition();
156 G4AntiKaonZero::AntiKaonZeroDefinition();
157 G4KaonZeroLong::KaonZeroLongDefinition();
158 G4KaonZeroShort::KaonZeroShortDefinition();
159
160// barions
161 G4Proton::ProtonDefinition();
162 G4AntiProton::AntiProtonDefinition();
163 G4Neutron::NeutronDefinition();
164 G4AntiNeutron::AntiNeutronDefinition();
165
166// ions
167 G4Deuteron::DeuteronDefinition();
168 G4Triton::TritonDefinition();
169 G4He3::He3Definition();
170 G4Alpha::AlphaDefinition();
171 G4GenericIon::GenericIonDefinition();
172}
173
174//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
175
176#include "G4ProcessManager.hh"
177#include "G4EmProcessOptions.hh"
178
179void PhysicsList::ConstructProcess()
180{
181 // transportation
182 //
183 AddTransportation();
184
185 // electromagnetic physics list
186 //
187 emPhysicsList->ConstructProcess();
188
189 // Em options
190 //
191 G4EmProcessOptions emOptions;
192 emOptions.SetBuildCSDARange(true);
193 emOptions.SetDEDXBinningForCSDARange(8*20);
194
195 // decay process
196 //
197 AddDecay();
198
199 // step limitation (as a full process)
200 //
201 AddStepMax();
202}
203
204//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
205
206void PhysicsList::AddPhysicsList(const G4String& name)
207{
208 if (verboseLevel>-1) {
209 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
210 }
211
212 if (name == emName) return;
213
214 if (name == "local") {
215
216 emName = name;
217 delete emPhysicsList;
218 emPhysicsList = new PhysListEmStandard(name);
219
220 } else if (name == "emstandard_opt0") {
221
222 emName = name;
223 delete emPhysicsList;
224 emPhysicsList = new G4EmStandardPhysics();
225
226 } else if (name == "emstandard_opt1") {
227
228 emName = name;
229 delete emPhysicsList;
230 emPhysicsList = new G4EmStandardPhysics_option1();
231
232 } else if (name == "emstandard_opt2") {
233
234 emName = name;
235 delete emPhysicsList;
236 emPhysicsList = new G4EmStandardPhysics_option2();
237
238 } else if (name == "emstandard_opt3") {
239
240 emName = name;
241 delete emPhysicsList;
242 emPhysicsList = new G4EmStandardPhysics_option3();
243
244 } else if (name == "emlivermore") {
245 emName = name;
246 delete emPhysicsList;
247 emPhysicsList = new G4EmLivermorePhysics();
248
249 } else if (name == "empenelope") {
250 emName = name;
251 delete emPhysicsList;
252 emPhysicsList = new G4EmPenelopePhysics();
253
254 } else {
255
256 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
257 << " is not defined"
258 << G4endl;
259 }
260}
261
262//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
263
264#include "G4Decay.hh"
265
266void PhysicsList::AddDecay()
267{
268 // decay process
269 //
270 G4Decay* fDecayProcess = new G4Decay();
271
272 theParticleIterator->reset();
273 while( (*theParticleIterator)() ){
274 G4ParticleDefinition* particle = theParticleIterator->value();
275 G4ProcessManager* pmanager = particle->GetProcessManager();
276
277 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
278
279 pmanager ->AddProcess(fDecayProcess);
280
281 // set ordering for PostStepDoIt and AtRestDoIt
282 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
283 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
284
285 }
286 }
287}
288
289//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
290
291#include "StepMax.hh"
292
293void PhysicsList::AddStepMax()
294{
295 // Step limitation seen as a process
296 stepMaxProcess = new StepMax();
297
298 theParticleIterator->reset();
299 while ((*theParticleIterator)()){
300 G4ParticleDefinition* particle = theParticleIterator->value();
301 G4ProcessManager* pmanager = particle->GetProcessManager();
302
303 if (stepMaxProcess->IsApplicable(*particle))
304 {
305 pmanager ->AddDiscreteProcess(stepMaxProcess);
306 }
307 }
308}
309
310//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
311
312#include "G4Gamma.hh"
313#include "G4Electron.hh"
314#include "G4Positron.hh"
315
316void PhysicsList::SetCuts()
317{
318
319 if (verboseLevel >0){
320 G4cout << "PhysicsList::SetCuts:";
321 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
322 }
323
324 // set cut values for gamma at first and for e- second and next for e+,
325 // because some processes for e+/e- need cut values for gamma
326 SetCutValue(cutForGamma, "gamma");
327 SetCutValue(cutForElectron, "e-");
328 SetCutValue(cutForPositron, "e+");
329
330 if (verboseLevel>0) DumpCutValuesTable();
331}
332
333//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
334
335void PhysicsList::SetCutForGamma(G4double cut)
336{
337 cutForGamma = cut;
338 SetParticleCuts(cutForGamma, G4Gamma::Gamma());
339}
340
341//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
342
343void PhysicsList::SetCutForElectron(G4double cut)
344{
345 cutForElectron = cut;
346 SetParticleCuts(cutForElectron, G4Electron::Electron());
347}
348
349//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
350
351void PhysicsList::SetCutForPositron(G4double cut)
352{
353 cutForPositron = cut;
354 SetParticleCuts(cutForPositron, G4Positron::Positron());
355}
356
357//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
358
Note: See TracBrowser for help on using the repository browser.