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

Last change on this file since 1303 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

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