source: trunk/examples/extended/electromagnetic/TestEm2/src/PhysicsList.cc

Last change on this file was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 9.4 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.16 2009/09/16 18:07:30 maire Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-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
37#include "G4EmStandardPhysics.hh"
38#include "G4EmStandardPhysics_option1.hh"
39#include "G4EmStandardPhysics_option2.hh"
40#include "G4EmStandardPhysics_option3.hh"
41#include "G4EmLivermorePhysics.hh"
42#include "G4EmPenelopePhysics.hh"
43
44#include "G4Decay.hh"
45#include "StepMax.hh"
46
47#include "G4LossTableManager.hh"
48#include "G4ProcessManager.hh"
49
50#include "G4UnitsTable.hh"
51
52// Bosons
53#include "G4ChargedGeantino.hh"
54#include "G4Geantino.hh"
55#include "G4Gamma.hh"
56
57// leptons
58#include "G4Electron.hh"
59#include "G4Positron.hh"
60#include "G4MuonPlus.hh"
61#include "G4MuonMinus.hh"
62#include "G4NeutrinoMu.hh"
63#include "G4AntiNeutrinoMu.hh"
64
65#include "G4Electron.hh"
66#include "G4Positron.hh"
67#include "G4NeutrinoE.hh"
68#include "G4AntiNeutrinoE.hh"
69
70// Mesons
71#include "G4PionPlus.hh"
72#include "G4PionMinus.hh"
73#include "G4PionZero.hh"
74#include "G4Eta.hh"
75#include "G4EtaPrime.hh"
76
77#include "G4KaonPlus.hh"
78#include "G4KaonMinus.hh"
79#include "G4KaonZero.hh"
80#include "G4AntiKaonZero.hh"
81#include "G4KaonZeroLong.hh"
82#include "G4KaonZeroShort.hh"
83
84// Baryons
85#include "G4Proton.hh"
86#include "G4AntiProton.hh"
87#include "G4Neutron.hh"
88#include "G4AntiNeutron.hh"
89
90// Nuclei
91#include "G4Alpha.hh"
92#include "G4Deuteron.hh"
93#include "G4Triton.hh"
94#include "G4He3.hh"
95#include "G4GenericIon.hh"
96
97//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
98
99PhysicsList::PhysicsList() : G4VModularPhysicsList()
100{
101  G4LossTableManager::Instance();
102  defaultCutValue = 1.*mm;
103  cutForGamma     = defaultCutValue;
104  cutForElectron  = defaultCutValue;
105  cutForPositron  = defaultCutValue;
106
107  pMessenger = new PhysicsListMessenger(this);
108
109  SetVerboseLevel(1);
110
111  // EM physics
112  ///emName = "emstandard_opt0"; 
113  ///emPhysicsList = new G4EmStandardPhysics();
114  emName = "local";   
115  emPhysicsList = new PhysListEmStandard(emName);   
116}
117
118//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119
120PhysicsList::~PhysicsList()
121{
122  delete pMessenger;
123  delete emPhysicsList;
124}
125
126//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
127
128void PhysicsList::ConstructParticle()
129{
130  // pseudo-particles
131  G4Geantino::GeantinoDefinition();
132  G4ChargedGeantino::ChargedGeantinoDefinition();
133 
134  // gamma
135  G4Gamma::GammaDefinition();
136 
137  // leptons
138  G4Electron::ElectronDefinition();
139  G4Positron::PositronDefinition();
140  G4MuonPlus::MuonPlusDefinition();
141  G4MuonMinus::MuonMinusDefinition();
142
143  G4NeutrinoE::NeutrinoEDefinition();
144  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
145  G4NeutrinoMu::NeutrinoMuDefinition();
146  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 
147
148  // mesons
149  G4PionPlus::PionPlusDefinition();
150  G4PionMinus::PionMinusDefinition();
151  G4PionZero::PionZeroDefinition();
152  G4Eta::EtaDefinition();
153  G4EtaPrime::EtaPrimeDefinition();
154  G4KaonPlus::KaonPlusDefinition();
155  G4KaonMinus::KaonMinusDefinition();
156  G4KaonZero::KaonZeroDefinition();
157  G4AntiKaonZero::AntiKaonZeroDefinition();
158  G4KaonZeroLong::KaonZeroLongDefinition();
159  G4KaonZeroShort::KaonZeroShortDefinition();
160
161  // barions
162  G4Proton::ProtonDefinition();
163  G4AntiProton::AntiProtonDefinition();
164  G4Neutron::NeutronDefinition();
165  G4AntiNeutron::AntiNeutronDefinition();
166
167  // ions
168  G4Deuteron::DeuteronDefinition();
169  G4Triton::TritonDefinition();
170  G4He3::He3Definition();
171  G4Alpha::AlphaDefinition();
172  G4GenericIon::GenericIonDefinition();
173}
174
175//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
176
177void PhysicsList::ConstructProcess()
178{
179  // transportation
180  //
181  AddTransportation();
182 
183  // electromagnetic physics list
184  //
185  emPhysicsList->ConstructProcess();
186 
187  // decay process
188  //
189  AddDecay();
190
191  // step limitation (as a full process)
192  // 
193  AddStepMax();
194}
195
196//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
197
198void PhysicsList::AddPhysicsList(const G4String& name)
199{
200  if (verboseLevel>-1) {
201    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
202  }
203
204  if (name == emName) return;
205
206  if (name == "local") {
207
208    emName = name;
209    delete emPhysicsList;
210    emPhysicsList = new PhysListEmStandard(name);
211   
212  } else if (name == "emstandard_opt0") {
213
214    emName = name;
215    delete emPhysicsList;
216    emPhysicsList = new G4EmStandardPhysics();
217
218  } else if (name == "emstandard_opt1") {
219
220    emName = name;
221    delete emPhysicsList;
222    emPhysicsList = new G4EmStandardPhysics_option1();
223
224  } else if (name == "emstandard_opt2") {
225
226    emName = name;
227    delete emPhysicsList;
228    emPhysicsList = new G4EmStandardPhysics_option2();
229
230  } else if (name == "emstandard_opt3") {
231
232    emName = name;
233    delete emPhysicsList;
234    emPhysicsList = new G4EmStandardPhysics_option3();
235   
236  } else if (name == "empenelope"){
237    emName = name;
238    delete emPhysicsList;
239    emPhysicsList = new G4EmPenelopePhysics();
240
241  } else if (name == "emlivermore"){
242    emName = name;
243    delete emPhysicsList;
244    emPhysicsList = new G4EmLivermorePhysics();
245
246  } else {
247
248    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
249           << " is not defined"
250           << G4endl;
251  }
252}
253
254//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
255
256void PhysicsList::AddDecay()
257{
258  // decay process
259  //
260  G4Decay* fDecayProcess = new G4Decay();
261
262  theParticleIterator->reset();
263  while( (*theParticleIterator)() ){
264    G4ParticleDefinition* particle = theParticleIterator->value();
265    G4ProcessManager* pmanager = particle->GetProcessManager();
266
267    if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 
268
269      pmanager ->AddProcess(fDecayProcess);
270
271      // set ordering for PostStepDoIt and AtRestDoIt
272      pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
273      pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
274
275    }
276  }
277}
278
279//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
280
281void PhysicsList::AddStepMax()
282{
283  // Step limitation seen as a process
284  StepMax* stepMaxProcess = new StepMax();
285
286  theParticleIterator->reset();
287  while ((*theParticleIterator)()){
288      G4ParticleDefinition* particle = theParticleIterator->value();
289      G4ProcessManager* pmanager = particle->GetProcessManager();
290
291      if (stepMaxProcess->IsApplicable(*particle))
292        {
293          pmanager ->AddDiscreteProcess(stepMaxProcess);
294        }
295  }
296}
297
298//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
299
300void PhysicsList::SetCuts()
301{
302
303  if (verboseLevel >0){
304    G4cout << "PhysicsList::SetCuts:";
305    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
306  }
307
308  // set cut values for gamma at first and for e- second and next for e+,
309  // because some processes for e+/e- need cut values for gamma
310  SetCutValue(cutForGamma, "gamma");
311  SetCutValue(cutForElectron, "e-");
312  SetCutValue(cutForPositron, "e+");
313
314  if (verboseLevel>0) DumpCutValuesTable();
315}
316
317//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
318
319void PhysicsList::SetCutForGamma(G4double cut)
320{
321  cutForGamma = cut;
322  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
323}
324
325//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
326
327void PhysicsList::SetCutForElectron(G4double cut)
328{
329  cutForElectron = cut;
330  SetParticleCuts(cutForElectron, G4Electron::Electron());
331}
332
333//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
334
335void PhysicsList::SetCutForPositron(G4double cut)
336{
337  cutForPositron = cut;
338  SetParticleCuts(cutForPositron, G4Positron::Positron());
339}
340
341//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
342
Note: See TracBrowser for help on using the repository browser.