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 //
26 // This example is provided by the Geant4-DNA collaboration
27 // Any report or published results obtained using the Geant4-DNA software
28 // shall cite the following Geant4-DNA collaboration publication:
29 // Med. Phys. 37 (2010) 4692-4708
30 // The Geant4-DNA web site is available at http://geant4-dna.org
31 //
32 // If you use this example, please cite the following publication:
33 // Rad. Prot. Dos. 133 (2009) 2-11
34 
35 #include "PhysicsList.hh"
36 #include "PhysicsListMessenger.hh"
37 
38 #include "G4SystemOfUnits.hh"
39 #include "G4StepLimiter.hh"
40 
41 #include "G4EmStandardPhysics.hh"
46 #include "G4EmLivermorePhysics.hh"
47 #include "G4EmPenelopePhysics.hh"
48 #include "G4DecayPhysics.hh"
49 #include "G4LossTableManager.hh"
50 
51 #include "G4ProcessManager.hh"
52 
53 #include "G4Gamma.hh"
54 #include "G4Electron.hh"
55 #include "G4Positron.hh"
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60 {
63  fCutForGamma = defaultCutValue;
64  fCutForElectron = defaultCutValue;
65  fCutForPositron = defaultCutValue;
66 
67  fMessenger = new PhysicsListMessenger(this);
68 
69  SetVerboseLevel(1);
70 
71  // EM physics
72  fEmName = G4String("emlivermore");
73 
74  fEmPhysicsList = new G4EmLivermorePhysics();
75 
76  // Deacy physics and all particles
77  fDecPhysicsList = new G4DecayPhysics();
78 }
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
81 
83 {
84  delete fMessenger;
85  delete fEmPhysicsList;
86  delete fDecPhysicsList;
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
90 
92 {
93  fDecPhysicsList->ConstructParticle();
94 }
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97 
99 {
100  // transportation
102 
103  // electromagnetic physics list
104  fEmPhysicsList->ConstructProcess();
105 
106  // decay physics list
107  fDecPhysicsList->ConstructProcess();
108 
109  // step limitation (as a full process)
110  AddStepMax();
111 
112 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115 
117 {
118  if (verboseLevel>1) {
119  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
120  }
121 
122  if (name == fEmName) return;
123 
124  if (name == "emstandard_opt0") {
125 
126  fEmName = name;
127  delete fEmPhysicsList;
128  fEmPhysicsList = new G4EmStandardPhysics(1);
129 
130  } else if (name == "emstandard_opt1") {
131 
132  fEmName = name;
133  delete fEmPhysicsList;
134  fEmPhysicsList = new G4EmStandardPhysics_option1();
135 
136  } else if (name == "emstandard_opt2") {
137 
138  fEmName = name;
139  delete fEmPhysicsList;
140  fEmPhysicsList = new G4EmStandardPhysics_option2();
141 
142  } else if (name == "emstandard_opt3") {
143 
144  fEmName = name;
145  delete fEmPhysicsList;
146  fEmPhysicsList = new G4EmStandardPhysics_option3();
147 
148  } else if (name == "emstandard_opt4") {
149 
150  fEmName = name;
151  delete fEmPhysicsList;
152  fEmPhysicsList = new G4EmStandardPhysics_option4();
153 
154  } else if (name == "emlivermore") {
155 
156  fEmName = name;
157  delete fEmPhysicsList;
158  fEmPhysicsList = new G4EmLivermorePhysics();
159 
160  } else if (name == "empenelope") {
161 
162  fEmName = name;
163  delete fEmPhysicsList;
164  fEmPhysicsList = new G4EmPenelopePhysics();
165 
166  }
167 }
168 
169 
170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
171 
173 {
174  // Step limitation seen as a process
175 
176  fStepMaxProcess = new G4StepLimiter();
177 
179 
180  particleIterator->reset();
181 
182  while ((*particleIterator)()){
183  G4ParticleDefinition* particle = particleIterator->value();
184  G4ProcessManager* pmanager = particle->GetProcessManager();
185 
186  if (fStepMaxProcess->IsApplicable(*particle) && pmanager)
187  {
188  pmanager ->AddDiscreteProcess(fStepMaxProcess);
189  }
190  }
191 }
192 
193 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
194 
196 {
197 
198  if (verboseLevel >0){
199  G4cout << "PhysicsList::SetCuts:";
200  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
201  }
202 
203  SetCutValue(fCutForGamma, "gamma");
204  SetCutValue(fCutForElectron, "e-");
205  SetCutValue(fCutForPositron, "e+");
206 
208 }
209 
210 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
211 
213 {
214  fCutForGamma = cut;
215  SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
216 }
217 
218 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
219 
221 {
222  fCutForElectron = cut;
223  SetParticleCuts(fCutForElectron, G4Electron::Electron());
224 }
225 
226 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
227 
229 {
230  fCutForPositron = cut;
231  SetParticleCuts(fCutForPositron, G4Positron::Positron());
232 }
233 
234 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
235 
const XML_Char * name
Definition: expat.h:151
void ConstructParticle()
Definition: PhysicsList.cc:117
static G4LossTableManager * Instance()
void SetCutValue(G4double aCut, const G4String &pname)
void SetCutForGamma(G4double)
Definition: PhysicsList.cc:231
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
void SetCutForPositron(G4double)
Definition: PhysicsList.cc:247
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetCutForElectron(G4double)
Definition: PhysicsList.cc:239
void AddPhysicsList(const G4String &name)
Definition: PhysicsList.cc:191
virtual void ConstructParticle()=0
void SetParticleCuts(G4double cut, G4ParticleDefinition *particle, G4Region *region=0)
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
void SetVerboseLevel(G4int value)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
void SetCuts()
Definition: PhysicsList.cc:219
void AddStepMax()
Definition: PhysicsList.cc:172
static G4Positron * Positron()
Definition: G4Positron.cc:94
G4ProcessManager * GetProcessManager() const
virtual void ConstructProcess()=0
std::vector< G4InuclElementaryParticle >::iterator particleIterator
Definition: G4BigBanger.cc:65
static G4Electron * Electron()
Definition: G4Electron.cc:94
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void ConstructProcess()
Definition: PhysicsList.cc:170
static constexpr double micrometer
Definition: G4SIunits.hh:100
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4VProcess.hh:205