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

Last change on this file since 1190 was 807, checked in by garnier, 17 years ago

update

File size: 7.3 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.2 2007/11/20 14:15:18 maire 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 "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);
188 emOptions.SetMaxEnergy(100*TeV);
189 emOptions.SetDEDXBinning(1200);
190 emOptions.SetLambdaBinning(1200);
191
192 //energy loss
193 //
194 emOptions.SetStepFunction(0.2, 10*um);
195 emOptions.SetLinearLossLimit(1.e-6);
196
197 //build CSDA range
198 //
199 emOptions.SetBuildCSDARange(true);
200 emOptions.SetMaxEnergyForCSDARange(100*TeV);
201 emOptions.SetDEDXBinningForCSDARange(1200);
202}
203
204//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
205
206#include "G4ProcessManager.hh"
207#include "StepMax.hh"
208
209void PhysicsList::AddStepMax()
210{
211 // Step limitation seen as a process
212 StepMax* stepMaxProcess = new StepMax();
213
214 theParticleIterator->reset();
215 while ((*theParticleIterator)()){
216 G4ParticleDefinition* particle = theParticleIterator->value();
217 G4ProcessManager* pmanager = particle->GetProcessManager();
218
219 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
220 {
221 pmanager ->AddDiscreteProcess(stepMaxProcess);
222 }
223 }
224}
225
226//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
227
228void PhysicsList::SetCuts()
229{
230
231 if (verboseLevel >0){
232 G4cout << "PhysicsList::SetCuts:";
233 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
234 }
235
236 // set cut values for gamma at first and for e- second and next for e+,
237 // because some processes for e+/e- need cut values for gamma
238 SetCutValue(cutForGamma, "gamma");
239 SetCutValue(cutForElectron, "e-");
240 SetCutValue(cutForElectron, "e+");
241
242 if (verboseLevel>0) DumpCutValuesTable();
243}
244
245//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
246
247void PhysicsList::SetCutForGamma(G4double cut)
248{
249 cutForGamma = cut;
250 SetParticleCuts(cutForGamma, G4Gamma::Gamma());
251}
252
253//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
254
255void PhysicsList::SetCutForElectron(G4double cut)
256{
257 cutForElectron = cut;
258 SetParticleCuts(cutForElectron, G4Electron::Electron());
259 SetParticleCuts(cutForElectron, G4Positron::Positron());
260}
261
262//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.