source: trunk/examples/extended/electromagnetic/TestEm2/src/PhysicsList.cc@ 1036

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

update

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