source: trunk/examples/extended/electromagnetic/TestEm7/src/PhysicsList.cc@ 1353

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

tag geant4.9.4 beta 1 + modifs locales

File size: 9.6 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.39 2010/06/04 15:42:23 vnivanch 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 "PhysListEmStandardNR.hh"
38#include "G4EmStandardPhysics.hh"
39#include "G4EmStandardPhysics_option1.hh"
40#include "G4EmStandardPhysics_option2.hh"
41#include "G4EmStandardPhysics_option3.hh"
42#include "G4EmLivermorePhysics.hh"
43#include "G4EmPenelopePhysics.hh"
44
45#include "G4DecayPhysics.hh"
46
47#include "G4HadronElasticPhysics.hh"
48#include "G4HadronDElasticPhysics.hh"
49#include "G4HadronHElasticPhysics.hh"
50#include "G4HadronQElasticPhysics.hh"
51#include "G4HadronInelasticQBBC.hh"
52#include "G4IonBinaryCascadePhysics.hh"
53
54#include "G4LossTableManager.hh"
55#include "G4EmConfigurator.hh"
56#include "G4UnitsTable.hh"
57
58#include "G4ProcessManager.hh"
59#include "G4Decay.hh"
60
61#include "StepMax.hh"
62
63#include "G4IonFluctuations.hh"
64#include "G4IonParametrisedLossModel.hh"
65#include "G4UniversalFluctuation.hh"
66
67#include "G4BraggIonGasModel.hh"
68#include "G4BetheBlochIonGasModel.hh"
69
70//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71
72PhysicsList::PhysicsList() : G4VModularPhysicsList()
73{
74 G4LossTableManager::Instance();
75 defaultCutValue = 1.*mm;
76 cutForGamma = defaultCutValue;
77 cutForElectron = defaultCutValue;
78 cutForPositron = defaultCutValue;
79
80 helIsRegisted = false;
81 bicIsRegisted = false;
82 biciIsRegisted = false;
83
84 stepMaxProcess = 0;
85
86 pMessenger = new PhysicsListMessenger(this);
87
88 SetVerboseLevel(1);
89
90 // EM physics
91 emName = G4String("emstandard_opt0");
92 emPhysicsList = new G4EmStandardPhysics(1);
93
94 // Deacy physics and all particles
95 decPhysicsList = new G4DecayPhysics();
96}
97
98//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
99
100PhysicsList::~PhysicsList()
101{
102 delete pMessenger;
103 delete emPhysicsList;
104 delete decPhysicsList;
105 for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
106}
107
108//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
109
110void PhysicsList::ConstructParticle()
111{
112 decPhysicsList->ConstructParticle();
113}
114
115//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
116
117void PhysicsList::ConstructProcess()
118{
119 // transportation
120 //
121 AddTransportation();
122
123 // electromagnetic physics list
124 //
125 emPhysicsList->ConstructProcess();
126
127 // decay physics list
128 //
129 decPhysicsList->ConstructProcess();
130
131 // hadronic physics lists
132 for(size_t i=0; i<hadronPhys.size(); i++) {
133 hadronPhys[i]->ConstructProcess();
134 }
135
136 // step limitation (as a full process)
137 //
138 AddStepMax();
139}
140
141//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
142
143void PhysicsList::AddPhysicsList(const G4String& name)
144{
145 if (verboseLevel>1) {
146 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
147 }
148
149 if (name == emName) return;
150
151 if (name == "local") {
152
153 emName = name;
154 delete emPhysicsList;
155 emPhysicsList = new PhysListEmStandard(name);
156
157 } else if (name == "emstandard_opt0") {
158
159 emName = name;
160 delete emPhysicsList;
161 emPhysicsList = new G4EmStandardPhysics(1);
162
163 } else if (name == "emstandard_opt1") {
164
165 emName = name;
166 delete emPhysicsList;
167 emPhysicsList = new G4EmStandardPhysics_option1();
168
169 } else if (name == "emstandard_opt2") {
170
171 emName = name;
172 delete emPhysicsList;
173 emPhysicsList = new G4EmStandardPhysics_option2();
174
175 } else if (name == "emstandard_opt3") {
176
177 emName = name;
178 delete emPhysicsList;
179 emPhysicsList = new G4EmStandardPhysics_option3();
180
181 } else if (name == "standardSS") {
182
183 emName = name;
184 delete emPhysicsList;
185 emPhysicsList = new PhysListEmStandardSS(name);
186
187 } else if (name == "ionGasModels") {
188
189 AddPhysicsList("emstandard_opt0");
190 emName = name;
191 AddIonGasModels();
192
193 } else if (name == "standardNR") {
194
195 emName = name;
196 delete emPhysicsList;
197 emPhysicsList = new PhysListEmStandardNR(name);
198
199 } else if (name == "emlivermore") {
200 emName = name;
201 delete emPhysicsList;
202 emPhysicsList = new G4EmLivermorePhysics();
203
204 } else if (name == "empenelope") {
205 emName = name;
206 delete emPhysicsList;
207 emPhysicsList = new G4EmPenelopePhysics();
208
209 } else if (name == "elastic" && !helIsRegisted) {
210 hadronPhys.push_back( new G4HadronElasticPhysics());
211 helIsRegisted = true;
212
213 } else if (name == "DElastic" && !helIsRegisted) {
214 hadronPhys.push_back( new G4HadronDElasticPhysics());
215 helIsRegisted = true;
216
217 } else if (name == "HElastic" && !helIsRegisted) {
218 hadronPhys.push_back( new G4HadronHElasticPhysics());
219 helIsRegisted = true;
220
221 } else if (name == "QElastic" && !helIsRegisted) {
222 hadronPhys.push_back( new G4HadronQElasticPhysics());
223 helIsRegisted = true;
224
225 } else if (name == "binary" && !bicIsRegisted) {
226 hadronPhys.push_back(new G4HadronInelasticQBBC());
227 bicIsRegisted = true;
228
229 } else if (name == "binary_ion" && !biciIsRegisted) {
230 hadronPhys.push_back(new G4IonBinaryCascadePhysics());
231 biciIsRegisted = true;
232
233 } else {
234
235 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
236 << " is not defined"
237 << G4endl;
238 }
239}
240
241//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
242
243void PhysicsList::AddStepMax()
244{
245 // Step limitation seen as a process
246 stepMaxProcess = new StepMax();
247
248 theParticleIterator->reset();
249 while ((*theParticleIterator)()){
250 G4ParticleDefinition* particle = theParticleIterator->value();
251 G4ProcessManager* pmanager = particle->GetProcessManager();
252
253 if (stepMaxProcess->IsApplicable(*particle) && pmanager)
254 {
255 pmanager ->AddDiscreteProcess(stepMaxProcess);
256 }
257 }
258}
259
260//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
261
262void PhysicsList::SetCuts()
263{
264
265 if (verboseLevel >0){
266 G4cout << "PhysicsList::SetCuts:";
267 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
268 }
269
270 // set cut values for gamma at first and for e- second and next for e+,
271 // because some processes for e+/e- need cut values for gamma
272 SetCutValue(cutForGamma, "gamma");
273 SetCutValue(cutForElectron, "e-");
274 SetCutValue(cutForPositron, "e+");
275
276 if (verboseLevel>0) DumpCutValuesTable();
277}
278
279//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
280
281void PhysicsList::SetCutForGamma(G4double cut)
282{
283 cutForGamma = cut;
284 SetParticleCuts(cutForGamma, G4Gamma::Gamma());
285}
286
287//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
288
289void PhysicsList::SetCutForElectron(G4double cut)
290{
291 cutForElectron = cut;
292 SetParticleCuts(cutForElectron, G4Electron::Electron());
293}
294
295//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
296
297void PhysicsList::SetCutForPositron(G4double cut)
298{
299 cutForPositron = cut;
300 SetParticleCuts(cutForPositron, G4Positron::Positron());
301}
302
303//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
304
305void PhysicsList::AddIonGasModels()
306{
307 G4EmConfigurator* em_config = G4LossTableManager::Instance()->EmConfigurator();
308 theParticleIterator->reset();
309 while ((*theParticleIterator)())
310 {
311 G4ParticleDefinition* particle = theParticleIterator->value();
312 G4String partname = particle->GetParticleName();
313 if(partname == "alpha" || partname == "He3" || partname == "GenericIon") {
314 G4BraggIonGasModel* mod1 = new G4BraggIonGasModel();
315 G4BetheBlochIonGasModel* mod2 = new G4BetheBlochIonGasModel();
316 G4double eth = 2.*MeV*particle->GetPDGMass()/proton_mass_c2;
317 em_config->SetExtraEmModel(partname,"ionIoni",mod1,"",0.0,eth,
318 new G4IonFluctuations());
319 em_config->SetExtraEmModel(partname,"ionIoni",mod2,"",eth,100*TeV,
320 new G4UniversalFluctuation());
321
322 }
323 }
324}
325
326//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
327
Note: See TracBrowser for help on using the repository browser.