Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/electromagnetic/TestEm16/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/TestEm16/src/PhysicsList.cc
27 /// \brief Implementation of the PhysicsList class
28 //
29 // $Id: PhysicsList.cc 67268 2013-02-13 11:38:40Z ihrivnac $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "PhysicsList.hh"
35 #include "PhysicsListMessenger.hh"
36 
37 #include "G4ParticleDefinition.hh"
38 #include "G4ProcessManager.hh"
39 #include "G4ParticleTypes.hh"
40 #include "G4ParticleTable.hh"
41 
42 #include "G4ComptonScattering.hh"
43 #include "G4GammaConversion.hh"
44 #include "G4PhotoElectricEffect.hh"
45 #include "G4RayleighScattering.hh"
46 
47 #include "G4eMultipleScattering.hh"
48 #include "G4eIonisation.hh"
49 #include "G4eBremsstrahlung.hh"
50 #include "G4eplusAnnihilation.hh"
51 
53 #include "G4MuIonisation.hh"
54 #include "G4MuBremsstrahlung.hh"
55 #include "G4MuPairProduction.hh"
56 
59 
60 #include "G4StepLimiter.hh"
61 
62 #include "G4SystemOfUnits.hh"
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65 
68  fMess(0)
69 {
70  defaultCutValue = 1.*km;
71 
72  fSRType = true;
73  fMess = new PhysicsListMessenger(this);
74 }
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77 
79 {
80  delete fMess;
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84 
86 {
87  // In this method, static member functions should be called
88  // for all particles which you want to use.
89  // This ensures that objects of these particle types will be
90  // created in the program.
91 
94 }
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97 
99 {
100  // pseudo-particles
103 
104  // gamma
106 }
107 
108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
109 
111 {
112  // leptons
117 
122 }
123 
124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125 
127 {
129  ConstructEM();
131 }
132 
133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134 
135 void PhysicsList::ConstructEM()
136 {
137  theParticleIterator->reset();
138  while( (*theParticleIterator)() ){
139  G4ParticleDefinition* particle = theParticleIterator->value();
140  G4ProcessManager* pmanager = particle->GetProcessManager();
141  G4String particleName = particle->GetParticleName();
142 
143  if (particleName == "gamma") {
144  // gamma
147  pmanager->AddDiscreteProcess(new G4GammaConversion);
149 
150  } else if (particleName == "e-") {
151  //electron
152  pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
153  pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
154  pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
155  if (fSRType) {
156  pmanager->AddProcess(new G4SynchrotronRadiation, -1,-1, 4);
157  } else {
158  pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 4);
159  }
160  pmanager->AddProcess(new G4StepLimiter, -1,-1, 5);
161 
162  } else if (particleName == "e+") {
163  //positron
164  pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
165  pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
166  pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
167  pmanager->AddProcess(new G4eplusAnnihilation, 0,-1, 4);
168  if (fSRType) {
169  pmanager->AddProcess(new G4SynchrotronRadiation, -1,-1, 5);
170  } else {
171  pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 5);
172  }
173  pmanager->AddProcess(new G4StepLimiter, -1,-1, 6);
174 
175  } else if( particleName == "mu+" ||
176  particleName == "mu-" ) {
177  //muon
178  pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
179  pmanager->AddProcess(new G4MuIonisation, -1, 2, 2);
180  pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3);
181  pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4);
182 
183  }
184  }
185 }
186 
187 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
188 
189 #include "G4Decay.hh"
190 
192 {
193  // Add Decay Process
194  G4Decay* theDecayProcess = new G4Decay();
195  theParticleIterator->reset();
196  while ((*theParticleIterator)()){
197  G4ParticleDefinition* particle = theParticleIterator->value();
198  G4ProcessManager* pmanager = particle->GetProcessManager();
199  if (theDecayProcess->IsApplicable(*particle)) {
200  pmanager ->AddProcess(theDecayProcess);
201  // set ordering for PostStepDoIt and AtRestDoIt
202  pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
203  pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
204  }
205  }
206 }
207 
208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
209 
211 {
212  if (verboseLevel >0){
213  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
214  }
215 
216  // set cut values for gamma at first and for e- second and next for e+,
217  // because some processes for e+/e- need cut values for gamma
218  SetCutValue(defaultCutValue, "gamma");
221 
223 }
224 
225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4Geantino * GeantinoDefinition()
Definition: G4Geantino.cc:82
static G4Electron * ElectronDefinition()
Definition: G4Electron.cc:89
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:94
void SetCutValue(G4double aCut, const G4String &pname)
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4Decay.cc:89
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
static G4NeutrinoE * NeutrinoEDefinition()
Definition: G4NeutrinoE.cc:80
static G4AntiNeutrinoMu * AntiNeutrinoMuDefinition()
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
static G4Positron * PositronDefinition()
Definition: G4Positron.cc:89
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:95
static G4ChargedGeantino * ChargedGeantinoDefinition()
#define G4endl
Definition: G4ios.hh:61
static G4AntiNeutrinoE * AntiNeutrinoEDefinition()
static G4NeutrinoMu * NeutrinoMuDefinition()
Definition: G4NeutrinoMu.cc:80
#define theParticleIterator
static G4Gamma * GammaDefinition()
Definition: G4Gamma.cc:81