Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/advanced/microbeam/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 // 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 
178  theParticleIterator->reset();
179  while ((*theParticleIterator)()){
180  G4ParticleDefinition* particle = theParticleIterator->value();
181  G4ProcessManager* pmanager = particle->GetProcessManager();
182 
183  if (fStepMaxProcess->IsApplicable(*particle) && pmanager)
184  {
185  pmanager ->AddDiscreteProcess(fStepMaxProcess);
186  }
187  }
188 }
189 
190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
191 
193 {
194 
195  if (verboseLevel >0){
196  G4cout << "PhysicsList::SetCuts:";
197  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
198  }
199 
200  SetCutValue(fCutForGamma, "gamma");
201  SetCutValue(fCutForElectron, "e-");
202  SetCutValue(fCutForPositron, "e+");
203 
205 }
206 
207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
208 
210 {
211  fCutForGamma = cut;
212  SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
213 }
214 
215 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
216 
218 {
219  fCutForElectron = cut;
220  SetParticleCuts(fCutForElectron, G4Electron::Electron());
221 }
222 
223 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
224 
226 {
227  fCutForPositron = cut;
228  SetParticleCuts(fCutForPositron, G4Positron::Positron());
229 }
230 
231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
232 
static G4LossTableManager * Instance()
void SetCutValue(G4double aCut, const G4String &pname)
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
const XML_Char * name
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4ProcessManager * GetProcessManager() const
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
static G4Positron * Positron()
Definition: G4Positron.cc:94
virtual void ConstructProcess()=0
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
int micrometer
Definition: hepunit.py:34
#define theParticleIterator
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4VProcess.hh:205