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

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

update ti head

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