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

Last change on this file since 812 was 807, checked in by garnier, 16 years ago

update

File size: 10.0 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.28 2008/01/14 12:11:39 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-01-patch-02 $
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 "PhysListEmStandardIG.hh"
38#include "PhysListEmStandardNR.hh"
39#include "PhysListEmLivermore.hh"
40#include "PhysListEmPenelope.hh"
41#include "G4EmStandardPhysics.hh"
42#include "G4EmStandardPhysics_option1.hh"
43#include "G4EmStandardPhysics_option2.hh"
44
45#include "G4HadronElasticPhysics.hh"
46#include "G4HadronDElasticPhysics.hh"
47#include "G4HadronHElasticPhysics.hh"
48#include "G4HadronQElasticPhysics.hh"
49#include "G4HadronInelasticQBBC.hh"
50#include "G4IonBinaryCascadePhysics.hh"
51
52#include "G4EmProcessOptions.hh"
53
54#include "G4LossTableManager.hh"
55#include "G4UnitsTable.hh"
56
57#include "G4ProcessManager.hh"
58#include "G4Decay.hh"
59
60//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61
62PhysicsList::PhysicsList() : G4VModularPhysicsList()
63{
64  G4LossTableManager::Instance();
65  defaultCutValue = 1.*mm;
66  cutForGamma     = defaultCutValue;
67  cutForElectron  = defaultCutValue;
68  cutForPositron  = defaultCutValue;
69
70  helIsRegisted  = false;
71  bicIsRegisted  = false;
72  biciIsRegisted = false;
73
74  stepMaxProcess  = 0;
75
76  pMessenger = new PhysicsListMessenger(this);
77
78  SetVerboseLevel(1);
79
80  // EM physics
81  emPhysicsList = new PhysListEmStandard(emName = "standard");
82
83}
84
85//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
86
87PhysicsList::~PhysicsList()
88{
89  delete pMessenger;
90  delete emPhysicsList;
91  for(size_t i=0; i<hadronPhys.size(); i++) delete hadronPhys[i];
92}
93
94//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
95
96// Bosons
97#include "G4ChargedGeantino.hh"
98#include "G4Geantino.hh"
99#include "G4Gamma.hh"
100
101// leptons
102#include "G4MuonPlus.hh"
103#include "G4MuonMinus.hh"
104#include "G4NeutrinoMu.hh"
105#include "G4AntiNeutrinoMu.hh"
106
107#include "G4Electron.hh"
108#include "G4Positron.hh"
109#include "G4NeutrinoE.hh"
110#include "G4AntiNeutrinoE.hh"
111
112// Hadrons
113#include "G4MesonConstructor.hh"
114#include "G4BaryonConstructor.hh"
115#include "G4IonConstructor.hh"
116
117//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118
119void PhysicsList::ConstructParticle()
120{
121// pseudo-particles
122  G4Geantino::GeantinoDefinition();
123  G4ChargedGeantino::ChargedGeantinoDefinition();
124 
125// gamma
126  G4Gamma::GammaDefinition();
127 
128// leptons
129  G4Electron::ElectronDefinition();
130  G4Positron::PositronDefinition();
131  G4MuonPlus::MuonPlusDefinition();
132  G4MuonMinus::MuonMinusDefinition();
133
134  G4NeutrinoE::NeutrinoEDefinition();
135  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
136  G4NeutrinoMu::NeutrinoMuDefinition();
137  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 
138
139// mesons
140  G4MesonConstructor mConstructor;
141  mConstructor.ConstructParticle();
142
143// barions
144  G4BaryonConstructor bConstructor;
145  bConstructor.ConstructParticle();
146
147// ions
148  G4IonConstructor iConstructor;
149  iConstructor.ConstructParticle();
150}
151
152//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
153void PhysicsList::ConstructProcess()
154{
155  // transportation
156  //
157  AddTransportation();
158 
159  // electromagnetic physics list
160  //
161  emPhysicsList->ConstructProcess();
162 
163  // hadronic physics lists
164  for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess();
165 
166  // decay process
167  //
168  G4Decay* fDecayProcess = new G4Decay();
169
170  theParticleIterator->reset();
171  while( (*theParticleIterator)() ){
172    G4ParticleDefinition* particle = theParticleIterator->value();
173    G4ProcessManager* pmanager = particle->GetProcessManager();
174
175    if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 
176
177      pmanager ->AddProcess(fDecayProcess);
178
179      // set ordering for PostStepDoIt and AtRestDoIt
180      pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
181      pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
182
183    }
184  }
185 
186  // step limitation (as a full process)
187  // 
188  AddStepMax();
189 
190  G4EmProcessOptions opt;
191  opt.SetDEDXBinning(480);
192}
193
194//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
195
196void PhysicsList::AddPhysicsList(const G4String& name)
197{
198  if (verboseLevel>-1) {
199    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
200  }
201
202  if (name == emName) return;
203
204  if (name == "standard") {
205
206    emName = name;
207    delete emPhysicsList;
208    emPhysicsList = new PhysListEmStandard(name);
209
210  } else if (name == "emstandard") {
211
212    emName = name;
213    delete emPhysicsList;
214    emPhysicsList = new G4EmStandardPhysics();
215
216  } else if (name == "emstandard_opt1") {
217
218    emName = name;
219    delete emPhysicsList;
220    emPhysicsList = new G4EmStandardPhysics_option1();
221
222  } else if (name == "emstandard_opt2") {
223
224    emName = name;
225    delete emPhysicsList;
226    emPhysicsList = new G4EmStandardPhysics_option2();
227
228  } else if (name == "standardSS") {
229
230    emName = name;
231    delete emPhysicsList;
232    emPhysicsList = new PhysListEmStandardSS(name);
233
234  } else if (name == "standardNR") {
235
236    emName = name;
237    delete emPhysicsList;
238    emPhysicsList = new PhysListEmStandardNR(name);
239
240  } else if (name == "standardIG") {
241
242    emName = name;
243    delete emPhysicsList;
244    emPhysicsList = new PhysListEmStandardIG(name);
245
246  } else if (name == "livermore") {
247    emName = name;
248    delete emPhysicsList;
249    emPhysicsList = new PhysListEmLivermore();
250
251  } else if (name == "penelope") {
252    emName = name;
253    delete emPhysicsList;
254    emPhysicsList = new PhysListEmPenelope();
255
256  } else if (name == "elastic" && !helIsRegisted) {
257    hadronPhys.push_back( new G4HadronElasticPhysics());
258    helIsRegisted = true;
259
260  } else if (name == "DElastic" && !helIsRegisted) {
261    hadronPhys.push_back( new G4HadronDElasticPhysics());
262    helIsRegisted = true;
263
264  } else if (name == "HElastic" && !helIsRegisted) {
265    hadronPhys.push_back( new G4HadronHElasticPhysics());
266    helIsRegisted = true;
267
268  } else if (name == "QElastic" && !helIsRegisted) {
269    hadronPhys.push_back( new G4HadronQElasticPhysics());
270    helIsRegisted = true;
271
272  } else if (name == "binary" && !bicIsRegisted) {
273    hadronPhys.push_back(new G4HadronInelasticQBBC());
274    bicIsRegisted = true;
275
276  } else if (name == "binary_ion" && !biciIsRegisted) {
277    hadronPhys.push_back(new G4IonBinaryCascadePhysics());
278    biciIsRegisted = true;
279
280  } else {
281
282    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
283           << " is not defined"
284           << G4endl;
285  }
286}
287
288//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
289
290#include "StepMax.hh"
291
292void PhysicsList::AddStepMax()
293{
294  // Step limitation seen as a process
295  stepMaxProcess = new StepMax();
296
297  theParticleIterator->reset();
298  while ((*theParticleIterator)()){
299      G4ParticleDefinition* particle = theParticleIterator->value();
300      G4ProcessManager* pmanager = particle->GetProcessManager();
301
302      if (stepMaxProcess->IsApplicable(*particle) && pmanager)
303        {
304          pmanager ->AddDiscreteProcess(stepMaxProcess);
305        }
306  }
307}
308
309//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
310
311void PhysicsList::SetCuts()
312{
313
314  if (verboseLevel >0){
315    G4cout << "PhysicsList::SetCuts:";
316    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
317  }
318
319  // set cut values for gamma at first and for e- second and next for e+,
320  // because some processes for e+/e- need cut values for gamma
321  SetCutValue(cutForGamma, "gamma");
322  SetCutValue(cutForElectron, "e-");
323  SetCutValue(cutForPositron, "e+");
324
325  if (verboseLevel>0) DumpCutValuesTable();
326}
327
328//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
329
330void PhysicsList::SetCutForGamma(G4double cut)
331{
332  cutForGamma = cut;
333  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
334}
335
336//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
337
338void PhysicsList::SetCutForElectron(G4double cut)
339{
340  cutForElectron = cut;
341  SetParticleCuts(cutForElectron, G4Electron::Electron());
342}
343
344//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
345
346void PhysicsList::SetCutForPositron(G4double cut)
347{
348  cutForPositron = cut;
349  SetParticleCuts(cutForPositron, G4Positron::Positron());
350}
351
352//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
353
Note: See TracBrowser for help on using the repository browser.