Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/medical/electronScattering2/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 // $Id: PhysicsList.cc 75702 2013-11-05 13:08:48Z gcosmo $
27 //
28 /// \file medical/electronScattering2/src/PhysicsList.cc
29 /// \brief Implementation of the PhysicsList class
30 
31 #include "PhysicsList.hh"
32 #include "PhysicsListMessenger.hh"
33 
34 #include "PhysListEmStandard.hh"
35 #include "PhysListEmStandardSS.hh"
36 #include "PhysListEmStandardGS.hh"
37 #include "PhysListEmStandardWVI.hh"
38 
39 #include "G4EmStandardPhysics.hh"
43 
44 #include "G4UnitsTable.hh"
45 
46 #include "G4ParticleDefinition.hh"
47 #include "G4ProcessManager.hh"
48 
49 // Bosons
50 #include "G4ChargedGeantino.hh"
51 #include "G4Geantino.hh"
52 #include "G4Gamma.hh"
53 #include "G4OpticalPhoton.hh"
54 
55 // leptons
56 #include "G4MuonPlus.hh"
57 #include "G4MuonMinus.hh"
58 #include "G4NeutrinoMu.hh"
59 #include "G4AntiNeutrinoMu.hh"
60 
61 #include "G4Electron.hh"
62 #include "G4Positron.hh"
63 #include "G4NeutrinoE.hh"
64 #include "G4AntiNeutrinoE.hh"
65 
66 // Hadrons
67 #include "G4MesonConstructor.hh"
68 #include "G4BaryonConstructor.hh"
69 #include "G4IonConstructor.hh"
70 #include "G4GenericIon.hh"
71 
72 #include "G4SystemOfUnits.hh"
73 
74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75 
77 : G4VModularPhysicsList(), fMessenger(0), fEmPhysicsList(0)
78 {
79  fMessenger = new PhysicsListMessenger(this);
80 
81  // EM physics
82  fEmName = G4String("local");
83  fEmPhysicsList = new PhysListEmStandard(fEmName);
84 
85  defaultCutValue = 1.*mm;
86  fCutForGamma = defaultCutValue;
87  fCutForElectron = defaultCutValue;
88  fCutForPositron = defaultCutValue;
89 
90  SetVerboseLevel(1);
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
96 {
97  delete fEmPhysicsList;
98  delete fMessenger;
99 }
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102 
104 {
105  // pseudo-particles
108 
109  // gamma
111 
112  // optical photon
114 
115  // leptons
120 
125 
126  // mesons
127  G4MesonConstructor mConstructor;
128  mConstructor.ConstructParticle();
129 
130  // barions
131  G4BaryonConstructor bConstructor;
132  bConstructor.ConstructParticle();
133 
134  // ions
135  G4IonConstructor iConstructor;
136  iConstructor.ConstructParticle();
137 
138  // Required by MT even if ion physics not used
140 }
141 
142 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
143 
145 {
147  fEmPhysicsList->ConstructProcess();
148  AddDecay();
149  AddStepMax();
150 }
151 
152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
153 
154 #include "G4Decay.hh"
155 
157 {
158  // Add Decay Process
159 
160  G4Decay* fDecayProcess = new G4Decay();
161 
162  theParticleIterator->reset();
163  while( (*theParticleIterator)() ){
164  G4ParticleDefinition* particle = theParticleIterator->value();
165  G4ProcessManager* pmanager = particle->GetProcessManager();
166 
167  if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
168 
169  pmanager ->AddProcess(fDecayProcess);
170 
171  // set ordering for PostStepDoIt and AtRestDoIt
172  pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
173  pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
174 
175  }
176  }
177 }
178 
179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
180 
181 #include "StepMax.hh"
182 
184 {
185  // Step limitation seen as a process
186  StepMax* stepMaxProcess = new StepMax();
187 
188  theParticleIterator->reset();
189  while ((*theParticleIterator)()){
190  G4ParticleDefinition* particle = theParticleIterator->value();
191  G4ProcessManager* pmanager = particle->GetProcessManager();
192 
193  if (stepMaxProcess->IsApplicable(*particle))
194  {
195  pmanager ->AddDiscreteProcess(stepMaxProcess);
196  }
197  }
198 }
199 
200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
201 
203 {
204  if (verboseLevel>-1) {
205  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
206  }
207 
208  if (name == fEmName) return;
209 
210  if (name == "local") {
211 
212  fEmName = name;
213  delete fEmPhysicsList;
214  fEmPhysicsList = new PhysListEmStandard(name);
215 
216  } else if (name == "emstandard_opt0") {
217 
218  fEmName = name;
219  delete fEmPhysicsList;
220  fEmPhysicsList = new G4EmStandardPhysics();
221 
222  } else if (name == "emstandard_opt1") {
223 
224  fEmName = name;
225  delete fEmPhysicsList;
226  fEmPhysicsList = new G4EmStandardPhysics_option1();
227 
228  } else if (name == "emstandard_opt2") {
229 
230  fEmName = name;
231  delete fEmPhysicsList;
232  fEmPhysicsList = new G4EmStandardPhysics_option2();
233 
234  } else if (name == "emstandard_opt3") {
235 
236  fEmName = name;
237  delete fEmPhysicsList;
238  fEmPhysicsList = new G4EmStandardPhysics_option3();
239 
240  } else if (name == "standardSS") {
241 
242  fEmName = name;
243  delete fEmPhysicsList;
244  fEmPhysicsList = new PhysListEmStandardSS(name);
245 
246  } else if (name == "standardGS") {
247 
248  fEmName = name;
249  delete fEmPhysicsList;
250  fEmPhysicsList = new PhysListEmStandardGS(name);
251 
252  } else if (name == "standardWVI") {
253 
254  fEmName = name;
255  delete fEmPhysicsList;
256  fEmPhysicsList = new PhysListEmStandardWVI(name);
257 
258  } else {
259 
260  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
261  << " is not defined"
262  << G4endl;
263  exit(1);
264  }
265 }
266 
267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
268 
270 {
271 
272  if (verboseLevel >0){
273  G4cout << "PhysicsList::SetCuts:";
274  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
275  }
276 
277  // set cut values for gamma at first and for e- second and next for e+,
278  // because some processes for e+/e- need cut values for gamma
279  SetCutValue(fCutForGamma, "gamma");
280  SetCutValue(fCutForElectron, "e-");
281  SetCutValue(fCutForPositron, "e+");
282 
284 }
285 
286 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
287 
289 {
290  fCutForGamma = cut;
291  SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
292 }
293 
294 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
295 
297 {
298  fCutForElectron = cut;
299  SetParticleCuts(fCutForElectron, G4Electron::Electron());
300 }
301 
302 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
303 
305 {
306  fCutForPositron = cut;
307  SetParticleCuts(fCutForPositron, G4Positron::Positron());
308 }
309 
310 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4Geantino * GeantinoDefinition()
Definition: G4Geantino.cc:82
static G4Electron * ElectronDefinition()
Definition: G4Electron.cc:89
static G4GenericIon * GenericIonDefinition()
Definition: G4GenericIon.cc:88
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()
static G4OpticalPhoton * OpticalPhotonDefinition()
double G4double
Definition: G4Types.hh:76
static G4NeutrinoMu * NeutrinoMuDefinition()
Definition: G4NeutrinoMu.cc:80
#define theParticleIterator
static G4Gamma * GammaDefinition()
Definition: G4Gamma.cc:81