source: trunk/examples/extended/electromagnetic/TestEm9/src/PhysicsList.cc@ 1228

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

update

File size: 10.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.19 2007/11/13 14:44:26 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-01-patch-02 $
28//
29//---------------------------------------------------------------------------
30//
31// ClassName: PhysicsList
32//
33// Author: V.Ivanchenko 14.10.2002
34//
35// Modified:
36// 17.11.06 Use components from physics_lists subdirectory (V.Ivanchenko)
37//
38//----------------------------------------------------------------------------
39//
40
41//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
44#include "PhysicsList.hh"
45#include "PhysicsListMessenger.hh"
46
47#include "PhysListEmStandard.hh"
48#include "PhysListEmStandardIG.hh"
49#include "G4EmStandardPhysics.hh"
50#include "G4EmStandardPhysics_option1.hh"
51#include "G4EmStandardPhysics_option2.hh"
52#include "PhysListEmLivermore.hh"
53#include "PhysListEmPenelope.hh"
54#include "G4DecayPhysics.hh"
55#include "G4HadronElasticPhysics.hh"
56#include "G4HadronInelasticQBBC.hh"
57#include "G4IonBinaryCascadePhysics.hh"
58#include "G4EmExtraPhysics.hh"
59#include "G4QStoppingPhysics.hh"
60
61#include "G4RegionStore.hh"
62#include "G4Region.hh"
63#include "G4ProductionCuts.hh"
64#include "G4ProcessManager.hh"
65#include "G4ParticleTypes.hh"
66#include "G4ParticleTable.hh"
67
68#include "G4Gamma.hh"
69#include "G4Electron.hh"
70#include "G4Positron.hh"
71
72#include "G4UnitsTable.hh"
73#include "G4LossTableManager.hh"
74#include "StepMax.hh"
75
76#include "G4EmProcessOptions.hh"
77
78//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79
80PhysicsList::PhysicsList() : G4VModularPhysicsList()
81{
82 G4LossTableManager::Instance();
83 defaultCutValue = 1.*mm;
84 cutForGamma = defaultCutValue;
85 cutForElectron = defaultCutValue;
86 cutForPositron = defaultCutValue;
87
88 vertexDetectorCuts = 0;
89 muonDetectorCuts = 0;
90
91 pMessenger = new PhysicsListMessenger(this);
92 stepMaxProcess = new StepMax();
93
94 // Initilise flags
95
96 SetVerboseLevel(1);
97
98 mscStepLimit = true;
99 helIsRegisted = false;
100 bicIsRegisted = false;
101 gnucIsRegisted = false;
102 stopIsRegisted = false;
103
104 // Decay Physics is always defined
105 generalPhysicsList = new G4DecayPhysics();
106
107 // EM physics
108 emName = G4String("standard");
109 emPhysicsList = new PhysListEmStandard(emName);
110}
111
112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113
114PhysicsList::~PhysicsList()
115{
116 delete pMessenger;
117 delete generalPhysicsList;
118 delete emPhysicsList;
119 delete stepMaxProcess;
120 for(size_t i=0; i<hadronPhys.size(); i++) {
121 delete hadronPhys[i];
122 }
123}
124
125//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
126
127void PhysicsList::ConstructParticle()
128{
129 generalPhysicsList->ConstructParticle();
130}
131
132//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133
134void PhysicsList::ConstructProcess()
135{
136 AddTransportation();
137 emPhysicsList->ConstructProcess();
138 generalPhysicsList->ConstructProcess();
139 for(size_t i=0; i<hadronPhys.size(); i++) {
140 hadronPhys[i]->ConstructProcess();
141 }
142 AddStepMax();
143}
144
145//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
146
147void PhysicsList::AddPhysicsList(const G4String& name)
148{
149 if (verboseLevel > 1)
150 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
151
152 if (name == emName) return;
153
154 if (name == "emstandard") {
155 emName = name;
156 delete emPhysicsList;
157 emPhysicsList = new G4EmStandardPhysics();
158 if (verboseLevel > 0)
159 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
160
161 } else if (name == "emstandard_opt1") {
162 emName = name;
163 delete emPhysicsList;
164 emPhysicsList = new G4EmStandardPhysics_option1();
165 if (verboseLevel > 0)
166 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
167
168 } else if (name == "emstandard_opt2") {
169 emName = name;
170 delete emPhysicsList;
171 emPhysicsList = new G4EmStandardPhysics_option2();
172 if (verboseLevel > 0)
173 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
174
175 } else if (name == "standard") {
176 emName = name;
177 delete emPhysicsList;
178 emPhysicsList = new PhysListEmStandard();
179 if (verboseLevel > 0)
180 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
181
182 } else if (name == "standardIG") {
183 emName = name;
184 delete emPhysicsList;
185 emPhysicsList = new PhysListEmStandardIG();
186 if (verboseLevel > 0)
187 G4cout << "PhysicsList::Set StandardIG EM physics" << G4endl;
188
189 } else if (name == "livermore") {
190 emName = name;
191 delete emPhysicsList;
192 emPhysicsList = new PhysListEmLivermore();
193 if (verboseLevel > 0)
194 G4cout << "PhysicsList::Set Livermore EM physics" << G4endl;
195
196 } else if (name == "penelope") {
197 emName = name;
198 delete emPhysicsList;
199 emPhysicsList = new PhysListEmPenelope();
200 if (verboseLevel > 0)
201 G4cout << "PhysicsList::Set Penelope EM physics" << G4endl;
202
203 } else if (name == "elastic" && !helIsRegisted) {
204 hadronPhys.push_back( new G4HadronElasticPhysics(name));
205 helIsRegisted = true;
206 if (verboseLevel > 0)
207 G4cout << "PhysicsList::Add hadron elastic physics" << G4endl;
208
209 } else if (name == "binary" && !bicIsRegisted) {
210 hadronPhys.push_back(new G4HadronInelasticQBBC());
211 hadronPhys.push_back(new G4IonBinaryCascadePhysics());
212 bicIsRegisted = true;
213 if (verboseLevel > 0)
214 G4cout << "PhysicsList::Add hadron inelastic physics from <QBBC>" << G4endl;
215
216 } else if (name == "gamma_nuc" && !gnucIsRegisted) {
217 hadronPhys.push_back(new G4EmExtraPhysics());
218 gnucIsRegisted = true;
219 if (verboseLevel > 0)
220 G4cout << "PhysicsList::Add gamma- and electro-nuclear physics" << G4endl;
221
222 } else if (name == "stopping" && !stopIsRegisted) {
223 hadronPhys.push_back(new G4QStoppingPhysics());
224 gnucIsRegisted = true;
225 if (verboseLevel > 0)
226 G4cout << "PhysicsList::Add stopping physics" << G4endl;
227
228 } else {
229 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
230 << " is not defined"
231 << G4endl;
232 }
233}
234
235//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
236
237void PhysicsList::AddStepMax()
238{
239 // Step limitation seen as a process
240
241 theParticleIterator->reset();
242 while ((*theParticleIterator)()){
243 G4ParticleDefinition* particle = theParticleIterator->value();
244 G4ProcessManager* pmanager = particle->GetProcessManager();
245
246 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
247 {
248 pmanager ->AddDiscreteProcess(stepMaxProcess);
249 }
250 }
251}
252
253//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
254
255void PhysicsList::SetCuts()
256{
257
258 SetCutValue(cutForGamma, "gamma", "DefaultRegionForTheWorld");
259 SetCutValue(cutForElectron, "e-", "DefaultRegionForTheWorld");
260 SetCutValue(cutForPositron, "e+", "DefaultRegionForTheWorld");
261 G4cout << "PhysicsList: world cuts are set cutG= " << cutForGamma/mm
262 << " mm cutE= " << cutForElectron/mm << " mm " << G4endl;
263
264 if( !vertexDetectorCuts ) SetVertexCut(cutForElectron);
265 G4Region* region = (G4RegionStore::GetInstance())->GetRegion("VertexDetector");
266 region->SetProductionCuts(vertexDetectorCuts);
267 G4cout << "Vertex cuts are set" << G4endl;
268
269 if( !muonDetectorCuts ) SetMuonCut(cutForElectron);
270 region = (G4RegionStore::GetInstance())->GetRegion("MuonDetector");
271 region->SetProductionCuts(muonDetectorCuts);
272 G4cout << "Muon cuts are set" << G4endl;
273
274 if (verboseLevel>0) DumpCutValuesTable();
275}
276
277//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
278
279void PhysicsList::SetCutForGamma(G4double cut)
280{
281 cutForGamma = cut;
282 SetParticleCuts(cutForGamma, G4Gamma::Gamma());
283}
284
285//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
286
287void PhysicsList::SetCutForElectron(G4double cut)
288{
289 cutForElectron = cut;
290 SetParticleCuts(cutForElectron, G4Electron::Electron());
291}
292
293//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
294
295void PhysicsList::SetCutForPositron(G4double cut)
296{
297 cutForPositron = cut;
298 SetParticleCuts(cutForPositron, G4Positron::Positron());
299}
300
301//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
302
303void PhysicsList::SetVertexCut(G4double cut)
304{
305 if( !vertexDetectorCuts ) vertexDetectorCuts = new G4ProductionCuts();
306
307 vertexDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
308 vertexDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
309 vertexDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
310
311}
312
313//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
314
315void PhysicsList::SetMuonCut(G4double cut)
316{
317 if( !muonDetectorCuts ) muonDetectorCuts = new G4ProductionCuts();
318
319 muonDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
320 muonDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
321 muonDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
322}
323
324//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
325
326void PhysicsList::SetMscStepLimit(G4bool val)
327{
328 mscStepLimit = val;
329}
330
331//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
332
Note: See TracBrowser for help on using the repository browser.