Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/electromagnetic/TestEm8/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/TestEm8/src/PhysicsList.cc
27 /// \brief Implementation of the PhysicsList class
28 //
29 // $Id: PhysicsList.cc 77094 2013-11-21 10:51:54Z gcosmo $
30 //
31 //---------------------------------------------------------------------------
32 //
33 // ClassName: PhysicsList
34 //
35 // Description: EM physics with a possibility to add PAI model
36 //
37 // Author: V.Ivanchenko 01.09.2010
38 //
39 //----------------------------------------------------------------------------
40 //
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
45 #include "PhysicsList.hh"
46 #include "PhysicsListMessenger.hh"
47 
48 #include "G4EmStandardPhysics.hh"
53 #include "G4EmLivermorePhysics.hh"
54 #include "G4EmPenelopePhysics.hh"
55 #include "G4DecayPhysics.hh"
56 
57 #include "G4PAIModel.hh"
58 #include "G4PAIPhotModel.hh"
59 
60 #include "G4Gamma.hh"
61 #include "G4Electron.hh"
62 #include "G4Positron.hh"
63 #include "G4Proton.hh"
64 
65 #include "G4UnitsTable.hh"
66 #include "G4SystemOfUnits.hh"
67 #include "G4LossTableManager.hh"
68 #include "G4ProductionCutsTable.hh"
69 
70 #include "StepMax.hh"
71 
72 #include "G4ProcessManager.hh"
73 #include "G4ParticleTypes.hh"
74 #include "G4ParticleTable.hh"
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77 
79  fConfig(0),
80  fEmPhysicsList(0),
81  fDecayPhysicsList(0),
82  fStepMaxProcess(0),
83  fMessenger(0)
84 {
87  defaultCutValue = 1.*mm;
88  fCutForGamma = defaultCutValue;
89  fCutForElectron = defaultCutValue;
90  fCutForPositron = defaultCutValue;
91  fCutForProton = defaultCutValue;
92 
93  fMessenger = new PhysicsListMessenger(this);
94 
95  fStepMaxProcess = new StepMax();
96 
97  // Decay Physics is always defined
98  fDecayPhysicsList = new G4DecayPhysics();
99 
100  // EM physics
101  fEmName = G4String("emstandard");
102  fEmPhysicsList = new G4EmStandardPhysics(1);
103 
104  SetVerboseLevel(1);
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108 
110 {
111  delete fMessenger;
112  delete fDecayPhysicsList;
113  delete fEmPhysicsList;
114  for(size_t i=0; i<fHadronPhys.size(); ++i) { delete fHadronPhys[i]; }
115  delete fStepMaxProcess;
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
122  fDecayPhysicsList->ConstructParticle();
123 }
124 
125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
126 
128 {
130  fEmPhysicsList->ConstructProcess();
131  fDecayPhysicsList->ConstructProcess();
132  for(size_t i=0; i<fHadronPhys.size(); ++i) {
133  fHadronPhys[i]->ConstructProcess(); }
134  AddStepMax();
135 }
136 
137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
138 
140 {
141  if (verboseLevel>1) {
142  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
143  }
144 
145  if (name == fEmName) {
146  return;
147 
148  } else if (name == "emstandard_opt1") {
149 
150  fEmName = name;
151  delete fEmPhysicsList;
152  fEmPhysicsList = new G4EmStandardPhysics_option1();
153 
154  } else if (name == "emstandard_opt2") {
155 
156  fEmName = name;
157  delete fEmPhysicsList;
158  fEmPhysicsList = new G4EmStandardPhysics_option2();
159 
160  } else if (name == "emstandard_opt3") {
161 
162  fEmName = name;
163  delete fEmPhysicsList;
164  fEmPhysicsList = new G4EmStandardPhysics_option3();
165 
166  } else if (name == "emstandard_opt4") {
167 
168  fEmName = name;
169  delete fEmPhysicsList;
170  fEmPhysicsList = new G4EmStandardPhysics_option4();
171 
172  } else if (name == "emlivermore") {
173 
174  fEmName = name;
175  delete fEmPhysicsList;
176  fEmPhysicsList = new G4EmLivermorePhysics();
177 
178  } else if (name == "empenelope") {
179 
180  fEmName = name;
181  delete fEmPhysicsList;
182  fEmPhysicsList = new G4EmPenelopePhysics();
183 
184  } else if (name == "pai") {
185 
186  fEmName = name;
187  AddPAIModel(name);
188 
189  } else if (name == "pai_photon") {
190 
191  fEmName = name;
192  AddPAIModel(name);
193 
194  } else {
195 
196  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
197  << " is not defined"
198  << G4endl;
199  }
200 }
201 
202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
203 
205 {
206  // Step limitation seen as a process
207 
208  theParticleIterator->reset();
209  while ((*theParticleIterator)())
210  {
211  G4ParticleDefinition* particle = theParticleIterator->value();
212  G4ProcessManager* pmanager = particle->GetProcessManager();
213 
214  if (fStepMaxProcess->IsApplicable(*particle))
215  {
216  pmanager ->AddDiscreteProcess(fStepMaxProcess);
217  }
218  }
219 }
220 
221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
222 
224 {
226  if ( verboseLevel > 0 )
227  {
228  G4cout << "PhysicsList::SetCuts:";
229  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
230  }
231 
232  // set cut values for gamma at first and for e- second and next for e+,
233  // because some processes for e+/e- need cut values for gamma
234 
235  SetCutValue(fCutForGamma, "gamma");
236  SetCutValue(fCutForElectron, "e-");
237  SetCutValue(fCutForPositron, "e+");
238  SetCutValue(fCutForProton, "proton");
239 
240  if ( verboseLevel > 0 ) { DumpCutValuesTable(); }
241 }
242 
243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
244 
246 {
247  fCutForGamma = cut;
248  SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
249 }
250 
251 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
252 
254 {
255  fCutForElectron = cut;
256  SetParticleCuts(fCutForElectron, G4Electron::Electron());
257 }
258 
259 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
260 
262 {
263  fCutForPositron = cut;
264  SetParticleCuts(fCutForPositron, G4Positron::Positron());
265 }
266 
267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
268 
270 {
271  fCutForProton = cut;
272  SetParticleCuts(fCutForProton, G4Proton::Proton());
273 }
274 
275 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
276 
277 void PhysicsList::AddPAIModel(const G4String& modname)
278 {
279  theParticleIterator->reset();
280  while ((*theParticleIterator)())
281  {
282  G4ParticleDefinition* particle = theParticleIterator->value();
283  G4String partname = particle->GetParticleName();
284  if(partname == "e-" || partname == "e+") {
285  NewPAIModel(particle, modname, "eIoni");
286 
287  } else if(partname == "mu-" || partname == "mu+") {
288  NewPAIModel(particle, modname, "muIoni");
289 
290  } else if(partname == "proton" ||
291  partname == "pi+" ||
292  partname == "pi-"
293  ) {
294  NewPAIModel(particle, modname, "hIoni");
295  }
296  }
297 }
298 
299 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
300 
301 void PhysicsList::NewPAIModel(const G4ParticleDefinition* part,
302  const G4String& modname,
303  const G4String& procname)
304 {
305  G4String partname = part->GetParticleName();
306  if(modname == "pai") {
307  G4PAIModel* pai = new G4PAIModel(part,"PAIModel");
308  fConfig->SetExtraEmModel(partname,procname,pai,"GasDetector",
309  0.0,100.*TeV,pai);
310  } else if(modname == "pai_photon") {
311  G4PAIPhotModel* pai = new G4PAIPhotModel(part,"PAIPhotModel");
312  fConfig->SetExtraEmModel(partname,procname,pai,"GasDetector",
313  0.0,100.*TeV,pai);
314  }
315 }
316 
317 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
318 
G4EmConfigurator * EmConfigurator()
static G4LossTableManager * Instance()
void SetCutValue(G4double aCut, const G4String &pname)
void SetEnergyRange(G4double lowedge, G4double highedge)
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
static G4Proton * Proton()
Definition: G4Proton.cc:93
void SetVerboseLevel(G4int value)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Positron * Positron()
Definition: G4Positron.cc:94
virtual void ConstructProcess()=0
void SetVerbose(G4int val)
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
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