source: trunk/examples/extended/electromagnetic/TestEm5/src/PhysicsList.cc @ 1309

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

update to geant4.9.3

File size: 8.6 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.40 2009/11/15 22:10:03 maire 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 "PhysListEmStandard.hh"
36#include "PhysListEmStandardSS.hh"
37#include "PhysListEmStandardGS.hh"
38
39#include "G4EmStandardPhysics.hh"
40#include "G4EmStandardPhysics_option1.hh"
41#include "G4EmStandardPhysics_option2.hh"
42#include "G4EmStandardPhysics_option3.hh"
43#include "G4EmLivermorePhysics.hh"
44#include "G4EmPenelopePhysics.hh"
45
46#include "G4Decay.hh"
47#include "StepMax.hh"
48
49#include "G4UnitsTable.hh"
50
51#include "G4ParticleDefinition.hh"
52#include "G4ProcessManager.hh"
53
54// Bosons
55#include "G4ChargedGeantino.hh"
56#include "G4Geantino.hh"
57#include "G4Gamma.hh"
58#include "G4OpticalPhoton.hh"
59
60// leptons
61#include "G4MuonPlus.hh"
62#include "G4MuonMinus.hh"
63#include "G4NeutrinoMu.hh"
64#include "G4AntiNeutrinoMu.hh"
65
66#include "G4Electron.hh"
67#include "G4Positron.hh"
68#include "G4NeutrinoE.hh"
69#include "G4AntiNeutrinoE.hh"
70
71// Hadrons
72#include "G4MesonConstructor.hh"
73#include "G4BaryonConstructor.hh"
74#include "G4IonConstructor.hh"
75
76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
78PhysicsList::PhysicsList() : G4VModularPhysicsList()
79{
80  pMessenger = new PhysicsListMessenger(this); 
81   
82  // EM physics
83  emName = G4String("local");
84  emPhysicsList = new PhysListEmStandard(emName);
85     
86  defaultCutValue = 1.*mm;
87
88  cutForGamma     = defaultCutValue;
89  cutForElectron  = defaultCutValue;
90  cutForPositron  = defaultCutValue;
91
92  SetVerboseLevel(1);
93}
94
95//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96
97PhysicsList::~PhysicsList()
98{
99  delete emPhysicsList;
100  delete pMessenger; 
101}
102
103//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104
105void PhysicsList::ConstructParticle()
106{
107  // pseudo-particles
108  G4Geantino::GeantinoDefinition();
109  G4ChargedGeantino::ChargedGeantinoDefinition();
110 
111  // gamma
112  G4Gamma::GammaDefinition();
113 
114  // leptons
115  G4Electron::ElectronDefinition();
116  G4Positron::PositronDefinition();
117  G4MuonPlus::MuonPlusDefinition();
118  G4MuonMinus::MuonMinusDefinition();
119
120  G4NeutrinoE::NeutrinoEDefinition();
121  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
122  G4NeutrinoMu::NeutrinoMuDefinition();
123  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 
124
125  // mesons
126  G4MesonConstructor mConstructor;
127  mConstructor.ConstructParticle();
128
129  // barions
130  G4BaryonConstructor bConstructor;
131  bConstructor.ConstructParticle();
132
133  // ions
134  G4IonConstructor iConstructor;
135  iConstructor.ConstructParticle();
136}
137
138//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
139
140void PhysicsList::ConstructProcess()
141{
142  AddTransportation();
143  emPhysicsList->ConstructProcess();
144  AddDecay(); 
145  AddStepMax();
146}
147
148//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
149
150void PhysicsList::AddDecay()
151{
152  // Add Decay Process
153
154  G4Decay* fDecayProcess = new G4Decay();
155
156  theParticleIterator->reset();
157  while( (*theParticleIterator)() ){
158    G4ParticleDefinition* particle = theParticleIterator->value();
159    G4ProcessManager* pmanager = particle->GetProcessManager();
160
161    if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 
162
163      pmanager ->AddProcess(fDecayProcess);
164
165      // set ordering for PostStepDoIt and AtRestDoIt
166      pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
167      pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
168
169    }
170  }
171}
172
173//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
174
175void PhysicsList::AddStepMax()
176{
177  // Step limitation seen as a process
178  StepMax* stepMaxProcess = new StepMax();
179
180  theParticleIterator->reset();
181  while ((*theParticleIterator)()){
182      G4ParticleDefinition* particle = theParticleIterator->value();
183      G4ProcessManager* pmanager = particle->GetProcessManager();
184
185      if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
186        {
187          pmanager ->AddDiscreteProcess(stepMaxProcess);
188        }
189  }
190}
191
192//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
193
194void PhysicsList::AddPhysicsList(const G4String& name)
195{
196  if (verboseLevel>-1) {
197    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
198  }
199
200  if (name == emName) return;
201
202  if (name == "local") {
203
204    emName = name;
205    delete emPhysicsList;
206    emPhysicsList = new PhysListEmStandard(name);
207
208  } else if (name == "emstandard_opt0") {
209
210    emName = name;
211    delete emPhysicsList;
212    emPhysicsList = new G4EmStandardPhysics();
213
214  } else if (name == "emstandard_opt1") {
215
216    emName = name;
217    delete emPhysicsList;
218    emPhysicsList = new G4EmStandardPhysics_option1();
219
220  } else if (name == "emstandard_opt2") {
221
222    emName = name;
223    delete emPhysicsList;
224    emPhysicsList = new G4EmStandardPhysics_option2();
225   
226  } else if (name == "emstandard_opt3") {
227
228    emName = name;
229    delete emPhysicsList;
230    emPhysicsList = new G4EmStandardPhysics_option3();
231   
232  } else if (name == "standardSS") {
233
234    emName = name;
235    delete emPhysicsList;
236    emPhysicsList = new PhysListEmStandardSS(name);
237
238  } else if (name == "standardGS") {
239
240    emName = name;
241    delete emPhysicsList;
242    emPhysicsList = new PhysListEmStandardGS(name);
243
244  } else if (name == "empenelope"){
245    emName = name;
246    delete emPhysicsList;
247    emPhysicsList = new G4EmPenelopePhysics();
248
249  } else if (name == "emlivermore"){
250    emName = name;
251    delete emPhysicsList;
252    emPhysicsList = new G4EmLivermorePhysics();
253                       
254  } else {
255
256    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
257           << " is not defined"
258           << G4endl;
259  }
260}
261
262//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
263
264void PhysicsList::SetCuts()
265{
266  if (verboseLevel >0){
267    G4cout << "PhysicsList::SetCuts:";
268    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
269  }
270
271  // set cut values for gamma at first and for e- second and next for e+,
272  // because some processes for e+/e- need cut values for gamma
273  SetCutValue(cutForGamma, "gamma");
274  SetCutValue(cutForElectron, "e-");
275  SetCutValue(cutForPositron, "e+");
276
277  if (verboseLevel>0) DumpCutValuesTable();
278}
279
280//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
281
282void PhysicsList::SetCutForGamma(G4double cut)
283{
284  cutForGamma = cut;
285  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
286}
287
288//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
289
290void PhysicsList::SetCutForElectron(G4double cut)
291{
292  cutForElectron = cut;
293  SetParticleCuts(cutForElectron, G4Electron::Electron());
294}
295
296//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
297
298void PhysicsList::SetCutForPositron(G4double cut)
299{
300  cutForPositron = cut;
301  SetParticleCuts(cutForPositron, G4Positron::Positron());
302}
303
304//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.