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