source: trunk/examples/extended/electromagnetic/TestEm6/src/PhysicsList.cc @ 1279

Last change on this file since 1279 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 10.1 KB
Line 
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// $Id: PhysicsList.cc,v 1.13 2009/05/13 17:25:33 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-03-cand-01 $
28//
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#include "PhysicsList.hh"
33#include "PhysicsListMessenger.hh"
34
35#include "G4ParticleDefinition.hh"
36#include "G4ProcessManager.hh"
37#include "G4ParticleTypes.hh"
38#include "G4ParticleTable.hh"
39
40#include "G4Proton.hh"
41#include "G4AntiProton.hh"
42#include "G4Neutron.hh"
43#include "G4AntiNeutron.hh"
44//#include "G4GenericIon.hh"
45
46#include "G4GammaConversionToMuons.hh"
47
48#include "G4MultipleScattering.hh"
49
50#include "G4eIonisation.hh"
51#include "G4eBremsstrahlung.hh"
52#include "G4eplusAnnihilation.hh"
53#include "G4AnnihiToMuPair.hh"
54
55#include "G4MuIonisation.hh"
56#include "G4MuBremsstrahlung.hh"
57#include "G4MuPairProduction.hh"
58
59#include "G4hIonisation.hh"
60#include "G4hhIonisation.hh"
61#include "G4ionIonisation.hh"
62#include "G4eeToHadrons.hh"
63
64#include "G4Decay.hh"
65#include "G4EmProcessOptions.hh"
66
67#include "G4StepLimiter.hh"
68
69//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70
71PhysicsList::PhysicsList()
72: G4VUserPhysicsList()
73{
74  defaultCutValue = 1.*km;
75  pMes = new PhysicsListMessenger(this);
76  theGammaToMuPairProcess = 0;
77  theAnnihiToMuPairProcess = 0;
78  eehadProcess = 0;
79  SetVerboseLevel(1);
80}
81
82//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83
84PhysicsList::~PhysicsList()
85{
86  delete pMes;
87  delete theAnnihiToMuPairProcess;
88  delete theGammaToMuPairProcess;
89  delete eehadProcess;
90}
91
92//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93
94void PhysicsList::ConstructParticle()
95{
96  // In this method, static member functions should be called
97  // for all particles which you want to use.
98  // This ensures that objects of these particle types will be
99  // created in the program.
100 
101  ConstructBosons();
102  ConstructLeptons();
103  ConstructHadrons();
104}
105
106//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
107
108void PhysicsList::ConstructBosons()
109{
110  // pseudo-particles
111  G4Geantino::GeantinoDefinition();
112  G4ChargedGeantino::ChargedGeantinoDefinition();
113
114  // gamma
115  G4Gamma::GammaDefinition();
116}
117
118//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119
120void PhysicsList::ConstructLeptons()
121{
122  // leptons
123  G4Electron::ElectronDefinition();
124  G4Positron::PositronDefinition();
125  G4MuonPlus::MuonPlusDefinition();
126  G4MuonMinus::MuonMinusDefinition();
127
128  G4NeutrinoE::NeutrinoEDefinition();
129  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
130  G4NeutrinoMu::NeutrinoMuDefinition();
131  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
132}
133//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134
135void PhysicsList::ConstructHadrons()
136{
137  // mesons
138  G4PionPlus::PionPlusDefinition();
139  G4PionMinus::PionMinusDefinition();
140  G4PionZero::PionZeroDefinition();
141  G4Eta::EtaDefinition();
142  G4EtaPrime::EtaPrimeDefinition();
143  G4KaonPlus::KaonPlusDefinition();
144  G4KaonMinus::KaonMinusDefinition();
145  G4KaonZero::KaonZeroDefinition();
146  G4AntiKaonZero::AntiKaonZeroDefinition();
147  G4KaonZeroLong::KaonZeroLongDefinition();
148  G4KaonZeroShort::KaonZeroShortDefinition();
149
150  // baryons
151  G4Proton::ProtonDefinition();
152  G4AntiProton::AntiProtonDefinition();
153  G4Neutron::NeutronDefinition();
154  G4AntiNeutron::AntiNeutronDefinition();
155}
156
157//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
158
159void PhysicsList::ConstructProcess()
160{
161  AddTransportation();
162  ConstructEM();
163  ConstructGeneral();
164}
165
166//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
167
168void PhysicsList::ConstructEM()
169{
170  theParticleIterator->reset();
171  while( (*theParticleIterator)() ){
172    G4ParticleDefinition* particle = theParticleIterator->value();
173    G4ProcessManager* pmanager = particle->GetProcessManager();
174    G4String particleName = particle->GetParticleName();
175
176    if (particleName == "gamma") {
177      // gamma    allow  only   gamma -> mu+mu-
178      theGammaToMuPairProcess=new G4GammaConversionToMuons();
179      pmanager->AddDiscreteProcess(theGammaToMuPairProcess);
180
181    } else if (particleName == "e-") {
182      //electron
183      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
184      pmanager->AddProcess(new G4eIonisation,       -1, 2,2);
185      pmanager->AddProcess(new G4eBremsstrahlung,   -1, 3,3);
186      pmanager->AddProcess(new G4StepLimiter,       -1,-1,4);     
187
188    } else if (particleName == "e+") {
189      //positron
190      // to make the process of e+e- annihilation more visible,
191      // do not enable the other standard processes:
192      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
193      pmanager->AddProcess(new G4eIonisation,       -1, 2,2);
194      pmanager->AddProcess(new G4eBremsstrahlung,   -1, 3,3);
195      pmanager->AddProcess(new G4eplusAnnihilation,  0,-1,4);
196     
197      theAnnihiToMuPairProcess = new G4AnnihiToMuPair();
198      eehadProcess             = new G4eeToHadrons();
199      pmanager->AddDiscreteProcess(theAnnihiToMuPairProcess);
200      pmanager->AddDiscreteProcess(eehadProcess);
201      pmanager->AddDiscreteProcess(new G4StepLimiter);
202       
203    } else if( particleName == "mu+" ||
204               particleName == "mu-"    ) {
205      //muon
206      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
207      pmanager->AddProcess(new G4MuIonisation,      -1, 2,2);
208      pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 3,3);
209      pmanager->AddProcess(new G4MuPairProduction,  -1, 4,4);
210      pmanager->AddProcess(new G4StepLimiter,       -1,-1,5);           
211     
212    } else if( particleName == "anti_proton") {
213      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
214      pmanager->AddProcess(new G4hhIonisation,      -1, 2,2);
215      pmanager->AddProcess(new G4StepLimiter,       -1,-1,3);       
216
217    } else if( particleName == "GenericIon") {
218      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
219      pmanager->AddProcess(new G4ionIonisation,     -1, 2,2);
220      pmanager->AddProcess(new G4StepLimiter,       -1,-1,3);       
221     
222    } else if( particle->GetPDGCharge() != 0.0 && !particle->IsShortLived()
223            && particleName != "chargedgeantino") {
224      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
225      pmanager->AddProcess(new G4hIonisation,       -1, 2,2);
226      pmanager->AddProcess(new G4StepLimiter,       -1,-1,3);       
227    }
228  }
229 
230  G4EmProcessOptions opt;
231  opt.SetVerbose(1);
232  opt.SetMinEnergy(100*eV);       
233  opt.SetMaxEnergy(1000*TeV);     
234  opt.SetDEDXBinning(13*7);     
235  opt.SetLambdaBinning(13*7);   
236}
237
238//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
239
240void PhysicsList::ConstructGeneral()
241{
242  // Add Decay Process
243  G4Decay* theDecayProcess = new G4Decay();
244  theParticleIterator->reset();
245  while ((*theParticleIterator)()){
246      G4ParticleDefinition* particle = theParticleIterator->value();
247      G4ProcessManager* pmanager = particle->GetProcessManager();
248      if (theDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
249        pmanager ->AddProcess(theDecayProcess);
250        // set ordering for PostStepDoIt and AtRestDoIt
251        pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
252        pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
253      }
254  }
255}
256
257//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
258
259void PhysicsList::SetCuts()
260{
261  if (verboseLevel >0){
262    G4cout << "PhysicsList::SetCuts:";
263    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
264  } 
265
266  // set cut values for gamma at first and for e- second and next for e+,
267  // because some processes for e+/e- need cut values for gamma
268  SetCutValue(defaultCutValue, "gamma");
269  SetCutValue(defaultCutValue, "e-");
270  SetCutValue(defaultCutValue, "e+");
271
272  if (verboseLevel>0) DumpCutValuesTable();
273}
274
275//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
276
277void PhysicsList::SetGammaToMuPairFac(G4double fac)
278{
279  if(theGammaToMuPairProcess) theGammaToMuPairProcess->SetCrossSecFactor(fac);
280}
281
282//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
283
284void PhysicsList::SetAnnihiToMuPairFac(G4double fac)
285{
286  if(theAnnihiToMuPairProcess) theAnnihiToMuPairProcess->SetCrossSecFactor(fac);
287}
288
289//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
290
291void PhysicsList::SetAnnihiToHadronFac(G4double fac)
292{
293  if(eehadProcess) eehadProcess->SetCrossSecFactor(fac);
294}
295
296//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.