Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/electromagnetic/TestEm1/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/TestEm1/src/PhysicsList.cc
27 /// \brief Implementation of the PhysicsList class
28 //
29 // $Id: PhysicsList.cc 74734 2013-10-21 09:00:00Z gcosmo $
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 
40 #include "G4EmStandardPhysics.hh"
45 #include "G4EmLivermorePhysics.hh"
46 #include "G4EmPenelopePhysics.hh"
47 
48 #include "DetectorConstruction.hh"
49 
50 #include "G4LossTableManager.hh"
51 #include "G4UnitsTable.hh"
52 #include "G4SystemOfUnits.hh"
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
58  fEmPhysicsList(0),
59  fDet(0),
60  fMessenger(0)
61 {
63  fDet = p;
64 
65  fCurrentDefaultCut = 1.0*mm;
66  fCutForGamma = fCurrentDefaultCut;
67  fCutForElectron = fCurrentDefaultCut;
68  fCutForPositron = fCurrentDefaultCut;
69 
70  fMessenger = new PhysicsListMessenger(this);
71 
72  SetVerboseLevel(1);
73 
74  // EM physics
75  fEmName = G4String("local");
76  fEmPhysicsList = new PhysListEmStandard(fEmName);
77 
78 }
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
81 
83 {
84  delete fMessenger;
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88 
89 // Bosons
90 #include "G4ChargedGeantino.hh"
91 #include "G4Geantino.hh"
92 #include "G4Gamma.hh"
93 #include "G4OpticalPhoton.hh"
94 
95 // leptons
96 #include "G4MuonPlus.hh"
97 #include "G4MuonMinus.hh"
98 #include "G4NeutrinoMu.hh"
99 #include "G4AntiNeutrinoMu.hh"
100 
101 #include "G4Electron.hh"
102 #include "G4Positron.hh"
103 #include "G4NeutrinoE.hh"
104 #include "G4AntiNeutrinoE.hh"
105 
106 // Mesons
107 #include "G4PionPlus.hh"
108 #include "G4PionMinus.hh"
109 #include "G4PionZero.hh"
110 #include "G4Eta.hh"
111 #include "G4EtaPrime.hh"
112 
113 #include "G4KaonPlus.hh"
114 #include "G4KaonMinus.hh"
115 #include "G4KaonZero.hh"
116 #include "G4AntiKaonZero.hh"
117 #include "G4KaonZeroLong.hh"
118 #include "G4KaonZeroShort.hh"
119 
120 // Baryons
121 #include "G4Proton.hh"
122 #include "G4AntiProton.hh"
123 #include "G4Neutron.hh"
124 #include "G4AntiNeutron.hh"
125 
126 // Nuclei
127 #include "G4Deuteron.hh"
128 #include "G4Triton.hh"
129 #include "G4Alpha.hh"
130 #include "G4GenericIon.hh"
131 
132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133 
135 {
136 // pseudo-particles
139 
140 // gamma
142 
143 // optical photon
145 
146 // leptons
151 
156 
157 // mesons
169 
170 // barions
175 
176 // ions
181 }
182 
183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
184 
185 #include "G4EmProcessOptions.hh"
186 
188 {
189  // Transportation
190  //
192 
193  // Electromagnetic physics list
194  //
195  fEmPhysicsList->ConstructProcess();
196 
197  // Em options
198  //
199  G4EmProcessOptions emOptions;
200  emOptions.SetBuildCSDARange(true);
201  emOptions.SetDEDXBinningForCSDARange(10*10);
202 
203  // Decay Process
204  //
205  AddDecay();
206 
207  // Decay Process
208  //
210 
211  // step limitation (as a full process)
212  //
213  AddStepMax();
214 }
215 
216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
217 
219 {
220  if (verboseLevel>1) {
221  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
222  }
223 
224  if (name == fEmName) return;
225 
226  if (name == "local") {
227 
228  fEmName = name;
229  delete fEmPhysicsList;
230  fEmPhysicsList = new PhysListEmStandard(name);
231 
232  } else if (name == "emstandard_opt0") {
233 
234  fEmName = name;
235  delete fEmPhysicsList;
236  fEmPhysicsList = new G4EmStandardPhysics();
237 
238  } else if (name == "emstandard_opt1") {
239 
240  fEmName = name;
241  delete fEmPhysicsList;
242  fEmPhysicsList = new G4EmStandardPhysics_option1();
243 
244  } else if (name == "emstandard_opt2") {
245 
246  fEmName = name;
247  delete fEmPhysicsList;
248  fEmPhysicsList = new G4EmStandardPhysics_option2();
249 
250  } else if (name == "emstandard_opt3") {
251 
252  fEmName = name;
253  delete fEmPhysicsList;
254  fEmPhysicsList = new G4EmStandardPhysics_option3();
255 
256  } else if (name == "emstandard_opt4") {
257 
258  fEmName = name;
259  delete fEmPhysicsList;
260  fEmPhysicsList = new G4EmStandardPhysics_option4();
261 
262  } else if (name == "standardSS") {
263 
264  fEmName = name;
265  delete fEmPhysicsList;
266  fEmPhysicsList = new PhysListEmStandardSS(name);
267 
268  } else if (name == "emlivermore") {
269  fEmName = name;
270  delete fEmPhysicsList;
271  fEmPhysicsList = new G4EmLivermorePhysics();
272 
273  } else if (name == "empenelope") {
274  fEmName = name;
275  delete fEmPhysicsList;
276  fEmPhysicsList = new G4EmPenelopePhysics();
277 
278  } else {
279 
280  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
281  << " is not defined"
282  << G4endl;
283  }
284 }
285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
286 
287 #include "G4PhysicsListHelper.hh"
288 #include "G4Decay.hh"
289 
291 {
293 
294  // Decay Process
295  //
296  G4Decay* fDecayProcess = new G4Decay();
297 
298  theParticleIterator->reset();
299  while( (*theParticleIterator)() ){
300  G4ParticleDefinition* particle = theParticleIterator->value();
301  if (fDecayProcess->IsApplicable(*particle))
302  ph->RegisterProcess(fDecayProcess, particle);
303  }
304 }
305 
306 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
307 
308 #include "G4PhysicsListHelper.hh"
309 #include "G4RadioactiveDecay.hh"
310 
312 {
313  G4RadioactiveDecay* radioactiveDecay = new G4RadioactiveDecay();
314  radioactiveDecay->SetHLThreshold(-1.*s);
315  radioactiveDecay->SetICM(true); //Internal Conversion
316  radioactiveDecay->SetARM(true); //Atomic Rearangement
317 
319  ph->RegisterProcess(radioactiveDecay, G4GenericIon::GenericIon());
320 }
321 
322 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
323 
324 #include "G4ProcessManager.hh"
325 #include "StepMax.hh"
326 
328 {
329  // Step limitation seen as a process
330  StepMax* stepMaxProcess = new StepMax();
331 
332  theParticleIterator->reset();
333  while ((*theParticleIterator)()){
334  G4ParticleDefinition* particle = theParticleIterator->value();
335  G4ProcessManager* pmanager = particle->GetProcessManager();
336 
337  if (stepMaxProcess->IsApplicable(*particle))
338  {
339  pmanager ->AddDiscreteProcess(stepMaxProcess);
340  }
341  }
342 }
343 
344 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
345 
346 #include "G4Gamma.hh"
347 #include "G4Electron.hh"
348 #include "G4Positron.hh"
349 
351 {
352  if (verboseLevel >0) {
353  G4cout << "PhysicsList::SetCuts:";
354  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
355  }
356  // fixe lower limit for cut
358 
359  // set cut values for gamma at first and for e- second and next for e+,
360  // because some processes for e+/e- need cut values for gamma
361  SetCutValue(fCutForGamma, "gamma");
362  SetCutValue(fCutForElectron, "e-");
363  SetCutValue(fCutForPositron, "e+");
364 
366 }
367 
368 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
369 
371 {
372  fCutForGamma = cut;
373  SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
374 }
375 
376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
377 
379 {
380  fCutForElectron = cut;
381  SetParticleCuts(fCutForElectron, G4Electron::Electron());
382 }
383 
384 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
385 
387 {
388  fCutForPositron = cut;
389  SetParticleCuts(fCutForPositron, G4Positron::Positron());
390 }
391 
392 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
393 
394 #include "G4Material.hh"
395 
397 {
398  G4LogicalVolume* lBox = fDet->GetWorld()->GetLogicalVolume();
400  const G4MaterialCutsCouple* couple = lBox->GetMaterialCutsCouple();
401  const G4Material* currMat = lBox->GetMaterial();
402 
403  G4ParticleDefinition* part;
404  G4double cut;
405  part = particleTable->FindParticle("e-");
406  cut = G4LossTableManager::Instance()->GetRange(part,val,couple);
407  G4cout << "material : " << currMat->GetName() << G4endl;
408  G4cout << "particle : " << part->GetParticleName() << G4endl;
409  G4cout << "energy : " << G4BestUnit(val,"Energy") << G4endl;
410  G4cout << "range : " << G4BestUnit(cut,"Length") << G4endl;
411 }
412 
413 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
414 
415 
static G4Geantino * GeantinoDefinition()
Definition: G4Geantino.cc:82
static G4Electron * ElectronDefinition()
Definition: G4Electron.cc:89
static G4Triton * TritonDefinition()
Definition: G4Triton.cc:90
static G4KaonPlus * KaonPlusDefinition()
Definition: G4KaonPlus.cc:108
static G4GenericIon * GenericIonDefinition()
Definition: G4GenericIon.cc:88
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:94
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4LossTableManager * Instance()
void SetCutValue(G4double aCut, const G4String &pname)
void SetEnergyRange(G4double lowedge, G4double highedge)
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4Decay.cc:89
const XML_Char * s
G4Material * GetMaterial() const
static G4KaonMinus * KaonMinusDefinition()
Definition: G4KaonMinus.cc:108
const char * p
Definition: xmltok.h:285
const G4String & GetName() const
Definition: G4Material.hh:176
static G4Proton * ProtonDefinition()
Definition: G4Proton.cc:88
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
const XML_Char * name
static G4KaonZero * KaonZeroDefinition()
Definition: G4KaonZero.cc:99
static G4AntiKaonZero * AntiKaonZeroDefinition()
static G4KaonZeroShort * KaonZeroShortDefinition()
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetDEDXBinningForCSDARange(G4int val)
static G4AntiProton * AntiProtonDefinition()
Definition: G4AntiProton.cc:88
G4ProcessManager * GetProcessManager() const
static G4AntiNeutron * AntiNeutronDefinition()
static G4PionZero * PionZeroDefinition()
Definition: G4PionZero.cc:99
const G4String & GetParticleName() const
void SetParticleCuts(G4double cut, G4ParticleDefinition *particle, G4Region *region=0)
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
static G4PionMinus * PionMinusDefinition()
Definition: G4PionMinus.cc:93
G4bool RegisterProcess(G4VProcess *process, G4ParticleDefinition *particle)
static G4KaonZeroLong * KaonZeroLongDefinition()
static G4NeutrinoE * NeutrinoEDefinition()
Definition: G4NeutrinoE.cc:80
void SetARM(G4bool arm)
static G4AntiNeutrinoMu * AntiNeutrinoMuDefinition()
static G4PionPlus * PionPlusDefinition()
Definition: G4PionPlus.cc:93
void SetVerboseLevel(G4int value)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
static G4Positron * PositronDefinition()
Definition: G4Positron.cc:89
static G4EtaPrime * EtaPrimeDefinition()
Definition: G4EtaPrime.cc:100
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Positron * Positron()
Definition: G4Positron.cc:94
static G4GenericIon * GenericIon()
Definition: G4GenericIon.cc:93
G4LogicalVolume * GetLogicalVolume() const
static G4ParticleTable * GetParticleTable()
static G4PhysicsListHelper * GetPhysicsListHelper()
virtual G4bool IsApplicable(const G4ParticleDefinition &)
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:95
virtual void ConstructProcess()=0
void SetBuildCSDARange(G4bool val)
static G4ChargedGeantino * ChargedGeantinoDefinition()
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
void SetICM(G4bool icm)
static G4AntiNeutrinoE * AntiNeutrinoEDefinition()
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
static G4OpticalPhoton * OpticalPhotonDefinition()
double G4double
Definition: G4Types.hh:76
void SetHLThreshold(G4double hl)
static G4NeutrinoMu * NeutrinoMuDefinition()
Definition: G4NeutrinoMu.cc:80
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
static G4Deuteron * DeuteronDefinition()
Definition: G4Deuteron.cc:89
static G4Alpha * AlphaDefinition()
Definition: G4Alpha.cc:84
static G4Neutron * NeutronDefinition()
Definition: G4Neutron.cc:99
#define theParticleIterator
static G4Eta * EtaDefinition()
Definition: G4Eta.cc:104
static G4Gamma * GammaDefinition()
Definition: G4Gamma.cc:81