Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/electromagnetic/TestEm6/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/TestEm6/src/PhysicsList.cc
27 /// \brief Implementation of the PhysicsList class
28 //
29 // $Id: PhysicsList.cc 73716 2013-09-09 10:07:13Z gcosmo $
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 "G4Proton.hh"
43 #include "G4AntiProton.hh"
44 #include "G4Neutron.hh"
45 #include "G4AntiNeutron.hh"
46 
48 
49 #include "G4eMultipleScattering.hh"
51 #include "G4hMultipleScattering.hh"
52 
53 #include "G4eIonisation.hh"
54 #include "G4eBremsstrahlung.hh"
55 #include "G4eplusAnnihilation.hh"
56 #include "G4AnnihiToMuPair.hh"
57 
58 #include "G4MuIonisation.hh"
59 #include "G4MuBremsstrahlung.hh"
60 #include "G4MuPairProduction.hh"
61 
62 #include "G4hIonisation.hh"
63 #include "G4hhIonisation.hh"
64 #include "G4ionIonisation.hh"
65 #include "G4eeToHadrons.hh"
66 
67 #include "G4Decay.hh"
68 #include "G4EmProcessOptions.hh"
69 
70 #include "G4StepLimiter.hh"
71 
72 #include "G4ProcessTable.hh"
73 
74 #include "G4SystemOfUnits.hh"
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77 
79 : G4VUserPhysicsList(), fMes(0)
80 {
81  defaultCutValue = 1.*km;
82  fMes = new PhysicsListMessenger(this);
83  SetVerboseLevel(1);
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87 
89 {
90  delete fMes;
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
96 {
97  // In this method, static member functions should be called
98  // for all particles which you want to use.
99  // This ensures that objects of these particle types will be
100  // created in the program.
101 
102  ConstructBosons();
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108 
110 {
111  // pseudo-particles
114 
115  // gamma
117 }
118 
119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120 
122 {
123  // leptons
128 
133 }
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135 
137 {
138  // mesons
150 
151  // baryons
156 }
157 
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
159 
161 {
163  ConstructEM();
165 }
166 
167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
168 
169 void PhysicsList::ConstructEM()
170 {
171  theParticleIterator->reset();
172  while( (*theParticleIterator)() ){
173  G4ParticleDefinition* particle = theParticleIterator->value();
174  G4ProcessManager* pmanager = particle->GetProcessManager();
175  G4String particleName = particle->GetParticleName();
176 
177  if (particleName == "gamma") {
178  // gamma allow only gamma -> mu+mu-
179  // pmanager->AddDiscreteProcess(new G4GammaConversionToMuons);
180  // pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
181  // pmanager->AddDiscreteProcess(new G4ComptonScattering);
182  // pmanager->AddDiscreteProcess(new G4GammaConversion);
184 
185  } else if (particleName == "e-") {
186  //electron
187  pmanager->AddProcess(new G4eMultipleScattering,-1, 1,1);
188  pmanager->AddProcess(new G4eIonisation, -1, 2,2);
189  pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3);
190  pmanager->AddProcess(new G4StepLimiter, -1,-1,4);
191 
192  } else if (particleName == "e+") {
193  //positron
194  // to make the process of e+e- annihilation more visible,
195  // do not enable the other standard processes:
196  //pmanager->AddProcess(new G4eMultipleScattering,-1, 1,1);
197  //pmanager->AddProcess(new G4eIonisation, -1, 2,2);
198  //pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3);
199  //pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
200 
201  pmanager->AddDiscreteProcess(new G4AnnihiToMuPair);
202  pmanager->AddDiscreteProcess(new G4eeToHadrons);
203  pmanager->AddDiscreteProcess(new G4StepLimiter);
204 
205  } else if( particleName == "mu+" ||
206  particleName == "mu-" ) {
207  //muon
208  pmanager->AddProcess(new G4MuMultipleScattering,-1, 1,1);
209  pmanager->AddProcess(new G4MuIonisation, -1, 2,2);
210  pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3,3);
211  pmanager->AddProcess(new G4MuPairProduction, -1, 4,4);
212  pmanager->AddProcess(new G4StepLimiter, -1,-1,5);
213 
214  } else if( particleName == "anti_proton") {
215  pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
216  pmanager->AddProcess(new G4hhIonisation, -1, 2,2);
217  pmanager->AddProcess(new G4StepLimiter, -1,-1,3);
218 
219  } else if( particleName == "GenericIon") {
220  pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
221  pmanager->AddProcess(new G4ionIonisation, -1, 2,2);
222  pmanager->AddProcess(new G4StepLimiter, -1,-1,3);
223 
224  } else if( particle->GetPDGCharge() != 0.0 && !particle->IsShortLived()
225  && particleName != "chargedgeantino") {
226  pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
227  pmanager->AddProcess(new G4hIonisation, -1, 2,2);
228  pmanager->AddProcess(new G4StepLimiter, -1,-1,3);
229  }
230  }
231 
232  G4EmProcessOptions opt;
233  opt.SetVerbose(1);
234  opt.SetMinEnergy(100*eV);
235  opt.SetMaxEnergy(1000*TeV);
236  opt.SetDEDXBinning(13*7);
237  opt.SetLambdaBinning(13*7);
238 }
239 
240 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
241 
243 {
244  // Add Decay Process
245  G4Decay* theDecayProcess = new G4Decay();
246  theParticleIterator->reset();
247  while ((*theParticleIterator)()){
248  G4ParticleDefinition* particle = theParticleIterator->value();
249  G4ProcessManager* pmanager = particle->GetProcessManager();
250  if (theDecayProcess->IsApplicable(*particle) && !particle->IsShortLived())
251  { pmanager ->AddProcess(theDecayProcess);
252  // set ordering for PostStepDoIt and AtRestDoIt
253  pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
254  pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
255  }
256  }
257 }
258 
259 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
260 
262 {
263  if (verboseLevel >0){
264  G4cout << "PhysicsList::SetCuts:";
265  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
266  }
267 
268  // set cut values for gamma at first and for e- second and next for e+,
269  // because some processes for e+/e- need cut values for gamma
270  SetCutValue(defaultCutValue, "gamma");
273 
275 }
276 
277 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
278 
280 {
281  G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
282  G4GammaConversionToMuons* gammaToMuPairProcess = (G4GammaConversionToMuons*)
283  theProcessTable->FindProcess("GammaToMuPair","gamma");
284  if(gammaToMuPairProcess) gammaToMuPairProcess->SetCrossSecFactor(fac);
285  else G4cout
286  << "Warning. No process GammaToMuPair found, SetGammaToMuPairFac was ignored"
287  << G4endl;
288 }
289 
290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
291 
293 {
294  G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
295  G4AnnihiToMuPair* annihiToMuPairProcess = (G4AnnihiToMuPair*)
296  theProcessTable->FindProcess("AnnihiToMuPair","e+");
297  if(annihiToMuPairProcess) annihiToMuPairProcess->SetCrossSecFactor(fac);
298  else G4cout
299  << "Warning. No process AnnihiToMuPair found, SetAnnihiToMuPairFac ignored"
300  << G4endl;
301 }
302 
303 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
304 
306 {
307  G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
308  G4eeToHadrons* eehadProcess = (G4eeToHadrons*)
309  theProcessTable->FindProcess("ee2hadr","e+");
310  if(eehadProcess) eehadProcess->SetCrossSecFactor(fac);
311  else G4cout
312  << "Warning. No process ee2hadr found, SetAnnihiToHadronFac was ignored"
313  << G4endl;
314 }
315 
316 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4Geantino * GeantinoDefinition()
Definition: G4Geantino.cc:82
static G4Electron * ElectronDefinition()
Definition: G4Electron.cc:89
static G4KaonPlus * KaonPlusDefinition()
Definition: G4KaonPlus.cc:108
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:94
void SetCutValue(G4double aCut, const G4String &pname)
virtual G4bool IsApplicable(const G4ParticleDefinition &)
Definition: G4Decay.cc:89
static G4KaonMinus * KaonMinusDefinition()
Definition: G4KaonMinus.cc:108
void SetMinEnergy(G4double val)
static G4Proton * ProtonDefinition()
Definition: G4Proton.cc:88
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
static G4KaonZero * KaonZeroDefinition()
Definition: G4KaonZero.cc:99
static G4AntiKaonZero * AntiKaonZeroDefinition()
static G4KaonZeroShort * KaonZeroShortDefinition()
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
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 SetDEDXBinning(G4int val)
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
void SetLambdaBinning(G4int val)
static G4PionMinus * PionMinusDefinition()
Definition: G4PionMinus.cc:93
static G4KaonZeroLong * KaonZeroLongDefinition()
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
static G4NeutrinoE * NeutrinoEDefinition()
Definition: G4NeutrinoE.cc:80
static G4AntiNeutrinoMu * AntiNeutrinoMuDefinition()
static G4PionPlus * PionPlusDefinition()
Definition: G4PionPlus.cc:93
void SetCrossSecFactor(G4double fac)
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
void SetVerboseLevel(G4int value)
void SetMaxEnergy(G4double val)
static G4Positron * PositronDefinition()
Definition: G4Positron.cc:89
static G4EtaPrime * EtaPrimeDefinition()
Definition: G4EtaPrime.cc:100
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:95
static G4ChargedGeantino * ChargedGeantinoDefinition()
#define G4endl
Definition: G4ios.hh:61
static G4AntiNeutrinoE * AntiNeutrinoEDefinition()
void SetCrossSecFactor(G4double fac)
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const
static G4NeutrinoMu * NeutrinoMuDefinition()
Definition: G4NeutrinoMu.cc:80
static G4Neutron * NeutronDefinition()
Definition: G4Neutron.cc:99
static G4ProcessTable * GetProcessTable()
G4VProcess * FindProcess(const G4String &processName, const G4String &particleName) const
#define theParticleIterator
static G4Eta * EtaDefinition()
Definition: G4Eta.cc:104
static G4Gamma * GammaDefinition()
Definition: G4Gamma.cc:81
void SetVerbose(G4int val, const G4String &name="all", G4bool worker=false)