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

Last change on this file was 1342, checked in by garnier, 15 years ago

update ti head

File size: 10.5 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.26 2010/08/12 11:38:20 vnivanch Exp $
27// GEANT4 tag $Name: examples-V09-03-09 $
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 "G4EmStandardPhysics.hh"
49#include "G4EmStandardPhysics_option1.hh"
50#include "G4EmStandardPhysics_option2.hh"
51#include "G4EmStandardPhysics_option3.hh"
52#include "G4EmLivermorePhysics.hh"
53#include "G4EmPenelopePhysics.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 cutForVertexDetector = defaultCutValue;
88 cutForMuonDetector = defaultCutValue;
89
90 vertexDetectorCuts = 0;
91 muonDetectorCuts = 0;
92
93 pMessenger = new PhysicsListMessenger(this);
94 stepMaxProcess = new StepMax();
95
96 // Initilise flags
97
98 SetVerboseLevel(1);
99
100 helIsRegisted = false;
101 bicIsRegisted = false;
102 gnucIsRegisted = false;
103 stopIsRegisted = false;
104
105 // Decay Physics is always defined
106 generalPhysicsList = new G4DecayPhysics();
107
108 // EM physics
109 emName = G4String("emstandard");
110 emPhysicsList = new G4EmStandardPhysics();
111}
112
113//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114
115PhysicsList::~PhysicsList()
116{
117 delete pMessenger;
118 delete generalPhysicsList;
119 delete emPhysicsList;
120 delete stepMaxProcess;
121 for(size_t i=0; i<hadronPhys.size(); i++) {
122 delete hadronPhys[i];
123 }
124}
125
126//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
127
128void PhysicsList::ConstructParticle()
129{
130 generalPhysicsList->ConstructParticle();
131}
132
133//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134
135void PhysicsList::ConstructProcess()
136{
137 AddTransportation();
138 emPhysicsList->ConstructProcess();
139 generalPhysicsList->ConstructProcess();
140 for(size_t i=0; i<hadronPhys.size(); i++) {
141 hadronPhys[i]->ConstructProcess();
142 }
143 AddStepMax();
144}
145
146//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
147
148void PhysicsList::AddPhysicsList(const G4String& name)
149{
150 if (verboseLevel > 1)
151 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
152
153 if (name == emName) return;
154
155 if (name == "emstandard") {
156 emName = name;
157 delete emPhysicsList;
158 emPhysicsList = new G4EmStandardPhysics();
159 if (verboseLevel > 0)
160 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
161
162 } else if (name == "emstandard_opt1") {
163 emName = name;
164 delete emPhysicsList;
165 emPhysicsList = new G4EmStandardPhysics_option1();
166 if (verboseLevel > 0)
167 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
168
169 } else if (name == "emstandard_opt2") {
170 emName = name;
171 delete emPhysicsList;
172 emPhysicsList = new G4EmStandardPhysics_option2();
173 if (verboseLevel > 0)
174 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
175
176 } else if (name == "emstandard_opt3") {
177 emName = name;
178 delete emPhysicsList;
179 emPhysicsList = new G4EmStandardPhysics_option3();
180 if (verboseLevel > 0)
181 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
182
183 } else if (name == "emstandard_local") {
184 emName = name;
185 delete emPhysicsList;
186 emPhysicsList = new PhysListEmStandard();
187 if (verboseLevel > 0)
188 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
189
190 } else if (name == "emlivermore") {
191 emName = name;
192 delete emPhysicsList;
193 emPhysicsList = new G4EmLivermorePhysics();
194
195 } else if (name == "empenelope") {
196 emName = name;
197 delete emPhysicsList;
198 emPhysicsList = new G4EmPenelopePhysics();
199
200 } else if (name == "elastic" && !helIsRegisted) {
201 hadronPhys.push_back( new G4HadronElasticPhysics());
202 helIsRegisted = true;
203 if (verboseLevel > 0)
204 G4cout << "PhysicsList::Add hadron elastic physics" << G4endl;
205
206 } else if (name == "binary" && !bicIsRegisted) {
207 hadronPhys.push_back(new G4HadronInelasticQBBC());
208 hadronPhys.push_back(new G4IonBinaryCascadePhysics());
209 bicIsRegisted = true;
210 if (verboseLevel > 0)
211 G4cout << "PhysicsList::Add hadron inelastic physics from <QBBC>" << G4endl;
212
213 } else if (name == "gamma_nuc" && !gnucIsRegisted) {
214 hadronPhys.push_back(new G4EmExtraPhysics());
215 gnucIsRegisted = true;
216 if (verboseLevel > 0)
217 G4cout << "PhysicsList::Add gamma- and electro-nuclear physics" << G4endl;
218
219 } else if (name == "stopping" && !stopIsRegisted) {
220 hadronPhys.push_back(new G4QStoppingPhysics());
221 gnucIsRegisted = true;
222 if (verboseLevel > 0)
223 G4cout << "PhysicsList::Add stopping physics" << G4endl;
224
225 } else {
226 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
227 << " is not defined"
228 << G4endl;
229 }
230}
231
232//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
233
234void PhysicsList::AddStepMax()
235{
236 // Step limitation seen as a process
237
238 theParticleIterator->reset();
239 while ((*theParticleIterator)()){
240 G4ParticleDefinition* particle = theParticleIterator->value();
241 G4ProcessManager* pmanager = particle->GetProcessManager();
242
243 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
244 {
245 pmanager ->AddDiscreteProcess(stepMaxProcess);
246 }
247 }
248}
249
250//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
251
252void PhysicsList::SetCuts()
253{
254 SetCutValue(cutForGamma, "gamma", "DefaultRegionForTheWorld");
255 SetCutValue(cutForElectron, "e-", "DefaultRegionForTheWorld");
256 SetCutValue(cutForPositron, "e+", "DefaultRegionForTheWorld");
257 // G4cout << "PhysicsList: world cuts are set cutG= " << cutForGamma/mm
258 // << " mm cutE= " << cutForElectron/mm << " mm " << G4endl;
259
260 //G4cout << " cutV= " << cutForVertexDetector
261 // << " cutM= " << cutForMuonDetector<<G4endl;
262
263 G4Region* region = (G4RegionStore::GetInstance())->GetRegion("VertexDetector");
264 vertexDetectorCuts = region->GetProductionCuts();
265 SetVertexCut(cutForVertexDetector);
266 // G4cout << "Vertex cuts are set" << G4endl;
267
268 region = (G4RegionStore::GetInstance())->GetRegion("MuonDetector");
269 muonDetectorCuts = region->GetProductionCuts();
270 SetMuonCut(cutForMuonDetector);
271 //G4cout << "Muon cuts are set " <<muonRegion << " " << muonDetectorCuts << G4endl;
272
273 if (verboseLevel>0) DumpCutValuesTable();
274}
275
276//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
277
278void PhysicsList::SetCutForGamma(G4double cut)
279{
280 cutForGamma = cut;
281 SetParticleCuts(cutForGamma, G4Gamma::Gamma());
282}
283
284//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
285
286void PhysicsList::SetCutForElectron(G4double cut)
287{
288 cutForElectron = cut;
289 SetParticleCuts(cutForElectron, G4Electron::Electron());
290}
291
292//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
293
294void PhysicsList::SetCutForPositron(G4double cut)
295{
296 cutForPositron = cut;
297 SetParticleCuts(cutForPositron, G4Positron::Positron());
298}
299
300//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
301
302void PhysicsList::SetVertexCut(G4double cut)
303{
304 cutForVertexDetector = cut;
305
306 if( vertexDetectorCuts ) {
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 cutForMuonDetector = cut;
318
319 if( muonDetectorCuts ) {
320 muonDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
321 muonDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
322 muonDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
323 }
324}
325
326//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
327
Note: See TracBrowser for help on using the repository browser.