source: trunk/examples/extended/field/field03/src/F03PhysicsList.cc@ 1340

Last change on this file since 1340 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 9.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: F03PhysicsList.cc,v 1.13 2010/04/08 14:12:20 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30
31#include "G4Timer.hh"
32
33#include "F03PhysicsList.hh"
34#include "F03DetectorConstruction.hh"
35#include "F03PhysicsListMessenger.hh"
36
37#include "G4ParticleDefinition.hh"
38#include "G4ParticleWithCuts.hh"
39#include "G4ProcessManager.hh"
40#include "G4ProcessVector.hh"
41#include "G4ParticleTypes.hh"
42#include "G4ParticleTable.hh"
43#include "G4Material.hh"
44#include "G4EnergyLossTables.hh"
45#include "G4UnitsTable.hh"
46#include "G4ios.hh"
47#include <iomanip>
48
49
50
51/////////////////////////////////////////////////////////////
52//
53//
54
55F03PhysicsList::F03PhysicsList(F03DetectorConstruction* p)
56: G4VUserPhysicsList(), MaxChargedStep(DBL_MAX),
57 thePhotoElectricEffect(0), theComptonScattering(0),
58 theGammaConversion(0), theeminusIonisation(0),
59 theeminusBremsstrahlung(0), theeplusIonisation(0),
60 theeplusBremsstrahlung(0), theeplusAnnihilation(0),
61 theeminusStepCut(0), theeplusStepCut(0)
62{
63 pDet = p;
64
65 defaultCutValue = 1.000*mm ;
66
67 cutForGamma = defaultCutValue ;
68 cutForElectron = defaultCutValue ;
69
70 SetVerboseLevel(1);
71 physicsListMessenger = new F03PhysicsListMessenger(this);
72}
73
74/////////////////////////////////////////////////////////////////////////
75//
76//
77
78F03PhysicsList::~F03PhysicsList()
79{
80 delete physicsListMessenger;
81}
82
83///////////////////////////////////////////////////////////////////////////
84//
85//
86
87void F03PhysicsList::ConstructParticle()
88{
89 // In this method, static member functions should be called
90 // for all particles which you want to use.
91 // This ensures that objects of these particle types will be
92 // created in the program.
93
94 ConstructBosons();
95 ConstructLeptons();
96 ConstructMesons();
97 ConstructBarions();
98}
99
100////////////////////////////////////////////////////////////////////////////
101//
102//
103
104void F03PhysicsList::ConstructBosons()
105{
106 // gamma
107
108 G4Gamma::GammaDefinition();
109
110 // charged geantino
111
112 G4ChargedGeantino::ChargedGeantinoDefinition();
113
114
115}
116
117void F03PhysicsList::ConstructLeptons()
118{
119 // leptons
120
121 G4Electron::ElectronDefinition();
122 G4Positron::PositronDefinition();
123 G4MuonPlus::MuonPlusDefinition();
124 G4MuonMinus::MuonMinusDefinition();
125
126 G4NeutrinoE::NeutrinoEDefinition();
127 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
128 G4NeutrinoMu::NeutrinoMuDefinition();
129 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
130}
131
132void F03PhysicsList::ConstructMesons()
133{
134 // mesons
135
136 G4PionPlus::PionPlusDefinition();
137 G4PionMinus::PionMinusDefinition();
138 G4PionZero::PionZeroDefinition();
139 G4KaonPlus::KaonPlusDefinition();
140 G4KaonMinus::KaonMinusDefinition();
141}
142
143
144void F03PhysicsList::ConstructBarions()
145{
146// barions
147
148 G4Proton::ProtonDefinition();
149 G4AntiProton::AntiProtonDefinition();
150}
151
152
153///////////////////////////////////////////////////////////////////////
154//
155//
156
157void F03PhysicsList::ConstructProcess()
158{
159 AddTransportation();
160 //AddParameterisation();
161
162 ConstructEM();
163 ConstructGeneral();
164}
165
166/////////////////////////////////////////////////////////////////////////////
167//
168//
169
170#include "G4ComptonScattering.hh"
171#include "G4GammaConversion.hh"
172#include "G4PhotoElectricEffect.hh"
173
174#include "G4eMultipleScattering.hh"
175#include "G4MuMultipleScattering.hh"
176#include "G4hMultipleScattering.hh"
177
178#include "G4eIonisation.hh"
179#include "G4eBremsstrahlung.hh"
180#include "G4eplusAnnihilation.hh"
181
182#include "G4MuIonisation.hh"
183#include "G4MuBremsstrahlung.hh"
184#include "G4MuPairProduction.hh"
185
186#include "G4hIonisation.hh"
187
188#include "F03StepCut.hh"
189
190void F03PhysicsList::ConstructEM()
191{
192 theParticleIterator->reset();
193
194 while( (*theParticleIterator)() )
195 {
196 G4ParticleDefinition* particle = theParticleIterator->value();
197 G4ProcessManager* pmanager = particle->GetProcessManager();
198 G4String particleName = particle->GetParticleName();
199
200 if (particleName == "gamma")
201 {
202 // Construct processes for gamma
203
204 thePhotoElectricEffect = new G4PhotoElectricEffect();
205 theComptonScattering = new G4ComptonScattering();
206 theGammaConversion = new G4GammaConversion();
207
208 pmanager->AddDiscreteProcess(thePhotoElectricEffect);
209 pmanager->AddDiscreteProcess(theComptonScattering);
210
211 pmanager->AddDiscreteProcess(theGammaConversion);
212
213 }
214 else if (particleName == "e-")
215 {
216 // Construct processes for electron
217
218 theeminusIonisation = new G4eIonisation();
219 theeminusBremsstrahlung = new G4eBremsstrahlung();
220
221 theeminusStepCut = new F03StepCut();
222
223 pmanager->AddProcess(theeminusIonisation,-1,2,2);
224 pmanager->AddProcess(theeminusBremsstrahlung,-1,-1,3);
225 pmanager->AddProcess(theeminusStepCut,-1,-1,4);
226 theeminusStepCut->SetMaxStep(MaxChargedStep) ;
227
228 }
229 else if (particleName == "e+")
230 {
231 // Construct processes for positron
232
233 theeplusIonisation = new G4eIonisation();
234 theeplusBremsstrahlung = new G4eBremsstrahlung();
235 theeplusStepCut = new F03StepCut();
236
237 pmanager->AddProcess(theeplusIonisation,-1,2,2);
238 pmanager->AddProcess(theeplusBremsstrahlung,-1,-1,3);
239 pmanager->AddProcess(theeplusStepCut,-1,-1,5);
240 theeplusStepCut->SetMaxStep(MaxChargedStep) ;
241
242 }
243 else if( particleName == "mu+" ||
244 particleName == "mu-" )
245 {
246 // Construct processes for muon+
247
248 F03StepCut* muonStepCut = new F03StepCut();
249
250 G4MuIonisation* themuIonisation = new G4MuIonisation() ;
251 pmanager->AddProcess(new G4MuMultipleScattering(),-1,1,1);
252 pmanager->AddProcess(themuIonisation,-1,2,2);
253 pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
254 pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
255 pmanager->AddProcess( muonStepCut,-1,-1,3);
256 muonStepCut->SetMaxStep(MaxChargedStep) ;
257 }
258 else if (
259 particleName == "proton"
260 || particleName == "antiproton"
261 || particleName == "pi+"
262 || particleName == "pi-"
263 || particleName == "kaon+"
264 || particleName == "kaon-"
265 )
266 {
267 F03StepCut* thehadronStepCut = new F03StepCut();
268
269 G4hIonisation* thehIonisation = new G4hIonisation() ;
270 G4hMultipleScattering* thehMultipleScattering =
271 new G4hMultipleScattering() ;
272
273
274 pmanager->AddProcess(thehMultipleScattering,-1,1,1);
275 pmanager->AddProcess(thehIonisation,-1,2,2);
276
277
278 pmanager->AddProcess( thehadronStepCut,-1,-1,3);
279 thehadronStepCut->SetMaxStep(MaxChargedStep) ;
280 }
281 }
282}
283
284
285#include "G4Decay.hh"
286
287void F03PhysicsList::ConstructGeneral()
288{
289 // Add Decay Process
290
291 G4Decay* theDecayProcess = new G4Decay();
292 theParticleIterator->reset();
293
294 while( (*theParticleIterator)() )
295 {
296 G4ParticleDefinition* particle = theParticleIterator->value();
297 G4ProcessManager* pmanager = particle->GetProcessManager();
298
299 if (theDecayProcess->IsApplicable(*particle))
300 {
301 pmanager ->AddProcess(theDecayProcess);
302
303 // set ordering for PostStepDoIt and AtRestDoIt
304
305 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
306 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
307 }
308 }
309}
310
311/////////////////////////////////////////////////////////////////////////////
312
313void F03PhysicsList::SetCuts()
314{
315 G4Timer theTimer ;
316 theTimer.Start() ;
317 if (verboseLevel >0)
318 {
319 G4cout << "F03PhysicsList::SetCuts:";
320 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
321 }
322 // set cut values for gamma at first and for e- second and next for e+,
323 // because some processes for e+/e- need cut values for gamma
324
325 SetCutValue(cutForGamma,"gamma");
326
327 SetCutValue(cutForElectron,"e-");
328 SetCutValue(cutForElectron,"e+");
329
330 if (verboseLevel>1) DumpCutValuesTable();
331
332 theTimer.Stop();
333 G4cout.precision(6);
334 G4cout << G4endl ;
335 G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed() << " s " <<G4endl;
336
337}
338
339///////////////////////////////////////////////////////////////////////////
340
341void F03PhysicsList::SetGammaCut(G4double val)
342{
343 cutForGamma = val;
344}
345
346///////////////////////////////////////////////////////////////////////////
347
348void F03PhysicsList::SetElectronCut(G4double val)
349{
350 cutForElectron = val;
351}
352
353////////////////////////////////////////////////////////////////////////////
354
355void F03PhysicsList::SetMaxStep(G4double step)
356{
357 MaxChargedStep = step ;
358 G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
359 G4cout << G4endl;
360}
Note: See TracBrowser for help on using the repository browser.