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

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

tag geant4.9.4 beta 1 + modifs locales

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