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

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

update

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