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

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

update

File size: 9.8 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.21 2007/11/19 14:57:07 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-01-patch-02 $
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 "PhysListEmStandardIG.hh"
38#include "PhysListEmLivermore.hh"
39#include "PhysListEmPenelope.hh"
40
41#include "G4EmStandardPhysics.hh"
42#include "G4EmStandardPhysics_option1.hh"
43#include "G4EmStandardPhysics_option2.hh"
44
45#include "G4HadronElasticPhysics.hh"
46#include "G4HadronDElasticPhysics.hh"
47#include "G4HadronHElasticPhysics.hh"
48#include "G4HadronQElasticPhysics.hh"
49#include "G4HadronInelasticQBBC.hh"
50#include "G4IonBinaryCascadePhysics.hh"
51
52#include "G4LossTableManager.hh"
53#include "G4UnitsTable.hh"
54
55#include "G4ParticleDefinition.hh"
56#include "G4ProcessManager.hh"
57#include "G4Decay.hh"
58#include "StepMax.hh"
59
60// Bosons
61#include "G4ChargedGeantino.hh"
62#include "G4Geantino.hh"
63#include "G4Gamma.hh"
64#include "G4OpticalPhoton.hh"
65
66// leptons
67#include "G4MuonPlus.hh"
68#include "G4MuonMinus.hh"
69#include "G4NeutrinoMu.hh"
70#include "G4AntiNeutrinoMu.hh"
71
72#include "G4Electron.hh"
73#include "G4Positron.hh"
74#include "G4NeutrinoE.hh"
75#include "G4AntiNeutrinoE.hh"
76
77// Hadrons
78#include "G4MesonConstructor.hh"
79#include "G4BaryonConstructor.hh"
80#include "G4IonConstructor.hh"
81
82//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83
84PhysicsList::PhysicsList() : G4VModularPhysicsList()
85{
86 G4LossTableManager::Instance();
87 pMessenger = new PhysicsListMessenger(this);
88
89 // EM physics
90 emName = G4String("standard");
91 emPhysicsList = new PhysListEmStandard(emName);
92
93 helIsRegisted = false;
94 bicIsRegisted = false;
95 biciIsRegisted = false;
96
97 stepMaxProcess = 0;
98
99 defaultCutValue = 1.*mm;
100 cutForGamma = defaultCutValue;
101 cutForElectron = defaultCutValue;
102 cutForPositron = defaultCutValue;
103
104 SetVerboseLevel(1);
105}
106
107//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108
109PhysicsList::~PhysicsList()
110{
111 delete emPhysicsList;
112 for(size_t i=0; i<hadronPhys.size(); i++) delete hadronPhys[i];
113 delete pMessenger;
114}
115
116//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
117
118void PhysicsList::ConstructParticle()
119{
120// pseudo-particles
121 G4Geantino::GeantinoDefinition();
122 G4ChargedGeantino::ChargedGeantinoDefinition();
123
124// gamma
125 G4Gamma::GammaDefinition();
126
127// optical photon
128 G4OpticalPhoton::OpticalPhotonDefinition();
129
130// leptons
131 G4Electron::ElectronDefinition();
132 G4Positron::PositronDefinition();
133 G4MuonPlus::MuonPlusDefinition();
134 G4MuonMinus::MuonMinusDefinition();
135
136 G4NeutrinoE::NeutrinoEDefinition();
137 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
138 G4NeutrinoMu::NeutrinoMuDefinition();
139 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
140
141// mesons
142 G4MesonConstructor mConstructor;
143 mConstructor.ConstructParticle();
144
145// barions
146 G4BaryonConstructor bConstructor;
147 bConstructor.ConstructParticle();
148
149// ions
150 G4IonConstructor iConstructor;
151 iConstructor.ConstructParticle();
152}
153
154//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
155
156void PhysicsList::ConstructProcess()
157{
158 AddTransportation();
159 emPhysicsList->ConstructProcess();
160 for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess();
161 AddDecay();
162 AddStepMax();
163}
164
165//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
166
167void PhysicsList::AddDecay()
168{
169 // Add Decay Process
170
171 G4Decay* fDecayProcess = new G4Decay();
172
173 theParticleIterator->reset();
174 while( (*theParticleIterator)() ){
175 G4ParticleDefinition* particle = theParticleIterator->value();
176 G4ProcessManager* pmanager = particle->GetProcessManager();
177
178 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
179
180 pmanager ->AddProcess(fDecayProcess);
181
182 // set ordering for PostStepDoIt and AtRestDoIt
183 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
184 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
185
186 }
187 }
188}
189
190//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
191
192void PhysicsList::AddStepMax()
193{
194 // Step limitation seen as a process
195 stepMaxProcess = new StepMax();
196
197 theParticleIterator->reset();
198 while ((*theParticleIterator)()){
199 G4ParticleDefinition* particle = theParticleIterator->value();
200 G4ProcessManager* pmanager = particle->GetProcessManager();
201
202 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
203 {
204 pmanager ->AddDiscreteProcess(stepMaxProcess);
205 }
206 }
207}
208
209//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
210
211void PhysicsList::AddPhysicsList(const G4String& name)
212{
213 if (verboseLevel>-1) {
214 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
215 }
216
217 if (name == emName) return;
218
219 if (name == "standard") {
220
221 emName = name;
222 delete emPhysicsList;
223 emPhysicsList = new PhysListEmStandard(name);
224
225 } else if (name == "emstandard") {
226
227 emName = name;
228 delete emPhysicsList;
229 emPhysicsList = new G4EmStandardPhysics();
230
231 } else if (name == "emstandard_opt1") {
232
233 emName = name;
234 delete emPhysicsList;
235 emPhysicsList = new G4EmStandardPhysics_option1();
236
237 } else if (name == "emstandard_opt2") {
238
239 emName = name;
240 delete emPhysicsList;
241 emPhysicsList = new G4EmStandardPhysics_option2();
242
243 } else if (name == "standardSS") {
244
245 emName = name;
246 delete emPhysicsList;
247 emPhysicsList = new PhysListEmStandardSS(name);
248
249 } else if (name == "standardIG") {
250
251 emName = name;
252 delete emPhysicsList;
253 emPhysicsList = new PhysListEmStandardIG(name);
254
255 } else if (name == "livermore") {
256
257 emName = name;
258 delete emPhysicsList;
259 emPhysicsList = new PhysListEmLivermore(name);
260
261 } else if (name == "penelope") {
262
263 emName = name;
264 delete emPhysicsList;
265 emPhysicsList = new PhysListEmPenelope(name);
266
267 } else if (name == "elastic" && !helIsRegisted) {
268 hadronPhys.push_back( new G4HadronElasticPhysics());
269 helIsRegisted = true;
270
271 } else if (name == "DElastic" && !helIsRegisted) {
272 hadronPhys.push_back( new G4HadronDElasticPhysics());
273 helIsRegisted = true;
274
275 } else if (name == "HElastic" && !helIsRegisted) {
276 hadronPhys.push_back( new G4HadronHElasticPhysics());
277 helIsRegisted = true;
278
279 } else if (name == "QElastic" && !helIsRegisted) {
280 hadronPhys.push_back( new G4HadronQElasticPhysics());
281 helIsRegisted = true;
282
283 } else if (name == "binary" && !bicIsRegisted) {
284 hadronPhys.push_back(new G4HadronInelasticQBBC());
285 bicIsRegisted = true;
286
287 } else if (name == "binary_ion" && !biciIsRegisted) {
288 hadronPhys.push_back(new G4IonBinaryCascadePhysics());
289 biciIsRegisted = true;
290
291 } else {
292
293 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
294 << " is not defined"
295 << G4endl;
296 }
297}
298
299//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
300
301void PhysicsList::SetCuts()
302{
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 if (verboseLevel>0) DumpCutValuesTable();
316}
317
318//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
319
320void PhysicsList::SetCutForGamma(G4double cut)
321{
322 cutForGamma = cut;
323 SetParticleCuts(cutForGamma, G4Gamma::Gamma());
324}
325
326//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
327
328void PhysicsList::SetCutForElectron(G4double cut)
329{
330 cutForElectron = cut;
331 SetParticleCuts(cutForElectron, G4Electron::Electron());
332}
333
334//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
335
336void PhysicsList::SetCutForPositron(G4double cut)
337{
338 cutForPositron = cut;
339 SetParticleCuts(cutForPositron, G4Positron::Positron());
340}
341
342//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
343
Note: See TracBrowser for help on using the repository browser.