Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/electromagnetic/TestEm11/src/PhysicsList.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 //
26 /// \file electromagnetic/TestEm11/src/PhysicsList.cc
27 /// \brief Implementation of the PhysicsList class
28 //
29 // $Id: PhysicsList.cc 74997 2013-10-25 10:52:13Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "PhysicsList.hh"
35 #include "PhysicsListMessenger.hh"
36 
37 #include "PhysListEmStandard.hh"
38 #include "PhysListEmStandardSS.hh"
39 
40 #include "G4EmStandardPhysics.hh"
45 #include "G4EmLivermorePhysics.hh"
46 #include "G4EmPenelopePhysics.hh"
47 
48 #include "G4LossTableManager.hh"
49 #include "G4UnitsTable.hh"
50 #include "G4SystemOfUnits.hh"
51 
52 G4ThreadLocal StepMax* PhysicsList::fStepMaxProcess = 0;
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
57  fEmPhysicsList(0),
58  fMessenger(0)
59 {
61  defaultCutValue = 1.*mm;
62  fCutForGamma = defaultCutValue;
63  fCutForElectron = defaultCutValue;
64  fCutForPositron = defaultCutValue;
65 
66  fMessenger = new PhysicsListMessenger(this);
67 
68  SetVerboseLevel(1);
69 
70  // EM physics
71  fEmPhysicsList = new PhysListEmStandard(fEmName = "local");
72 
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78 {
79  delete fMessenger;
80  delete fEmPhysicsList;
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84 
85 // Bosons
86 #include "G4ChargedGeantino.hh"
87 #include "G4Geantino.hh"
88 #include "G4Gamma.hh"
89 #include "G4OpticalPhoton.hh"
90 
91 // leptons
92 #include "G4MuonPlus.hh"
93 #include "G4MuonMinus.hh"
94 #include "G4NeutrinoMu.hh"
95 #include "G4AntiNeutrinoMu.hh"
96 
97 #include "G4Electron.hh"
98 #include "G4Positron.hh"
99 #include "G4NeutrinoE.hh"
100 #include "G4AntiNeutrinoE.hh"
101 
102 // Mesons
103 #include "G4PionPlus.hh"
104 #include "G4PionMinus.hh"
105 #include "G4PionZero.hh"
106 #include "G4Eta.hh"
107 #include "G4EtaPrime.hh"
108 
109 #include "G4KaonPlus.hh"
110 #include "G4KaonMinus.hh"
111 #include "G4KaonZero.hh"
112 #include "G4AntiKaonZero.hh"
113 #include "G4KaonZeroLong.hh"
114 #include "G4KaonZeroShort.hh"
115 
116 // Baryons
117 #include "G4Proton.hh"
118 #include "G4AntiProton.hh"
119 #include "G4Neutron.hh"
120 #include "G4AntiNeutron.hh"
121 
122 // Nuclei
123 #include "G4Alpha.hh"
124 #include "G4Deuteron.hh"
125 #include "G4Triton.hh"
126 #include "G4He3.hh"
127 #include "G4GenericIon.hh"
128 
129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130 
132 {
133 // pseudo-particles
136 
137 // gamma
139 
140 // optical photon
142 
143 // leptons
148 
153 
154 // mesons
166 
167 // barions
172 
173 // ions
179 }
180 
181 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
182 
183 #include "G4ProcessManager.hh"
184 #include "G4EmProcessOptions.hh"
185 
187 {
188  // transportation
189  //
191 
192  // electromagnetic physics list
193  //
194  fEmPhysicsList->ConstructProcess();
195 
196  // Em options
197  //
198  G4EmProcessOptions emOptions;
199  emOptions.SetBuildCSDARange(true);
200  emOptions.SetDEDXBinningForCSDARange(8*10);
201 
202  // decay process
203  //
204  AddDecay();
205 
206  // step limitation (as a full process)
207  //
208  AddStepMax();
209 }
210 
211 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
212 
214 {
215  if (verboseLevel>-1) {
216  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
217  }
218 
219  if (name == fEmName) return;
220 
221  if (name == "local") {
222 
223  fEmName = name;
224  delete fEmPhysicsList;
225  fEmPhysicsList = new PhysListEmStandard(name);
226 
227  } else if (name == "emstandard_opt0") {
228 
229  fEmName = name;
230  delete fEmPhysicsList;
231  fEmPhysicsList = new G4EmStandardPhysics();
232 
233  } else if (name == "emstandard_opt1") {
234 
235  fEmName = name;
236  delete fEmPhysicsList;
237  fEmPhysicsList = new G4EmStandardPhysics_option1();
238 
239  } else if (name == "emstandard_opt2") {
240 
241  fEmName = name;
242  delete fEmPhysicsList;
243  fEmPhysicsList = new G4EmStandardPhysics_option2();
244 
245  } else if (name == "emstandard_opt3") {
246 
247  fEmName = name;
248  delete fEmPhysicsList;
249  fEmPhysicsList = new G4EmStandardPhysics_option3();
250 
251  } else if (name == "emstandard_opt4") {
252 
253  fEmName = name;
254  delete fEmPhysicsList;
255  fEmPhysicsList = new G4EmStandardPhysics_option4();
256 
257  } else if (name == "standardSS") {
258 
259  fEmName = name;
260  delete fEmPhysicsList;
261  fEmPhysicsList = new PhysListEmStandardSS(name);
262 
263  } else if (name == "emlivermore") {
264  fEmName = name;
265  delete fEmPhysicsList;
266  fEmPhysicsList = new G4EmLivermorePhysics();
267 
268  } else if (name == "empenelope") {
269  fEmName = name;
270  delete fEmPhysicsList;
271  fEmPhysicsList = new G4EmPenelopePhysics();
272 
273  } else {
274 
275  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
276  << " is not defined"
277  << G4endl;
278  }
279 }
280 
281 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
282 
283 #include "G4Decay.hh"
284 
286 {
287  // decay process
288  //
289  G4Decay* fDecayProcess = new G4Decay();
290 
291  theParticleIterator->reset();
292  while( (*theParticleIterator)() ){
293  G4ParticleDefinition* particle = theParticleIterator->value();
294  G4ProcessManager* pmanager = particle->GetProcessManager();
295 
296  if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
297 
298  pmanager ->AddProcess(fDecayProcess);
299 
300  // set ordering for PostStepDoIt and AtRestDoIt
301  pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
302  pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
303 
304  }
305  }
306 }
307 
308 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
309 
310 #include "StepMax.hh"
311 
313 {
314  // Step limitation seen as a process
315  fStepMaxProcess = new StepMax();
316 
317  theParticleIterator->reset();
318  while ((*theParticleIterator)()){
319  G4ParticleDefinition* particle = theParticleIterator->value();
320  G4ProcessManager* pmanager = particle->GetProcessManager();
321 
322  if (fStepMaxProcess->IsApplicable(*particle))
323  {
324  pmanager ->AddDiscreteProcess(fStepMaxProcess);
325  }
326  }
327 }
328 
329 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
330 
331 #include "G4Gamma.hh"
332 #include "G4Electron.hh"
333 #include "G4Positron.hh"
334 
336 {
337  if (verboseLevel >0) {
338  G4cout << "PhysicsList::SetCuts:";
339  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
340  }
341 
342  // set cut values for gamma at first and for e- second and next for e+,
343  // because some processes for e+/e- need cut values for gamma
344  SetCutValue(fCutForGamma, "gamma");
345  SetCutValue(fCutForElectron, "e-");
346  SetCutValue(fCutForPositron, "e+");
347 
349 }
350 
351 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
352 
354 {
355  fCutForGamma = cut;
356  SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
357 }
358 
359 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
360 
362 {
363  fCutForElectron = cut;
364  SetParticleCuts(fCutForElectron, G4Electron::Electron());
365 }
366 
367 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
368 
370 {
371  fCutForPositron = cut;
372  SetParticleCuts(fCutForPositron, G4Positron::Positron());
373 }
374 
375 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
376 
static G4Geantino * GeantinoDefinition()
Definition: G4Geantino.cc:82
static G4Electron * ElectronDefinition()
Definition: G4Electron.cc:89
static G4Triton * TritonDefinition()
Definition: G4Triton.cc:90
static G4KaonPlus * KaonPlusDefinition()
Definition: G4KaonPlus.cc:108
static G4GenericIon * GenericIonDefinition()
Definition: G4GenericIon.cc:88
static G4He3 * He3Definition()
Definition: G4He3.cc:89
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:94
static G4LossTableManager * Instance()
void SetCutValue(G4double aCut, const G4String &pname)
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4Decay.cc:89
static G4KaonMinus * KaonMinusDefinition()
Definition: G4KaonMinus.cc:108
static G4Proton * ProtonDefinition()
Definition: G4Proton.cc:88
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
const XML_Char * name
static G4KaonZero * KaonZeroDefinition()
Definition: G4KaonZero.cc:99
static G4AntiKaonZero * AntiKaonZeroDefinition()
static G4KaonZeroShort * KaonZeroShortDefinition()
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetDEDXBinningForCSDARange(G4int val)
#define G4ThreadLocal
Definition: tls.hh:52
static G4AntiProton * AntiProtonDefinition()
Definition: G4AntiProton.cc:88
G4ProcessManager * GetProcessManager() const
static G4AntiNeutron * AntiNeutronDefinition()
static G4PionZero * PionZeroDefinition()
Definition: G4PionZero.cc:99
void SetParticleCuts(G4double cut, G4ParticleDefinition *particle, G4Region *region=0)
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
static G4PionMinus * PionMinusDefinition()
Definition: G4PionMinus.cc:93
static G4KaonZeroLong * KaonZeroLongDefinition()
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
static G4NeutrinoE * NeutrinoEDefinition()
Definition: G4NeutrinoE.cc:80
static G4AntiNeutrinoMu * AntiNeutrinoMuDefinition()
static G4PionPlus * PionPlusDefinition()
Definition: G4PionPlus.cc:93
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
void SetVerboseLevel(G4int value)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
static G4Positron * PositronDefinition()
Definition: G4Positron.cc:89
static G4EtaPrime * EtaPrimeDefinition()
Definition: G4EtaPrime.cc:100
static G4Positron * Positron()
Definition: G4Positron.cc:94
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:95
virtual void ConstructProcess()=0
void SetBuildCSDARange(G4bool val)
static G4ChargedGeantino * ChargedGeantinoDefinition()
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
static G4AntiNeutrinoE * AntiNeutrinoEDefinition()
static G4OpticalPhoton * OpticalPhotonDefinition()
double G4double
Definition: G4Types.hh:76
static G4NeutrinoMu * NeutrinoMuDefinition()
Definition: G4NeutrinoMu.cc:80
static G4Deuteron * DeuteronDefinition()
Definition: G4Deuteron.cc:89
static G4Alpha * AlphaDefinition()
Definition: G4Alpha.cc:84
static G4Neutron * NeutronDefinition()
Definition: G4Neutron.cc:99
#define theParticleIterator
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4VProcess.hh:205
static G4Eta * EtaDefinition()
Definition: G4Eta.cc:104
static G4Gamma * GammaDefinition()
Definition: G4Gamma.cc:81