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

Last change on this file since 1237 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

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