source: trunk/examples/extended/electromagnetic/TestEm12/src/PhysicsList.cc

Last change on this file 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.9 2010/05/20 13:13:33 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
276 } else {
277
278 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
279 << " is not defined"
280 << G4endl;
281 }
282}
283
284//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
285
286#include "G4Decay.hh"
287
288void PhysicsList::AddDecay()
289{
290 // decay process
291 //
292 G4Decay* fDecayProcess = new G4Decay();
293
294 theParticleIterator->reset();
295 while( (*theParticleIterator)() ){
296 G4ParticleDefinition* particle = theParticleIterator->value();
297 G4ProcessManager* pmanager = particle->GetProcessManager();
298
299 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
300
301 pmanager ->AddProcess(fDecayProcess);
302
303 // set ordering for PostStepDoIt and AtRestDoIt
304 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
305 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
306
307 }
308 }
309}
310
311//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
312
313#include "StepMax.hh"
314
315void PhysicsList::AddStepMax()
316{
317 // Step limitation seen as a process
318 stepMaxProcess = new StepMax();
319
320 theParticleIterator->reset();
321 while ((*theParticleIterator)()){
322 G4ParticleDefinition* particle = theParticleIterator->value();
323 G4ProcessManager* pmanager = particle->GetProcessManager();
324
325 if (stepMaxProcess->IsApplicable(*particle))
326 {
327 pmanager ->AddDiscreteProcess(stepMaxProcess);
328 }
329 }
330}
331
332//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
333
334#include "G4Gamma.hh"
335#include "G4Electron.hh"
336#include "G4Positron.hh"
337
338void PhysicsList::SetCuts()
339{
340
341 if (verboseLevel >0){
342 G4cout << "PhysicsList::SetCuts:";
343 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
344 }
345
346 // set cut values for gamma at first and for e- second and next for e+,
347 // because some processes for e+/e- need cut values for gamma
348 SetCutValue(cutForGamma, "gamma");
349 SetCutValue(cutForElectron, "e-");
350 SetCutValue(cutForPositron, "e+");
351
352 if (verboseLevel>0) DumpCutValuesTable();
353}
354
355//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
356
357void PhysicsList::SetCutForGamma(G4double cut)
358{
359 cutForGamma = cut;
360 SetParticleCuts(cutForGamma, G4Gamma::Gamma());
361}
362
363//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
364
365void PhysicsList::SetCutForElectron(G4double cut)
366{
367 cutForElectron = cut;
368 SetParticleCuts(cutForElectron, G4Electron::Electron());
369}
370
371//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
372
373void PhysicsList::SetCutForPositron(G4double cut)
374{
375 cutForPositron = cut;
376 SetParticleCuts(cutForPositron, G4Positron::Positron());
377}
378
379//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
380
Note: See TracBrowser for help on using the repository browser.