Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/electromagnetic/TestEm7/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 /// \file electromagnetic/TestEm7/src/PhysicsList.cc
27 /// \brief Implementation of the PhysicsList class
28 //
29 // $Id: PhysicsList.cc 68585 2013-04-01 23:35:07Z adotti $
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 "PhysListEmStandardSS.hh"
39 #include "PhysListEmStandardNR.hh"
40 #include "G4EmStandardPhysics.hh"
45 #include "G4EmLivermorePhysics.hh"
46 #include "G4EmPenelopePhysics.hh"
47 
48 #include "G4DecayPhysics.hh"
49 
53 #include "G4HadronInelasticQBBC.hh"
54 #include "G4IonPhysics.hh"
55 
56 #include "G4LossTableManager.hh"
57 #include "G4EmConfigurator.hh"
58 #include "G4UnitsTable.hh"
59 
60 #include "G4ProcessManager.hh"
61 #include "G4Decay.hh"
62 
63 #include "StepMax.hh"
64 
65 #include "G4IonFluctuations.hh"
68 
69 #include "G4BraggIonGasModel.hh"
71 
72 #include "G4PhysicalConstants.hh"
73 #include "G4SystemOfUnits.hh"
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78  fEmPhysicsList(0),
79  fDecPhysicsList(0),
80  fHadronPhys(),
81  fStepMaxProcess(0),
82  fMessenger(0)
83 {
85  defaultCutValue = 1.*mm;
86  fCutForGamma = defaultCutValue;
87  fCutForElectron = defaultCutValue;
88  fCutForPositron = defaultCutValue;
89 
90  fHelIsRegisted = false;
91  fBicIsRegisted = false;
92  fBiciIsRegisted = false;
93 
94  fStepMaxProcess = 0;
95 
96  fMessenger = new PhysicsListMessenger(this);
97 
98  SetVerboseLevel(1);
99 
100  // EM physics
101  fEmName = G4String("emstandard_opt0");
102  fEmPhysicsList = new G4EmStandardPhysics(1);
103 
104  // Deacy physics and all particles
105  fDecPhysicsList = new G4DecayPhysics();
106 }
107 
108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
109 
111 {
112  delete fMessenger;
113  delete fEmPhysicsList;
114  delete fDecPhysicsList;
115  for(size_t i=0; i<fHadronPhys.size(); i++) {delete fHadronPhys[i];}
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
122  fDecPhysicsList->ConstructParticle();
123 }
124 
125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
126 
128 {
129  // transportation
130  //
132 
133  // electromagnetic physics list
134  //
135  fEmPhysicsList->ConstructProcess();
136 
137  // decay physics list
138  //
139  fDecPhysicsList->ConstructProcess();
140 
141  // hadronic physics lists
142  for(size_t i=0; i<fHadronPhys.size(); i++) {
143  fHadronPhys[i]->ConstructProcess();
144  }
145 
146  // step limitation (as a full process)
147  //
148  AddStepMax();
149 }
150 
151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
152 
154 {
155  if (verboseLevel>1) {
156  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
157  }
158 
159  if (name == fEmName) return;
160 
161  if (name == "local") {
162 
163  fEmName = name;
164  delete fEmPhysicsList;
165  fEmPhysicsList = new PhysListEmStandard(name);
166 
167  } else if (name == "emstandard_opt0") {
168 
169  fEmName = name;
170  delete fEmPhysicsList;
171  fEmPhysicsList = new G4EmStandardPhysics(1);
172 
173  } else if (name == "emstandard_opt1") {
174 
175  fEmName = name;
176  delete fEmPhysicsList;
177  fEmPhysicsList = new G4EmStandardPhysics_option1();
178 
179  } else if (name == "emstandard_opt2") {
180 
181  fEmName = name;
182  delete fEmPhysicsList;
183  fEmPhysicsList = new G4EmStandardPhysics_option2();
184 
185  } else if (name == "emstandard_opt3") {
186 
187  fEmName = name;
188  delete fEmPhysicsList;
189  fEmPhysicsList = new G4EmStandardPhysics_option3();
190 
191  } else if (name == "emstandard_opt4") {
192 
193  fEmName = name;
194  delete fEmPhysicsList;
195  fEmPhysicsList = new G4EmStandardPhysics_option4();
196 
197  } else if (name == "standardSS") {
198 
199  fEmName = name;
200  delete fEmPhysicsList;
201  fEmPhysicsList = new PhysListEmStandardSS(name);
202 
203  } else if (name == "ionGasModels") {
204 
205  AddPhysicsList("emstandard_opt0");
206  fEmName = name;
207  AddIonGasModels();
208 
209  } else if (name == "standardNR") {
210 
211  fEmName = name;
212  delete fEmPhysicsList;
213  fEmPhysicsList = new PhysListEmStandardNR(name);
214 
215  } else if (name == "emlivermore") {
216  fEmName = name;
217  delete fEmPhysicsList;
218  fEmPhysicsList = new G4EmLivermorePhysics();
219 
220  } else if (name == "empenelope") {
221  fEmName = name;
222  delete fEmPhysicsList;
223  fEmPhysicsList = new G4EmPenelopePhysics();
224 
225  } else if (name == "elastic" && !fHelIsRegisted) {
226  fHadronPhys.push_back( new G4HadronElasticPhysics());
227  fHelIsRegisted = true;
228 
229  } else if (name == "DElastic" && !fHelIsRegisted) {
230  fHadronPhys.push_back( new G4HadronDElasticPhysics());
231  fHelIsRegisted = true;
232 
233  } else if (name == "HElastic" && !fHelIsRegisted) {
234  fHadronPhys.push_back( new G4HadronHElasticPhysics());
235  fHelIsRegisted = true;
236 
237  } else if (name == "binary" && !fBicIsRegisted) {
238  fHadronPhys.push_back(new G4HadronInelasticQBBC());
239  fBicIsRegisted = true;
240 
241  } else if (name == "binary_ion" && !fBiciIsRegisted) {
242  fHadronPhys.push_back(new G4IonPhysics());
243  fBiciIsRegisted = true;
244 
245  } else {
246 
247  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
248  << " is not defined"
249  << G4endl;
250  }
251 }
252 
253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
254 
256 {
257  // Step limitation seen as a process
258  fStepMaxProcess = new StepMax();
259 
260  theParticleIterator->reset();
261  while ((*theParticleIterator)()){
262  G4ParticleDefinition* particle = theParticleIterator->value();
263  G4ProcessManager* pmanager = particle->GetProcessManager();
264 
265  if (fStepMaxProcess->IsApplicable(*particle) && pmanager)
266  {
267  pmanager ->AddDiscreteProcess(fStepMaxProcess);
268  }
269  }
270 }
271 
272 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
273 
275 {
276  if (verboseLevel >0) {
277  G4cout << "PhysicsList::SetCuts:";
278  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
279  }
280 
281  // set cut values for gamma at first and for e- second and next for e+,
282  // because some processes for e+/e- need cut values for gamma
283  SetCutValue(fCutForGamma, "gamma");
284  SetCutValue(fCutForElectron, "e-");
285  SetCutValue(fCutForPositron, "e+");
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 }
305 
306 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
307 
309 {
310  fCutForPositron = cut;
311  SetParticleCuts(fCutForPositron, G4Positron::Positron());
312 }
313 
314 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
315 
316 void PhysicsList::AddIonGasModels()
317 {
319  theParticleIterator->reset();
320  while ((*theParticleIterator)())
321  {
322  G4ParticleDefinition* particle = theParticleIterator->value();
323  G4String partname = particle->GetParticleName();
324  if(partname == "alpha" || partname == "He3" || partname == "GenericIon") {
327  G4double eth = 2.*MeV*particle->GetPDGMass()/proton_mass_c2;
328  em_config->SetExtraEmModel(partname,"ionIoni",mod1,"",0.0,eth,
329  new G4IonFluctuations());
330  em_config->SetExtraEmModel(partname,"ionIoni",mod2,"",eth,100*TeV,
331  new G4UniversalFluctuation());
332 
333  }
334  }
335 }
336 
337 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
338 
G4EmConfigurator * EmConfigurator()
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
const G4String & GetParticleName() const
virtual void ConstructParticle()=0
void SetParticleCuts(G4double cut, G4ParticleDefinition *particle, G4Region *region=0)
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
float proton_mass_c2
Definition: hepunit.py:275
void SetVerboseLevel(G4int value)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
static G4Positron * Positron()
Definition: G4Positron.cc:94
G4double GetPDGMass() const
virtual void ConstructProcess()=0
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
Definition of the PhysListEmStandardNR class.
double G4double
Definition: G4Types.hh:76
void SetExtraEmModel(const G4String &particleName, const G4String &processName, G4VEmModel *, const G4String &regionName="", G4double emin=0.0, G4double emax=DBL_MAX, G4VEmFluctuationModel *fm=0)
#define theParticleIterator
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4VProcess.hh:205