source: trunk/examples/extended/electromagnetic/TestEm18/src/PhysicsList.cc @ 1337

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

tag geant4.9.4 beta 1 + modifs locales

File size: 7.5 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.5 2009/03/06 18:24:07 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#include "PhysListEmLivermore.hh"
37#include "PhysListEmPenelope.hh"
38
39#include "G4LossTableManager.hh"
40#include "G4UnitsTable.hh"
41
42//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
44PhysicsList::PhysicsList() : G4VModularPhysicsList()
45{
46  G4LossTableManager::Instance();
47  pMessenger = new PhysicsListMessenger(this); 
48   
49  // EM physics
50  emName = G4String("standard");
51  emPhysicsList = new PhysListEmStandard(emName);
52   
53  defaultCutValue = 1.*mm;
54  cutForGamma     = defaultCutValue;
55  cutForElectron  = defaultCutValue;
56   
57  SetVerboseLevel(1);
58}
59
60//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61
62PhysicsList::~PhysicsList()
63{
64  delete emPhysicsList;
65  delete pMessenger; 
66}
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
70void PhysicsList::AddPhysicsList(const G4String& name)
71{
72  if (verboseLevel>1) {
73    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
74  }
75
76  if (name == emName) return;
77
78  if (name == "standard") {
79
80    emName = name;
81    delete emPhysicsList;
82    emPhysicsList = new PhysListEmStandard(name);
83       
84  } else if (name == "livermore") {
85
86    emName = name;
87    delete emPhysicsList;
88    emPhysicsList = new PhysListEmLivermore(name);
89   
90  } else if (name == "penelope") {
91
92    emName = name;
93    delete emPhysicsList;
94    emPhysicsList = new PhysListEmPenelope(name);
95
96  } else {
97
98    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
99           << " is not defined"
100           << G4endl;
101  }
102}
103
104//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
105
106// Bosons
107#include "G4ChargedGeantino.hh"
108#include "G4Geantino.hh"
109#include "G4Gamma.hh"
110
111// leptons
112#include "G4Electron.hh"
113#include "G4Positron.hh"
114
115#include "G4MuonPlus.hh"
116#include "G4MuonMinus.hh"
117
118// Mesons
119#include "G4PionPlus.hh"
120#include "G4PionMinus.hh"
121
122#include "G4KaonPlus.hh"
123#include "G4KaonMinus.hh"
124
125// Baryons
126#include "G4Proton.hh"
127#include "G4AntiProton.hh"
128#include "G4Neutron.hh"
129#include "G4AntiNeutron.hh"
130
131// Nuclei
132#include "G4Deuteron.hh"
133#include "G4Triton.hh"
134#include "G4Alpha.hh"
135#include "G4GenericIon.hh"
136
137void PhysicsList::ConstructParticle()
138{
139// pseudo-particles
140  G4Geantino::GeantinoDefinition();
141  G4ChargedGeantino::ChargedGeantinoDefinition();
142 
143// gamma
144  G4Gamma::GammaDefinition();
145
146// leptons
147  G4Electron::ElectronDefinition();
148  G4Positron::PositronDefinition();
149  G4MuonPlus::MuonPlusDefinition();
150  G4MuonMinus::MuonMinusDefinition();
151 
152// mesons
153  G4PionPlus::PionPlusDefinition();
154  G4PionMinus::PionMinusDefinition();
155  G4KaonPlus::KaonPlusDefinition();
156  G4KaonMinus::KaonMinusDefinition();
157 
158// baryons
159  G4Proton::ProtonDefinition();
160  G4AntiProton::AntiProtonDefinition();
161  G4Neutron::NeutronDefinition();
162  G4AntiNeutron::AntiNeutronDefinition();
163 
164// ions
165  G4Deuteron::DeuteronDefinition();
166  G4Triton::TritonDefinition();
167  G4Alpha::AlphaDefinition();
168  G4GenericIon::GenericIonDefinition();
169}
170
171//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
172
173#include "G4EmProcessOptions.hh"
174
175void PhysicsList::ConstructProcess()
176{
177  AddTransportation();
178  emPhysicsList->ConstructProcess();
179  AddStepMax();
180 
181  // Em options
182  //
183  G4EmProcessOptions emOptions;
184 
185  //physics tables
186  //
187  emOptions.SetMinEnergy(100*eV);       //default   
188  emOptions.SetMaxEnergy(100*TeV);      //default 
189  emOptions.SetDEDXBinning(12*20);      //default=12*7 
190  emOptions.SetLambdaBinning(12*20);    //default=12*7
191  emOptions.SetSplineFlag(true); 
192 
193  //energy loss
194  // 
195  emOptions.SetStepFunction(0.2, 10*um);        //default=(0.2, 1*mm)   
196  emOptions.SetLinearLossLimit(1.e-2);          //default
197         
198  //build CSDA range
199  //
200  emOptions.SetBuildCSDARange(true);
201  emOptions.SetMaxEnergyForCSDARange(100*TeV); 
202  emOptions.SetDEDXBinningForCSDARange(12*20);
203   
204  //ionization
205  //
206  emOptions.SetSubCutoff(false);        //default 
207}
208
209//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
210
211#include "G4ProcessManager.hh"
212#include "StepMax.hh"
213
214void PhysicsList::AddStepMax()
215{
216  // Step limitation seen as a process
217  StepMax* stepMaxProcess = new StepMax();
218
219  theParticleIterator->reset();
220  while ((*theParticleIterator)()){
221      G4ParticleDefinition* particle = theParticleIterator->value();
222      G4ProcessManager* pmanager = particle->GetProcessManager();
223
224      if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
225        {
226          pmanager ->AddDiscreteProcess(stepMaxProcess);
227        }
228  }
229}
230
231//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
232
233void PhysicsList::SetCuts()
234{
235  if (verboseLevel >0){
236    G4cout << "PhysicsList::SetCuts:";
237    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
238  }
239
240  // set cut values for gamma at first and for e- second and next for e+,
241  // because some processes for e+/e- need cut values for gamma
242  SetCutValue(cutForGamma, "gamma");
243  SetCutValue(cutForElectron, "e-");
244  SetCutValue(cutForElectron, "e+");
245
246  if (verboseLevel>0) DumpCutValuesTable();
247}
248
249//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
250
251void PhysicsList::SetCutForGamma(G4double cut)
252{
253  cutForGamma = cut;
254  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
255}
256
257//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
258
259void PhysicsList::SetCutForElectron(G4double cut)
260{
261  cutForElectron = cut;
262  SetParticleCuts(cutForElectron, G4Electron::Electron());
263  SetParticleCuts(cutForElectron, G4Positron::Positron());
264}
265
266//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.