source: trunk/examples/extended/electromagnetic/TestEm11/src/PhysicsList.cc@ 1351

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

tag geant4.9.4 beta 1 + modifs locales

File size: 10.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.8 2010/05/20 13:02:41 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 "PhysListEmStandardSS.hh"
37#include "PhysListEmStandardGS.hh"
38#include "PhysListEmStandardWVI.hh"
39
40#include "G4EmStandardPhysics.hh"
41#include "G4EmStandardPhysics_option1.hh"
42#include "G4EmStandardPhysics_option2.hh"
43#include "G4EmStandardPhysics_option3.hh"
44#include "G4EmLivermorePhysics.hh"
45#include "G4EmPenelopePhysics.hh"
46
47#include "G4LossTableManager.hh"
48#include "G4UnitsTable.hh"
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51
52PhysicsList::PhysicsList() : G4VModularPhysicsList()
53{
54 G4LossTableManager::Instance();
55 defaultCutValue = 1.*mm;
56 cutForGamma = defaultCutValue;
57 cutForElectron = defaultCutValue;
58 cutForPositron = defaultCutValue;
59
60 stepMaxProcess = 0;
61
62 pMessenger = new PhysicsListMessenger(this);
63
64 SetVerboseLevel(1);
65
66 // EM physics
67 emPhysicsList = new PhysListEmStandard(emName = "local");
68
69}
70
71//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72
73PhysicsList::~PhysicsList()
74{
75 delete pMessenger;
76 delete emPhysicsList;
77}
78
79//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80
81// Bosons
82#include "G4ChargedGeantino.hh"
83#include "G4Geantino.hh"
84#include "G4Gamma.hh"
85#include "G4OpticalPhoton.hh"
86
87// leptons
88#include "G4MuonPlus.hh"
89#include "G4MuonMinus.hh"
90#include "G4NeutrinoMu.hh"
91#include "G4AntiNeutrinoMu.hh"
92
93#include "G4Electron.hh"
94#include "G4Positron.hh"
95#include "G4NeutrinoE.hh"
96#include "G4AntiNeutrinoE.hh"
97
98// Mesons
99#include "G4PionPlus.hh"
100#include "G4PionMinus.hh"
101#include "G4PionZero.hh"
102#include "G4Eta.hh"
103#include "G4EtaPrime.hh"
104
105#include "G4KaonPlus.hh"
106#include "G4KaonMinus.hh"
107#include "G4KaonZero.hh"
108#include "G4AntiKaonZero.hh"
109#include "G4KaonZeroLong.hh"
110#include "G4KaonZeroShort.hh"
111
112// Baryons
113#include "G4Proton.hh"
114#include "G4AntiProton.hh"
115#include "G4Neutron.hh"
116#include "G4AntiNeutron.hh"
117
118// Nuclei
119#include "G4Alpha.hh"
120#include "G4Deuteron.hh"
121#include "G4Triton.hh"
122#include "G4He3.hh"
123#include "G4GenericIon.hh"
124
125//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
126
127void PhysicsList::ConstructParticle()
128{
129// pseudo-particles
130 G4Geantino::GeantinoDefinition();
131 G4ChargedGeantino::ChargedGeantinoDefinition();
132
133// gamma
134 G4Gamma::GammaDefinition();
135
136// optical photon
137 G4OpticalPhoton::OpticalPhotonDefinition();
138
139// leptons
140 G4Electron::ElectronDefinition();
141 G4Positron::PositronDefinition();
142 G4MuonPlus::MuonPlusDefinition();
143 G4MuonMinus::MuonMinusDefinition();
144
145 G4NeutrinoE::NeutrinoEDefinition();
146 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
147 G4NeutrinoMu::NeutrinoMuDefinition();
148 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
149
150// mesons
151 G4PionPlus::PionPlusDefinition();
152 G4PionMinus::PionMinusDefinition();
153 G4PionZero::PionZeroDefinition();
154 G4Eta::EtaDefinition();
155 G4EtaPrime::EtaPrimeDefinition();
156 G4KaonPlus::KaonPlusDefinition();
157 G4KaonMinus::KaonMinusDefinition();
158 G4KaonZero::KaonZeroDefinition();
159 G4AntiKaonZero::AntiKaonZeroDefinition();
160 G4KaonZeroLong::KaonZeroLongDefinition();
161 G4KaonZeroShort::KaonZeroShortDefinition();
162
163// barions
164 G4Proton::ProtonDefinition();
165 G4AntiProton::AntiProtonDefinition();
166 G4Neutron::NeutronDefinition();
167 G4AntiNeutron::AntiNeutronDefinition();
168
169// ions
170 G4Deuteron::DeuteronDefinition();
171 G4Triton::TritonDefinition();
172 G4He3::He3Definition();
173 G4Alpha::AlphaDefinition();
174 G4GenericIon::GenericIonDefinition();
175}
176
177//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
178
179#include "G4ProcessManager.hh"
180#include "G4EmProcessOptions.hh"
181
182void PhysicsList::ConstructProcess()
183{
184 // transportation
185 //
186 AddTransportation();
187
188 // electromagnetic physics list
189 //
190 emPhysicsList->ConstructProcess();
191
192 // Em options
193 //
194 G4EmProcessOptions emOptions;
195 emOptions.SetBuildCSDARange(true);
196 emOptions.SetDEDXBinningForCSDARange(8*20);
197
198 // decay process
199 //
200 AddDecay();
201
202 // step limitation (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 == "standardSS") {
248
249 emName = name;
250 delete emPhysicsList;
251 emPhysicsList = new PhysListEmStandardSS(name);
252
253 } else if (name == "standardGS") {
254
255 emName = name;
256 delete emPhysicsList;
257 emPhysicsList = new PhysListEmStandardGS(name);
258
259 } else if (name == "standardWVI") {
260
261 emName = name;
262 delete emPhysicsList;
263 emPhysicsList = new PhysListEmStandardWVI(name);
264
265 } else if (name == "emlivermore") {
266 emName = name;
267 delete emPhysicsList;
268 emPhysicsList = new G4EmLivermorePhysics();
269
270 } else if (name == "empenelope") {
271 emName = name;
272 delete emPhysicsList;
273 emPhysicsList = new G4EmPenelopePhysics();
274
275 } else {
276
277 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
278 << " is not defined"
279 << G4endl;
280 }
281}
282
283//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
284
285#include "G4Decay.hh"
286
287void PhysicsList::AddDecay()
288{
289 // decay process
290 //
291 G4Decay* fDecayProcess = new G4Decay();
292
293 theParticleIterator->reset();
294 while( (*theParticleIterator)() ){
295 G4ParticleDefinition* particle = theParticleIterator->value();
296 G4ProcessManager* pmanager = particle->GetProcessManager();
297
298 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
299
300 pmanager ->AddProcess(fDecayProcess);
301
302 // set ordering for PostStepDoIt and AtRestDoIt
303 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
304 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
305
306 }
307 }
308}
309
310//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
311
312#include "StepMax.hh"
313
314void PhysicsList::AddStepMax()
315{
316 // Step limitation seen as a process
317 stepMaxProcess = new StepMax();
318
319 theParticleIterator->reset();
320 while ((*theParticleIterator)()){
321 G4ParticleDefinition* particle = theParticleIterator->value();
322 G4ProcessManager* pmanager = particle->GetProcessManager();
323
324 if (stepMaxProcess->IsApplicable(*particle))
325 {
326 pmanager ->AddDiscreteProcess(stepMaxProcess);
327 }
328 }
329}
330
331//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
332
333#include "G4Gamma.hh"
334#include "G4Electron.hh"
335#include "G4Positron.hh"
336
337void PhysicsList::SetCuts()
338{
339
340 if (verboseLevel >0){
341 G4cout << "PhysicsList::SetCuts:";
342 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
343 }
344
345 // set cut values for gamma at first and for e- second and next for e+,
346 // because some processes for e+/e- need cut values for gamma
347 SetCutValue(cutForGamma, "gamma");
348 SetCutValue(cutForElectron, "e-");
349 SetCutValue(cutForPositron, "e+");
350
351 if (verboseLevel>0) DumpCutValuesTable();
352}
353
354//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
355
356void PhysicsList::SetCutForGamma(G4double cut)
357{
358 cutForGamma = cut;
359 SetParticleCuts(cutForGamma, G4Gamma::Gamma());
360}
361
362//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
363
364void PhysicsList::SetCutForElectron(G4double cut)
365{
366 cutForElectron = cut;
367 SetParticleCuts(cutForElectron, G4Electron::Electron());
368}
369
370//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
371
372void PhysicsList::SetCutForPositron(G4double cut)
373{
374 cutForPositron = cut;
375 SetParticleCuts(cutForPositron, G4Positron::Positron());
376}
377
378//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
379
Note: See TracBrowser for help on using the repository browser.