source: trunk/examples/extended/electromagnetic/TestEm8/src/PhysicsList.cc @ 1279

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

update to geant4.9.3

File size: 7.9 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//
27// $Id: PhysicsList.cc,v 1.16 2008/12/05 17:46:12 vnivanch Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29//
30
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
34#include "PhysicsList.hh"
35#include "PhysicsListMessenger.hh"
36
37#include "G4EmStandardPhysics.hh"
38#include "G4EmStandardPhysics_option1.hh"
39#include "G4EmStandardPhysics_option2.hh"
40#include "G4EmStandardPhysics_option3.hh"
41#include "G4DecayPhysics.hh"
42
43#include "G4PAIModel.hh"
44#include "G4PAIPhotonModel.hh"
45
46#include "G4Gamma.hh"
47#include "G4Electron.hh"
48#include "G4Positron.hh"
49
50#include "G4UnitsTable.hh"
51#include "G4LossTableManager.hh"
52
53#include "StepMax.hh"
54
55#include "G4ProcessManager.hh"
56#include "G4ParticleTypes.hh"
57#include "G4ParticleTable.hh"
58
59//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60
61PhysicsList::PhysicsList() : G4VModularPhysicsList()
62{
63  G4LossTableManager::Instance();
64  defaultCutValue = 1.*mm;
65  cutForGamma     = defaultCutValue;
66  cutForElectron  = defaultCutValue;
67  cutForPositron  = defaultCutValue;
68
69  stepMaxProcess  = 0;
70
71  pMessenger = new PhysicsListMessenger(this);
72
73  // Decay Physics is always defined
74  generalPhysicsList = new G4DecayPhysics();
75
76  // EM physics
77  emName = G4String("emstandard");
78  emPhysicsList = new G4EmStandardPhysics(1);
79
80  SetVerboseLevel(1);
81}
82
83//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84
85PhysicsList::~PhysicsList()
86{
87  delete pMessenger;
88  delete generalPhysicsList;
89  delete emPhysicsList;
90  for(size_t i=0; i<hadronPhys.size(); i++) delete hadronPhys[i];
91  delete stepMaxProcess;
92}
93
94//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
95
96void PhysicsList::ConstructParticle()
97{
98  generalPhysicsList->ConstructParticle();
99}
100
101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102
103void PhysicsList::ConstructProcess()
104{
105  AddTransportation();
106  emPhysicsList->ConstructProcess();
107  em_config.AddModels();
108  generalPhysicsList->ConstructProcess();
109  for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess();
110  AddStepMax();
111}
112
113//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114
115void PhysicsList::AddPhysicsList(const G4String& name)
116{
117  if (verboseLevel>1) {
118    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
119  }
120
121  if (name == emName) {
122    return;
123
124  } else if (name == "emstandard_opt1") {
125
126    emName = name;
127    delete emPhysicsList;
128    emPhysicsList = new G4EmStandardPhysics_option1();
129
130  } else if (name == "emstandard_opt2") {
131
132    emName = name;
133    delete emPhysicsList;
134    emPhysicsList = new G4EmStandardPhysics_option2();
135
136  } else if (name == "emstandard_opt3") {
137
138    emName = name;
139    delete emPhysicsList;
140    emPhysicsList = new G4EmStandardPhysics_option3();
141
142  } else if (name == "pai") {
143
144    emName = name;
145    AddPAIModel(name);
146
147  } else if (name == "pai_photon") { 
148
149    emName = name;
150    AddPAIModel(name);
151
152  } else {
153
154    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
155           << " is not defined"
156           << G4endl;
157  }
158}
159
160//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
161
162void PhysicsList::AddStepMax()
163{
164  // Step limitation seen as a process
165  stepMaxProcess = new StepMax();
166
167  theParticleIterator->reset();
168  while ((*theParticleIterator)())
169  {
170    G4ParticleDefinition* particle = theParticleIterator->value();
171    G4ProcessManager* pmanager = particle->GetProcessManager();
172
173    if (stepMaxProcess->IsApplicable(*particle))
174    {
175      pmanager ->AddDiscreteProcess(stepMaxProcess);
176    }
177  }
178}
179
180//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
181
182void PhysicsList::SetCuts()
183{
184
185  if ( verboseLevel > 0 )
186  {
187    G4cout << "PhysicsList::SetCuts:";
188    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
189  }
190
191  // set cut values for gamma at first and for e- second and next for e+,
192  // because some processes for e+/e- need cut values for gamma
193
194  SetCutValue(cutForGamma, "gamma");
195  SetCutValue(cutForElectron, "e-");
196  SetCutValue(cutForPositron, "e+");
197
198  if ( verboseLevel > 0 ) DumpCutValuesTable();
199}
200
201//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
202
203void PhysicsList::SetCutForGamma(G4double cut)
204{
205  cutForGamma = cut;
206  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
207}
208
209//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
210
211void PhysicsList::SetCutForElectron(G4double cut)
212{
213  cutForElectron = cut;
214  SetParticleCuts(cutForElectron, G4Electron::Electron());
215}
216
217//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
218
219void PhysicsList::SetCutForPositron(G4double cut)
220{
221  cutForPositron = cut;
222  SetParticleCuts(cutForPositron, G4Positron::Positron());
223}
224
225//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
226
227void PhysicsList::AddPAIModel(const G4String& modname)
228{
229  theParticleIterator->reset();
230  while ((*theParticleIterator)())
231  {
232    G4ParticleDefinition* particle = theParticleIterator->value();
233    G4String partname = particle->GetParticleName();
234    if(partname == "e-" || partname == "e+") {
235      NewPAIModel(particle, modname, "eIoni");
236
237    } else if(partname == "mu-" || partname == "mu+") {
238      NewPAIModel(particle, modname, "muIoni");
239
240    } else if(partname == "proton" ||
241              partname == "pi+" ||
242              partname == "pi-"   
243              ) {
244      NewPAIModel(particle, modname, "hIoni");
245    }
246  }
247}
248
249//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
250
251void PhysicsList::NewPAIModel(const G4ParticleDefinition* part, 
252                              const G4String& modname,
253                              const G4String& procname)
254{
255  G4String partname = part->GetParticleName();
256  if(modname == "pai") {
257    G4PAIModel* pai = new G4PAIModel(part,"PAIModel");
258    em_config.SetExtraEmModel(partname,procname,pai,"VertexDetector",
259                              0.0,100.*TeV,pai);
260  } else if(modname == "pai_photon") {
261    G4PAIPhotonModel* pai = new G4PAIPhotonModel(part,"PAIPhotModel");
262    em_config.SetExtraEmModel(partname,procname,pai,"VertexDetector",
263                              0.0,100.*TeV,pai);
264  }
265}
266
267//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
268
Note: See TracBrowser for help on using the repository browser.