source: trunk/examples/extended/field/field02/src/F02PhysicsList.cc@ 1338

Last change on this file since 1338 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: F02PhysicsList.cc,v 1.14 2010/04/08 14:11:06 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30
31#include "G4Timer.hh"
32
33#include "F02PhysicsList.hh"
34#include "F02DetectorConstruction.hh"
35#include "F02PhysicsListMessenger.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//
55
56F02PhysicsList::F02PhysicsList(F02DetectorConstruction* p)
57: G4VUserPhysicsList(), MaxChargedStep(DBL_MAX),
58 thePhotoElectricEffect(0), theComptonScattering(0),
59 theGammaConversion(0), theeminusIonisation(0),
60 theeminusBremsstrahlung(0), theeplusIonisation(0),
61 theeplusBremsstrahlung(0), theeplusAnnihilation(0),
62 theeminusStepCut(0), theeplusStepCut(0)
63{
64 pDet = p;
65
66 defaultCutValue = 1.000*mm ;
67
68 cutForGamma = defaultCutValue ;
69 cutForElectron = defaultCutValue ;
70
71 SetVerboseLevel(1);
72 physicsListMessenger = new F02PhysicsListMessenger(this);
73}
74
75/////////////////////////////////////////////////////////////////////////
76//
77//
78
79F02PhysicsList::~F02PhysicsList()
80{
81 delete physicsListMessenger;
82}
83
84///////////////////////////////////////////////////////////////////////////
85//
86//
87
88void F02PhysicsList::ConstructParticle()
89{
90 // In this method, static member functions should be called
91 // for all particles which you want to use.
92 // This ensures that objects of these particle types will be
93 // created in the program.
94
95 ConstructBosons();
96 ConstructLeptons();
97 ConstructMesons();
98 ConstructBarions();
99}
100
101////////////////////////////////////////////////////////////////////////////
102//
103//
104
105void F02PhysicsList::ConstructBosons()
106{
107 // gamma
108
109 G4Gamma::GammaDefinition();
110
111 // charged geantino
112
113 G4ChargedGeantino::ChargedGeantinoDefinition();
114
115
116}
117
118void F02PhysicsList::ConstructLeptons()
119{
120 // leptons
121
122 G4Electron::ElectronDefinition();
123 G4Positron::PositronDefinition();
124 G4MuonPlus::MuonPlusDefinition();
125 G4MuonMinus::MuonMinusDefinition();
126
127 G4NeutrinoE::NeutrinoEDefinition();
128 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
129 G4NeutrinoMu::NeutrinoMuDefinition();
130 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
131}
132
133void F02PhysicsList::ConstructMesons()
134{
135 // mesons
136
137 G4PionPlus::PionPlusDefinition();
138 G4PionMinus::PionMinusDefinition();
139 G4PionZero::PionZeroDefinition();
140 G4KaonPlus::KaonPlusDefinition();
141 G4KaonMinus::KaonMinusDefinition();
142}
143
144
145void F02PhysicsList::ConstructBarions()
146{
147// barions
148
149 G4Proton::ProtonDefinition();
150 G4AntiProton::AntiProtonDefinition();
151}
152
153
154///////////////////////////////////////////////////////////////////////
155//
156//
157
158void F02PhysicsList::ConstructProcess()
159{
160 AddTransportation();
161 // AddParameterisation();
162
163 ConstructEM();
164 ConstructGeneral();
165}
166
167/////////////////////////////////////////////////////////////////////////////
168//
169//
170
171#include "G4ComptonScattering.hh"
172#include "G4GammaConversion.hh"
173#include "G4PhotoElectricEffect.hh"
174
175#include "G4eMultipleScattering.hh"
176#include "G4MuMultipleScattering.hh"
177#include "G4hMultipleScattering.hh"
178
179#include "G4eIonisation.hh"
180#include "G4eBremsstrahlung.hh"
181#include "G4eplusAnnihilation.hh"
182
183#include "G4MuIonisation.hh"
184#include "G4MuBremsstrahlung.hh"
185#include "G4MuPairProduction.hh"
186
187#include "G4hIonisation.hh"
188
189#include "F02StepCut.hh"
190
191void F02PhysicsList::ConstructEM()
192{
193 theParticleIterator->reset();
194
195 while( (*theParticleIterator)() )
196 {
197 G4ParticleDefinition* particle = theParticleIterator->value();
198 G4ProcessManager* pmanager = particle->GetProcessManager();
199 G4String particleName = particle->GetParticleName();
200
201 if (particleName == "gamma")
202 {
203 // Construct processes for gamma
204
205 thePhotoElectricEffect = new G4PhotoElectricEffect();
206 theComptonScattering = new G4ComptonScattering();
207 theGammaConversion = new G4GammaConversion();
208
209 pmanager->AddDiscreteProcess(thePhotoElectricEffect);
210 pmanager->AddDiscreteProcess(theComptonScattering);
211
212 pmanager->AddDiscreteProcess(theGammaConversion);
213
214 }
215 else if (particleName == "e-")
216 {
217 // Construct processes for electron
218
219 theeminusIonisation = new G4eIonisation();
220 theeminusBremsstrahlung = new G4eBremsstrahlung();
221 theeminusStepCut = new F02StepCut();
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 F02StepCut();
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 F02StepCut* muonStepCut = new F02StepCut();
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
256 pmanager->AddProcess( muonStepCut,-1,-1,3);
257 muonStepCut->SetMaxStep(MaxChargedStep) ;
258
259 }
260 else if (
261 particleName == "proton"
262 || particleName == "antiproton"
263 || particleName == "pi+"
264 || particleName == "pi-"
265 || particleName == "kaon+"
266 || particleName == "kaon-"
267 )
268 {
269 F02StepCut* thehadronStepCut = new F02StepCut();
270
271 G4hIonisation* thehIonisation = new G4hIonisation() ;
272 G4hMultipleScattering* thehMultipleScattering =
273 new G4hMultipleScattering() ;
274
275
276 pmanager->AddProcess(thehMultipleScattering,-1,1,1);
277 pmanager->AddProcess(thehIonisation,-1,2,2);
278
279 pmanager->AddProcess( thehadronStepCut,-1,-1,3);
280 thehadronStepCut->SetMaxStep(MaxChargedStep) ;
281 }
282 }
283}
284
285#include "G4Decay.hh"
286
287void F02PhysicsList::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 F02PhysicsList::SetCuts()
314{
315 G4Timer theTimer ;
316 theTimer.Start() ;
317 if (verboseLevel >0)
318 {
319 G4cout << "F02PhysicsList::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 F02PhysicsList::SetGammaCut(G4double val)
342{
343 cutForGamma = val;
344}
345
346///////////////////////////////////////////////////////////////////////////
347
348void F02PhysicsList::SetElectronCut(G4double val)
349{
350 cutForElectron = val;
351}
352
353////////////////////////////////////////////////////////////////////////////
354
355void F02PhysicsList::SetMaxStep(G4double step)
356{
357 MaxChargedStep = step ;
358 G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
359 G4cout << G4endl;
360}
361
Note: See TracBrowser for help on using the repository browser.