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

Last change on this file since 1309 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 10.7 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.24 2008/10/16 11:48:58 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-03-cand-01 $
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 "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  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 == "livermore") {
191    emName = name;
192    delete emPhysicsList;
193    emPhysicsList = new PhysListEmLivermore();
194    if (verboseLevel > 0) 
195      G4cout << "PhysicsList::Set Livermore EM physics" << G4endl;
196
197  } else if (name == "penelope") {
198    emName = name;
199    delete emPhysicsList;
200    emPhysicsList = new PhysListEmPenelope();
201    if (verboseLevel > 0) 
202      G4cout << "PhysicsList::Set Penelope EM physics" << G4endl;
203
204  } else if (name == "elastic" && !helIsRegisted) {
205    hadronPhys.push_back( new G4HadronElasticPhysics(name));
206    helIsRegisted = true;
207    if (verboseLevel > 0) 
208      G4cout << "PhysicsList::Add hadron elastic physics" << G4endl;
209
210  } else if (name == "binary" && !bicIsRegisted) {
211    hadronPhys.push_back(new G4HadronInelasticQBBC());
212    hadronPhys.push_back(new G4IonBinaryCascadePhysics());
213    bicIsRegisted = true;
214    if (verboseLevel > 0) 
215      G4cout << "PhysicsList::Add hadron inelastic physics from <QBBC>" << G4endl;
216
217  } else if (name == "gamma_nuc" && !gnucIsRegisted) {
218    hadronPhys.push_back(new G4EmExtraPhysics());
219    gnucIsRegisted = true;
220    if (verboseLevel > 0) 
221      G4cout << "PhysicsList::Add gamma- and electro-nuclear physics" << G4endl;
222
223  } else if (name == "stopping" && !stopIsRegisted) {
224    hadronPhys.push_back(new G4QStoppingPhysics());
225    gnucIsRegisted = true;
226    if (verboseLevel > 0) 
227      G4cout << "PhysicsList::Add stopping physics" << G4endl;
228
229  } else {
230    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
231           << " is not defined"
232           << G4endl;
233  }
234}
235
236//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
237
238void PhysicsList::AddStepMax()
239{
240  // Step limitation seen as a process
241
242  theParticleIterator->reset();
243  while ((*theParticleIterator)()){
244      G4ParticleDefinition* particle = theParticleIterator->value();
245      G4ProcessManager* pmanager = particle->GetProcessManager();
246
247      if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
248        {
249          pmanager ->AddDiscreteProcess(stepMaxProcess);
250        }
251  }
252}
253
254//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
255
256void PhysicsList::SetCuts()
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  //G4cout << " cutV= " << cutForVertexDetector
265  //     << " cutM= " << cutForMuonDetector<<G4endl;
266
267  G4Region* region = (G4RegionStore::GetInstance())->GetRegion("VertexDetector");
268  vertexDetectorCuts = region->GetProductionCuts();
269  SetVertexCut(cutForVertexDetector);
270  //  G4cout << "Vertex cuts are set" << G4endl;
271 
272  region = (G4RegionStore::GetInstance())->GetRegion("MuonDetector");
273  muonDetectorCuts = region->GetProductionCuts();
274  SetMuonCut(cutForMuonDetector);
275  //G4cout << "Muon cuts are set " <<muonRegion << " " << muonDetectorCuts << G4endl;
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
306void PhysicsList::SetVertexCut(G4double cut)
307{
308  cutForVertexDetector = cut;
309 
310  if( vertexDetectorCuts ) {
311    vertexDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
312    vertexDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
313    vertexDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
314  } 
315}
316
317//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
318
319void PhysicsList::SetMuonCut(G4double cut)
320{
321  cutForMuonDetector   = cut;
322
323  if( muonDetectorCuts ) {
324    muonDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
325    muonDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
326    muonDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
327  }
328}
329
330//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
331
Note: See TracBrowser for help on using the repository browser.