Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/electromagnetic/TestEm2/src/PhysicsList.cc
Go to the documentation of this file.
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 /// \file electromagnetic/TestEm2/src/PhysicsList.cc
27 /// \brief Implementation of the PhysicsList class
28 //
29 // $Id: PhysicsList.cc 75118 2013-10-28 09:40:24Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "PhysicsList.hh"
35 #include "PhysicsListMessenger.hh"
36 
37 #include "PhysListEmStandard.hh"
38 
39 #include "G4EmStandardPhysics.hh"
44 #include "G4EmLivermorePhysics.hh"
45 #include "G4EmPenelopePhysics.hh"
46 
47 #include "G4DecayPhysics.hh"
48 #include "StepMax.hh"
49 
50 #include "G4LossTableManager.hh"
51 #include "G4ProcessManager.hh"
52 
53 #include "G4UnitsTable.hh"
54 #include "G4SystemOfUnits.hh"
55 
56 #include "G4Threading.hh"
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
61  : G4VModularPhysicsList(),fEmPhysicsList(0),fMessenger(0)
62 {
65 
66  fMessenger = new PhysicsListMessenger(this);
67  SetVerboseLevel(1);
68 
69  // EM physics
70  fEmName = "emstandard_opt0";
71  fEmPhysicsList = new G4EmStandardPhysics();
72  fDecay = new G4DecayPhysics();
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78 {
79  delete fMessenger;
80  delete fEmPhysicsList;
81  delete fDecay;
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87 {
88  fEmPhysicsList->ConstructParticle();
89  fDecay->ConstructParticle();
90 }
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93 
95 {
96  if (verboseLevel>-1) {
97  G4cout << "PhysicsList::ConstructProcess start" << G4endl;
98  }
99  // transportation
100  //
102 
103  // electromagnetic physics list
104  //
105  fEmPhysicsList->ConstructProcess();
106 
107  // decay process
108  //
109  fDecay->ConstructProcess();
110 
111  // step limitation (as a full process)
112  //
113  AddStepMax();
114 }
115 
116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
117 
119 {
120  if (verboseLevel>0) {
121  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
122  }
123 
124  if (name == fEmName) return;
125 
126  if (name == "local") {
127 
128  fEmName = name;
129  delete fEmPhysicsList;
130  fEmPhysicsList = new PhysListEmStandard(name);
131 
132  } else if (name == "emstandard_opt0") {
133 
134  fEmName = name;
135  delete fEmPhysicsList;
136  fEmPhysicsList = new G4EmStandardPhysics();
137 
138  } else if (name == "emstandard_opt1") {
139 
140  fEmName = name;
141  delete fEmPhysicsList;
142  fEmPhysicsList = new G4EmStandardPhysics_option1();
143 
144  } else if (name == "emstandard_opt2") {
145 
146  fEmName = name;
147  delete fEmPhysicsList;
148  fEmPhysicsList = new G4EmStandardPhysics_option2();
149 
150  } else if (name == "emstandard_opt3") {
151 
152  fEmName = name;
153  delete fEmPhysicsList;
154  fEmPhysicsList = new G4EmStandardPhysics_option3();
155 
156  } else if (name == "emstandard_opt4") {
157 
158  fEmName = name;
159  delete fEmPhysicsList;
160  fEmPhysicsList = new G4EmStandardPhysics_option4();
161 
162  } else if (name == "empenelope"){
163  fEmName = name;
164  delete fEmPhysicsList;
165  fEmPhysicsList = new G4EmPenelopePhysics();
166 
167  } else if (name == "emlivermore"){
168  fEmName = name;
169  delete fEmPhysicsList;
170  fEmPhysicsList = new G4EmLivermorePhysics();
171 
172  } else {
173 
174  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
175  << " is not defined"
176  << G4endl;
177  }
178 }
179 
180 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
181 
183 {
184  // Step limitation seen as a process
185  StepMax* stepMaxProcess = new StepMax();
186 
187  theParticleIterator->reset();
188  while ((*theParticleIterator)()){
189  G4ParticleDefinition* particle = theParticleIterator->value();
190  G4ProcessManager* pmanager = particle->GetProcessManager();
191 
192  if (stepMaxProcess->IsApplicable(*particle))
193  {
194  pmanager ->AddDiscreteProcess(stepMaxProcess);
195  }
196  }
197 }
198 
199 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
200 
202 {
203 #ifdef G4MULTITHREADED
205  if(verboseLevel>1) { DumpCutValuesTable(); }
206  } else {
207  if(verboseLevel>0) { DumpCutValuesTable(); }
208  }
209 #else
210  if(verboseLevel>0) { DumpCutValuesTable(); }
211 #endif
212 }
213 
214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetDefaultCutValue(G4double newCutValue)
static G4LossTableManager * Instance()
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
const XML_Char * name
G4ProcessManager * GetProcessManager() const
virtual void ConstructParticle()=0
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
void SetVerboseLevel(G4int value)
G4bool IsWorkerThread()
Definition: G4Threading.cc:104
virtual G4bool IsApplicable(const G4ParticleDefinition &)
virtual void ConstructProcess()=0
#define G4endl
Definition: G4ios.hh:61
#define theParticleIterator