Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
28 //
29 // $Id: PhysicsList.cc 100286 2016-10-17 08:43:45Z 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 "PhysListEmStandardSSM.hh"
39 
40 #include "G4EmStandardPhysics.hh"
46 #include "G4EmStandardPhysicsGS.hh"
47 #include "G4EmStandardPhysicsSS.hh"
48 
49 #include "G4EmLivermorePhysics.hh"
50 #include "G4EmPenelopePhysics.hh"
51 #include "G4EmLowEPPhysics.hh"
52 
54 
55 #include "G4Decay.hh"
56 #include "StepMax.hh"
57 
58 #include "G4LossTableManager.hh"
59 
60 #include "G4UnitsTable.hh"
61 #include "G4SystemOfUnits.hh"
62 
63 #include "G4ParticleDefinition.hh"
64 #include "G4ProcessManager.hh"
65 
66 // particles
67 
68 #include "G4BosonConstructor.hh"
69 #include "G4LeptonConstructor.hh"
70 #include "G4MesonConstructor.hh"
71 #include "G4BosonConstructor.hh"
72 #include "G4BaryonConstructor.hh"
73 #include "G4IonConstructor.hh"
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77 
79  fHadPhysicsList(nullptr)
80 {
81  fMessenger = new PhysicsListMessenger(this);
82  SetVerboseLevel(1);
83 
84  // EM physics
85  fEmName = G4String("local");
86  fEmPhysicsList = new PhysListEmStandard(fEmName);
87 
90 }
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93 
95 {
96  delete fEmPhysicsList;
97  delete fMessenger;
98 }
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101 
103 {
104  G4BosonConstructor pBosonConstructor;
105  pBosonConstructor.ConstructParticle();
106 
107  G4LeptonConstructor pLeptonConstructor;
108  pLeptonConstructor.ConstructParticle();
109 
110  G4MesonConstructor pMesonConstructor;
111  pMesonConstructor.ConstructParticle();
112 
113  G4BaryonConstructor pBaryonConstructor;
114  pBaryonConstructor.ConstructParticle();
115 
116  G4IonConstructor pIonConstructor;
117  pIonConstructor.ConstructParticle();
118 
119  G4ShortLivedConstructor sLivedConstructor;
120  sLivedConstructor.ConstructParticle();
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
124 
126 {
128  fEmPhysicsList->ConstructProcess();
129  if(fHadPhysicsList) { fHadPhysicsList->ConstructProcess(); }
130  AddDecay();
131  AddStepMax();
132 }
133 
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135 
137 {
138  // Add Decay Process
139 
140  G4Decay* fDecayProcess = new G4Decay();
141 
143  particleIterator->reset();
144  while( (*particleIterator)() ){
145  G4ParticleDefinition* particle = particleIterator->value();
146  G4ProcessManager* pmanager = particle->GetProcessManager();
147 
148  if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
149 
150  pmanager ->AddProcess(fDecayProcess);
151 
152  // set ordering for PostStepDoIt and AtRestDoIt
153  pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
154  pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
155 
156  }
157  }
158 }
159 
160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
161 
163 {
164  // Step limitation seen as a process
165  StepMax* stepMaxProcess = new StepMax();
166 
168  particleIterator->reset();
169  while ((*particleIterator)()){
170  G4ParticleDefinition* particle = particleIterator->value();
171  G4ProcessManager* pmanager = particle->GetProcessManager();
172 
173  if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
174  {
175  pmanager ->AddDiscreteProcess(stepMaxProcess);
176  }
177  }
178 }
179 
180 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
181 
183 {
184  if (verboseLevel>-1) {
185  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
186  }
187 
188  if (name == fEmName) return;
189 
190  if (name == "local") {
191 
192  fEmName = name;
193  delete fEmPhysicsList;
194  fEmPhysicsList = new PhysListEmStandard(name);
195 
196  } else if (name == "emstandard_opt0") {
197 
198  fEmName = name;
199  delete fEmPhysicsList;
200  fEmPhysicsList = new G4EmStandardPhysics();
201 
202  } else if (name == "emstandard_opt1") {
203 
204  fEmName = name;
205  delete fEmPhysicsList;
206  fEmPhysicsList = new G4EmStandardPhysics_option1();
207 
208  } else if (name == "emstandard_opt2") {
209 
210  fEmName = name;
211  delete fEmPhysicsList;
212  fEmPhysicsList = new G4EmStandardPhysics_option2();
213 
214  } else if (name == "emstandard_opt3") {
215 
216  fEmName = name;
217  delete fEmPhysicsList;
218  fEmPhysicsList = new G4EmStandardPhysics_option3();
219 
220  } else if (name == "emstandard_opt4") {
221 
222  fEmName = name;
223  delete fEmPhysicsList;
224  fEmPhysicsList = new G4EmStandardPhysics_option4();
225 
226  } else if (name == "emstandardSS") {
227 
228  fEmName = name;
229  delete fEmPhysicsList;
230  fEmPhysicsList = new G4EmStandardPhysicsSS();
231 
232  } else if (name == "standardSSM") {
233 
234  fEmName = name;
235  delete fEmPhysicsList;
236  fEmPhysicsList = new PhysListEmStandardSSM();
237 
238  } else if (name == "emstandardWVI") {
239 
240  fEmName = name;
241  delete fEmPhysicsList;
242  fEmPhysicsList = new G4EmStandardPhysicsWVI();
243 
244  } else if (name == "standardGS") {
245 
246  fEmName = name;
247  delete fEmPhysicsList;
248  fEmPhysicsList = new G4EmStandardPhysicsGS();
249 
250  } else if (name == "empenelope") {
251  fEmName = name;
252  delete fEmPhysicsList;
253  fEmPhysicsList = new G4EmPenelopePhysics();
254 
255  } else if (name == "emlowenergy") {
256  fEmName = name;
257  delete fEmPhysicsList;
258  fEmPhysicsList = new G4EmLowEPPhysics();
259 
260  } else if (name == "emlivermore") {
261  fEmName = name;
262  delete fEmPhysicsList;
263  fEmPhysicsList = new G4EmLivermorePhysics();
264 
265  } else if (name == "had_elastic" && !fHadPhysicsList) {
266  fHadPhysicsList = new G4HadronElasticPhysics();
267 
268  } else {
269 
270  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
271  << " is not defined"
272  << G4endl;
273  }
274 }
275 
276 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetDefaultCutValue(G4double newCutValue)
const XML_Char * name
Definition: expat.h:151
void ConstructParticle()
Definition: PhysicsList.cc:117
static G4LossTableManager * Instance()
static constexpr double mm
Definition: G4SIunits.hh:115
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4Decay.cc:89
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
static void ConstructParticle()
static void ConstructParticle()
void AddPhysicsList(const G4String &name)
Definition: PhysicsList.cc:191
static void ConstructParticle()
G4GLOB_DLL std::ostream G4cout
static void ConstructParticle()
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
void SetVerboseLevel(G4int value)
static void ConstructParticle()
void AddStepMax()
Definition: PhysicsList.cc:172
G4ProcessManager * GetProcessManager() const
void AddDecay()
Definition: PhysicsList.cc:222
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: StepMax.cc:51
virtual void ConstructProcess()=0
std::vector< G4InuclElementaryParticle >::iterator particleIterator
Definition: G4BigBanger.cc:65
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
#define G4endl
Definition: G4ios.hh:61
void ConstructProcess()
Definition: PhysicsList.cc:170