Geant4  9.6.p02
 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$
30 //
31 //---------------------------------------------------------------------------
32 //
33 // ClassName: PhysicsList
34 //
35 // Author: V.Ivanchenko 14.10.2002
36 //
37 // Modified:
38 // 17.11.06 Use components from physics_lists subdirectory (V.Ivanchenko)
39 // 24.10.12 Migrated to new stopping and ion physics (A.Ribon)
40 //
41 //----------------------------------------------------------------------------
42 //
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
47 #include "PhysicsList.hh"
48 #include "PhysicsListMessenger.hh"
49 
50 #include "PhysListEmStandard.hh"
51 #include "G4EmStandardPhysics.hh"
56 #include "G4EmLivermorePhysics.hh"
57 #include "G4EmPenelopePhysics.hh"
58 #include "G4DecayPhysics.hh"
60 #include "G4HadronInelasticQBBC.hh"
61 #include "G4IonPhysics.hh"
62 #include "G4EmExtraPhysics.hh"
63 #include "G4StoppingPhysics.hh"
64 
65 #include "G4RegionStore.hh"
66 #include "G4Region.hh"
67 #include "G4ProductionCuts.hh"
68 #include "G4ProcessManager.hh"
69 #include "G4ParticleTypes.hh"
70 #include "G4ParticleTable.hh"
71 
72 #include "G4Gamma.hh"
73 #include "G4Electron.hh"
74 #include "G4Positron.hh"
75 #include "G4Proton.hh"
76 
77 #include "G4UnitsTable.hh"
78 #include "G4SystemOfUnits.hh"
79 #include "G4LossTableManager.hh"
80 #include "StepMax.hh"
81 
82 #include "G4EmProcessOptions.hh"
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87 {
89  defaultCutValue = 1.*mm;
90  fCutForGamma = defaultCutValue;
91  fCutForElectron = defaultCutValue;
92  fCutForPositron = defaultCutValue;
93  fCutForVertexDetector = defaultCutValue;
94  fCutForMuonDetector = defaultCutValue;
95 
96  fVertexDetectorCuts = 0;
97  fMuonDetectorCuts = 0;
98 
99  fMessenger = new PhysicsListMessenger(this);
100  fStepMaxProcess = new StepMax();
101 
102  // Initilise flags
103 
104  SetVerboseLevel(1);
105 
106  fHelIsRegisted = false;
107  fBicIsRegisted = false;
108  fGnucIsRegisted = false;
109  fStopIsRegisted = false;
110 
111  // EM physics
112  fEmName = G4String("emstandard");
113  fEmPhysicsList = new G4EmStandardPhysics();
114 
115  // Decay Physics is always defined
116  fDecayPhysicsList = new G4DecayPhysics();
117 }
118 
119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120 
122 {
123  delete fMessenger;
124  delete fDecayPhysicsList;
125  delete fEmPhysicsList;
126  delete fStepMaxProcess;
127  for(size_t i=0; i<fHadronPhys.size(); i++) {
128  delete fHadronPhys[i];
129  }
130 }
131 
132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133 
135 {
136  fDecayPhysicsList->ConstructParticle();
137 }
138 
139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
140 
142 {
144  fEmPhysicsList->ConstructProcess();
145  fDecayPhysicsList->ConstructProcess();
146  for(size_t i=0; i<fHadronPhys.size(); ++i) {
147  fHadronPhys[i]->ConstructProcess();
148  }
149  AddStepMax();
150 }
151 
152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
153 
155 {
156  if (verboseLevel > 1)
157  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
158 
159  if (name == fEmName) return;
160 
161  if (name == "emstandard") {
162  fEmName = name;
163  delete fEmPhysicsList;
164  fEmPhysicsList = new G4EmStandardPhysics();
165  if (verboseLevel > 0)
166  G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
167 
168  } else if (name == "emstandard_opt1") {
169  fEmName = name;
170  delete fEmPhysicsList;
171  fEmPhysicsList = new G4EmStandardPhysics_option1();
172  if (verboseLevel > 0)
173  G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
174 
175  } else if (name == "emstandard_opt2") {
176  fEmName = name;
177  delete fEmPhysicsList;
178  fEmPhysicsList = new G4EmStandardPhysics_option2();
179  if (verboseLevel > 0)
180  G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
181 
182  } else if (name == "emstandard_opt3") {
183  fEmName = name;
184  delete fEmPhysicsList;
185  fEmPhysicsList = new G4EmStandardPhysics_option3();
186  if (verboseLevel > 0)
187  G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
188 
189  } else if (name == "emstandard_opt4") {
190  fEmName = name;
191  delete fEmPhysicsList;
192  fEmPhysicsList = new G4EmStandardPhysics_option4();
193  if (verboseLevel > 0)
194  G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
195 
196  } else if (name == "emstandard_local") {
197  fEmName = name;
198  delete fEmPhysicsList;
199  fEmPhysicsList = new PhysListEmStandard();
200  if (verboseLevel > 0)
201  G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
202 
203  } else if (name == "emlivermore") {
204  fEmName = name;
205  delete fEmPhysicsList;
206  fEmPhysicsList = new G4EmLivermorePhysics();
207 
208  } else if (name == "empenelope") {
209  fEmName = name;
210  delete fEmPhysicsList;
211  fEmPhysicsList = new G4EmPenelopePhysics();
212 
213  } else if (name == "elastic" && !fHelIsRegisted) {
214  fHadronPhys.push_back( new G4HadronElasticPhysics());
215  fHelIsRegisted = true;
216  if (verboseLevel > 0)
217  G4cout << "PhysicsList::Add hadron elastic physics" << G4endl;
218 
219  } else if (name == "binary" && !fBicIsRegisted) {
220  fHadronPhys.push_back(new G4HadronInelasticQBBC());
221  fHadronPhys.push_back(new G4IonPhysics());
222  fBicIsRegisted = true;
223  if (verboseLevel > 0)
224  G4cout << "PhysicsList::Add hadron inelastic physics from <QBBC>" << G4endl;
225 
226  } else if (name == "gamma_nuc" && !fGnucIsRegisted) {
227  fHadronPhys.push_back(new G4EmExtraPhysics());
228  fGnucIsRegisted = true;
229  if (verboseLevel > 0)
230  G4cout << "PhysicsList::Add gamma- and electro-nuclear physics" << G4endl;
231 
232  } else if (name == "stopping" && !fStopIsRegisted) {
233  fHadronPhys.push_back(new G4StoppingPhysics());
234  fStopIsRegisted = true;
235  if (verboseLevel > 0)
236  G4cout << "PhysicsList::Add stopping physics" << G4endl;
237 
238  } else {
239  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
240  << " is not defined"
241  << G4endl;
242  }
243 }
244 
245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
246 
248 {
249  // Step limitation seen as a process
250 
252  while ((*theParticleIterator)()){
254  G4ProcessManager* pmanager = particle->GetProcessManager();
255 
256  if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
257  {
258  pmanager ->AddDiscreteProcess(fStepMaxProcess);
259  }
260  }
261 }
262 
263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
264 
266 {
267  SetCutValue(fCutForGamma, "gamma", "DefaultRegionForTheWorld");
268  SetCutValue(fCutForElectron, "e-", "DefaultRegionForTheWorld");
269  SetCutValue(fCutForElectron, "e+", "DefaultRegionForTheWorld");
270  SetCutValue(fCutForProton, "proton", "DefaultRegionForTheWorld");
271  // G4cout << "PhysicsList: world cuts are set cutG= " << cutForGamma/mm
272  // << " mm cutE= " << fCutForElectron/mm << " mm " << G4endl;
273 
274  //G4cout << " cutV= " << fCutForVertexDetector
275  // << " cutM= " << fCutForMuonDetector<<G4endl;
276 
277  G4Region* region = (G4RegionStore::GetInstance())->GetRegion("VertexDetector");
278  fVertexDetectorCuts = region->GetProductionCuts();
279  SetVertexCut(fCutForVertexDetector);
280  // G4cout << "Vertex cuts are set" << G4endl;
281 
282  region = (G4RegionStore::GetInstance())->GetRegion("MuonDetector");
283  fMuonDetectorCuts = region->GetProductionCuts();
284  SetMuonCut(fCutForMuonDetector);
285  //G4cout << "Muon cuts are set " <<muonRegion << " " << muonDetectorCuts << G4endl;
286 
288 }
289 
290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
291 
293 {
294  fCutForGamma = cut;
295  SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
296 }
297 
298 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
299 
301 {
302  fCutForElectron = cut;
303  SetParticleCuts(fCutForElectron, G4Electron::Electron());
304  SetParticleCuts(fCutForElectron, G4Positron::Positron());
305 }
306 
307 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
308 
310 {
311  fCutForProton = cut;
312  SetParticleCuts(fCutForProton, G4Proton::Proton());
313 }
314 
315 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
316 
318 {
319  fCutForVertexDetector = cut;
320 
321  if( fVertexDetectorCuts ) {
322  fVertexDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
323  fVertexDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
324  fVertexDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
325  fVertexDetectorCuts->SetProductionCut(cut, idxG4ProtonCut);
326  }
327 }
328 
329 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
330 
332 {
333  fCutForMuonDetector = cut;
334 
335  if( fMuonDetectorCuts ) {
336  fMuonDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
337  fMuonDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
338  fMuonDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
339  fMuonDetectorCuts->SetProductionCut(cut, idxG4ProtonCut);
340  }
341 }
342 
343 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
344