Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/electromagnetic/TestEm5/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/TestEm5/src/PhysicsList.cc
27 /// \brief Implementation of the PhysicsList class
28 //
29 // $Id: PhysicsList.cc 76464 2013-11-11 10:22:56Z 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 #include "PhysListEmStandardSSM.hh"
40 #include "PhysListEmStandardGS.hh"
41 #include "PhysListEmStandardWVI.hh"
42 
43 #include "G4EmStandardPhysics.hh"
48 #include "G4EmLivermorePhysics.hh"
49 #include "G4EmPenelopePhysics.hh"
50 
51 #include "G4Decay.hh"
52 #include "StepMax.hh"
53 
54 #include "G4UnitsTable.hh"
55 #include "G4SystemOfUnits.hh"
56 
57 #include "G4ParticleDefinition.hh"
58 #include "G4ProcessManager.hh"
59 
60 // Bosons
61 #include "G4ChargedGeantino.hh"
62 #include "G4Geantino.hh"
63 #include "G4Gamma.hh"
64 #include "G4OpticalPhoton.hh"
65 
66 // leptons
67 #include "G4MuonPlus.hh"
68 #include "G4MuonMinus.hh"
69 #include "G4NeutrinoMu.hh"
70 #include "G4AntiNeutrinoMu.hh"
71 
72 #include "G4Electron.hh"
73 #include "G4Positron.hh"
74 #include "G4NeutrinoE.hh"
75 #include "G4AntiNeutrinoE.hh"
76 
77 // Hadrons
78 #include "G4MesonConstructor.hh"
79 #include "G4BaryonConstructor.hh"
80 #include "G4IonConstructor.hh"
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85  fMessenger(0),fEmPhysicsList(0)
86 {
87  fMessenger = new PhysicsListMessenger(this);
88 
89  // EM physics
90  fEmName = G4String("local");
91  fEmPhysicsList = new PhysListEmStandard(fEmName);
92 
93  defaultCutValue = 1.*mm;
94 
95  fCutForGamma = defaultCutValue;
96  fCutForElectron = defaultCutValue;
97  fCutForPositron = defaultCutValue;
98 
99  SetVerboseLevel(1);
100 }
101 
102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
103 
105 {
106  delete fEmPhysicsList;
107  delete fMessenger;
108 }
109 
110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
111 
113 {
114  // pseudo-particles
117 
118  // gamma
120 
121  // leptons
126 
131 
132  // mesons
133  G4MesonConstructor mConstructor;
134  mConstructor.ConstructParticle();
135 
136  // barions
137  G4BaryonConstructor bConstructor;
138  bConstructor.ConstructParticle();
139 
140  // ions
141  G4IonConstructor iConstructor;
142  iConstructor.ConstructParticle();
143 }
144 
145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
146 
148 {
150  fEmPhysicsList->ConstructProcess();
151  AddDecay();
152  AddStepMax();
153 }
154 
155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
156 
158 {
159  // Add Decay Process
160 
161  G4Decay* fDecayProcess = new G4Decay();
162 
163  theParticleIterator->reset();
164  while( (*theParticleIterator)() ){
165  G4ParticleDefinition* particle = theParticleIterator->value();
166  G4ProcessManager* pmanager = particle->GetProcessManager();
167 
168  if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
169 
170  pmanager ->AddProcess(fDecayProcess);
171 
172  // set ordering for PostStepDoIt and AtRestDoIt
173  pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
174  pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
175 
176  }
177  }
178 }
179 
180 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
181 
183 {
184  // Step limitation seen as a process
185  StepMax* stepMaxProcess = new StepMax();
186 
187  theParticleIterator->reset();
188  while ((*theParticleIterator)()){
189  G4ParticleDefinition* particle = theParticleIterator->value();
190  G4ProcessManager* pmanager = particle->GetProcessManager();
191 
192  if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
193  {
194  pmanager ->AddDiscreteProcess(stepMaxProcess);
195  }
196  }
197 }
198 
199 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
200 
202 {
203  if (verboseLevel>-1) {
204  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
205  }
206 
207  if (name == fEmName) return;
208 
209  if (name == "local") {
210 
211  fEmName = name;
212  delete fEmPhysicsList;
213  fEmPhysicsList = new PhysListEmStandard(name);
214 
215  } else if (name == "emstandard_opt0") {
216 
217  fEmName = name;
218  delete fEmPhysicsList;
219  fEmPhysicsList = new G4EmStandardPhysics();
220 
221  } else if (name == "emstandard_opt1") {
222 
223  fEmName = name;
224  delete fEmPhysicsList;
225  fEmPhysicsList = new G4EmStandardPhysics_option1();
226 
227  } else if (name == "emstandard_opt2") {
228 
229  fEmName = name;
230  delete fEmPhysicsList;
231  fEmPhysicsList = new G4EmStandardPhysics_option2();
232 
233  } else if (name == "emstandard_opt3") {
234 
235  fEmName = name;
236  delete fEmPhysicsList;
237  fEmPhysicsList = new G4EmStandardPhysics_option3();
238 
239  } else if (name == "emstandard_opt4") {
240 
241  fEmName = name;
242  delete fEmPhysicsList;
243  fEmPhysicsList = new G4EmStandardPhysics_option4();
244 
245  } else if (name == "standardSS") {
246 
247  fEmName = name;
248  delete fEmPhysicsList;
249  fEmPhysicsList = new PhysListEmStandardSS(name);
250 
251  } else if (name == "standardSSM") {
252 
253  fEmName = name;
254  delete fEmPhysicsList;
255  fEmPhysicsList = new PhysListEmStandardSSM(name);
256 
257  } else if (name == "standardWVI") {
258 
259  fEmName = name;
260  delete fEmPhysicsList;
261  fEmPhysicsList = new PhysListEmStandardWVI(name);
262 
263  } else if (name == "standardGS") {
264 
265  fEmName = name;
266  delete fEmPhysicsList;
267  fEmPhysicsList = new PhysListEmStandardGS(name);
268 
269  } else if (name == "empenelope"){
270  fEmName = name;
271  delete fEmPhysicsList;
272  fEmPhysicsList = new G4EmPenelopePhysics();
273 
274  } else if (name == "emlivermore"){
275  fEmName = name;
276  delete fEmPhysicsList;
277  fEmPhysicsList = new G4EmLivermorePhysics();
278 
279  } else {
280 
281  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
282  << " is not defined"
283  << G4endl;
284  }
285 }
286 
287 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
288 
290 {
291  if (verboseLevel >0) {
292  G4cout << "PhysicsList::SetCuts:";
293  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
294  }
295 
296  // fixe lower limit for cut
297  ///G4ProductionCutsTable::GetProductionCutsTable()
298  /// ->SetEnergyRange(10*eV, 1*GeV);
299 
300  // set cut values for gamma at first and for e- second and next for e+,
301  // because some processes for e+/e- need cut values for gamma
302  SetCutValue(fCutForGamma, "gamma");
303  SetCutValue(fCutForElectron, "e-");
304  SetCutValue(fCutForPositron, "e+");
305 
307 }
308 
309 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
310 
312 {
313  fCutForGamma = cut;
314  SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
315 }
316 
317 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
318 
320 {
321  fCutForElectron = cut;
322  SetParticleCuts(fCutForElectron, G4Electron::Electron());
323 }
324 
325 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
326 
328 {
329  fCutForPositron = cut;
330  SetParticleCuts(fCutForPositron, G4Positron::Positron());
331 }
332 
333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4Geantino * GeantinoDefinition()
Definition: G4Geantino.cc:82
static G4Electron * ElectronDefinition()
Definition: G4Electron.cc:89
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:94
void SetCutValue(G4double aCut, const G4String &pname)
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4Decay.cc:89
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
const XML_Char * name
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static void ConstructParticle()
static void ConstructParticle()
G4ProcessManager * GetProcessManager() const
static void ConstructParticle()
void SetParticleCuts(G4double cut, G4ParticleDefinition *particle, G4Region *region=0)
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
static G4NeutrinoE * NeutrinoEDefinition()
Definition: G4NeutrinoE.cc:80
static G4AntiNeutrinoMu * AntiNeutrinoMuDefinition()
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 G4Positron * Positron()
Definition: G4Positron.cc:94
virtual G4bool IsApplicable(const G4ParticleDefinition &)
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:95
virtual void ConstructProcess()=0
static G4ChargedGeantino * ChargedGeantinoDefinition()
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
static G4AntiNeutrinoE * AntiNeutrinoEDefinition()
double G4double
Definition: G4Types.hh:76
static G4NeutrinoMu * NeutrinoMuDefinition()
Definition: G4NeutrinoMu.cc:80
#define theParticleIterator
static G4Gamma * GammaDefinition()
Definition: G4Gamma.cc:81