source: trunk/examples/extended/electromagnetic/TestEm3/src/PhysicsList.cc @ 1187

Last change on this file since 1187 was 807, checked in by garnier, 16 years ago

update

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