source: trunk/examples/extended/field/field01/src/F01PhysicsList.cc@ 1010

Last change on this file since 1010 was 807, checked in by garnier, 17 years ago

update

File size: 10.4 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: F01PhysicsList.cc,v 1.12 2007/05/23 09:14:09 japost Exp $
28// GEANT4 tag $Name: $
29//
30
31#include "G4Timer.hh"
32
33#include "F01PhysicsList.hh"
34#include "F01DetectorConstruction.hh"
35#include "F01PhysicsListMessenger.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
55F01PhysicsList::F01PhysicsList(F01DetectorConstruction* p)
56: G4VUserPhysicsList(), MaxChargedStep(DBL_MAX),
57 thePhotoElectricEffect(0), theComptonScattering(0), theGammaConversion(0),
58 theeminusMultipleScattering(0), theeminusIonisation(0),
59 theeminusBremsstrahlung(0),
60 theeplusMultipleScattering(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 F01PhysicsListMessenger(this);
73}
74
75/////////////////////////////////////////////////////////////////////////
76//
77//
78
79F01PhysicsList::~F01PhysicsList()
80{
81 delete physicsListMessenger;
82}
83
84///////////////////////////////////////////////////////////////////////////
85//
86//
87
88void F01PhysicsList::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 F01PhysicsList::ConstructBosons()
106{
107 // gamma
108
109 G4Gamma::GammaDefinition();
110
111 // charged geantino
112
113 G4ChargedGeantino::ChargedGeantinoDefinition();
114
115
116}
117
118void F01PhysicsList::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 F01PhysicsList::ConstructMesons()
134{
135 // mesons
136
137 G4PionPlus::PionPlusDefinition();
138 G4PionMinus::PionMinusDefinition();
139 G4PionZero::PionZeroDefinition();
140 G4KaonPlus::KaonPlusDefinition();
141 G4KaonMinus::KaonMinusDefinition();
142}
143
144
145void F01PhysicsList::ConstructBarions()
146{
147// barions
148
149 G4Proton::ProtonDefinition();
150 G4AntiProton::AntiProtonDefinition();
151}
152
153
154///////////////////////////////////////////////////////////////////////
155//
156//
157
158void F01PhysicsList::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 "G4MultipleScattering.hh"
176
177#include "G4eIonisation.hh"
178#include "G4eBremsstrahlung.hh"
179#include "G4eplusAnnihilation.hh"
180
181#include "G4MuIonisation.hh"
182#include "G4MuBremsstrahlung.hh"
183#include "G4MuPairProduction.hh"
184
185#include "G4hIonisation.hh"
186
187#include "F01StepCut.hh"
188
189void F01PhysicsList::ConstructEM()
190{
191 theParticleIterator->reset();
192
193 while( (*theParticleIterator)() )
194 {
195 G4ParticleDefinition* particle = theParticleIterator->value();
196 G4ProcessManager* pmanager = particle->GetProcessManager();
197 G4String particleName = particle->GetParticleName();
198
199 if (particleName == "gamma")
200 {
201 // Construct processes for gamma
202
203 thePhotoElectricEffect = new G4PhotoElectricEffect();
204 theComptonScattering = new G4ComptonScattering();
205 theGammaConversion = new G4GammaConversion();
206
207 pmanager->AddDiscreteProcess(thePhotoElectricEffect);
208 pmanager->AddDiscreteProcess(theComptonScattering);
209
210 pmanager->AddDiscreteProcess(theGammaConversion);
211
212 }
213 else if (particleName == "e-")
214 {
215 // Construct processes for electron
216
217 // theeminusMultipleScattering = new G4MultipleScattering();
218 theeminusIonisation = new G4eIonisation();
219 theeminusBremsstrahlung = new G4eBremsstrahlung();
220
221
222 theeminusStepCut = new F01StepCut();
223
224 // pmanager->AddProcess(theeminusMultipleScattering,-1,1,1);
225
226 pmanager->AddProcess(theeminusIonisation,-1,2,2);
227
228
229 pmanager->AddProcess(theeminusBremsstrahlung,-1,-1,3);
230
231
232 pmanager->AddProcess(theeminusStepCut,-1,-1,4);
233 theeminusStepCut->SetMaxStep(MaxChargedStep) ;
234
235 }
236 else if (particleName == "e+")
237 {
238 // Construct processes for positron
239
240 // theeplusMultipleScattering = new G4MultipleScattering();
241 theeplusIonisation = new G4eIonisation();
242 theeplusBremsstrahlung = new G4eBremsstrahlung();
243 // theeplusAnnihilation = new G4eplusAnnihilation();
244
245
246 theeplusStepCut = new F01StepCut();
247
248 // pmanager->AddProcess(theeplusMultipleScattering,-1,1,1);
249 pmanager->AddProcess(theeplusIonisation,-1,2,2);
250 pmanager->AddProcess(theeplusBremsstrahlung,-1,-1,3);
251 // pmanager->AddProcess(theeplusAnnihilation,0,-1,4);
252
253
254 pmanager->AddProcess(theeplusStepCut,-1,-1,5);
255 theeplusStepCut->SetMaxStep(MaxChargedStep) ;
256
257 }
258 else if( particleName == "mu+" ||
259 particleName == "mu-" )
260 {
261 // Construct processes for muon+
262
263 F01StepCut* muonStepCut = new F01StepCut();
264
265 G4MuIonisation* themuIonisation = new G4MuIonisation() ;
266 pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
267 pmanager->AddProcess(themuIonisation,-1,2,2);
268 pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
269 pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
270
271 pmanager->AddProcess( muonStepCut,-1,-1,3);
272 muonStepCut->SetMaxStep(MaxChargedStep) ;
273
274 }
275 else if (
276 particleName == "proton"
277 || particleName == "antiproton"
278 || particleName == "pi+"
279 || particleName == "pi-"
280 || particleName == "kaon+"
281 || particleName == "kaon-"
282 )
283 {
284 F01StepCut* thehadronStepCut = new F01StepCut();
285
286 G4hIonisation* thehIonisation = new G4hIonisation() ;
287 G4MultipleScattering* thehMultipleScattering =
288 new G4MultipleScattering() ;
289
290
291 pmanager->AddProcess(thehMultipleScattering,-1,1,1);
292 pmanager->AddProcess(thehIonisation,-1,2,2);
293
294
295 pmanager->AddProcess( thehadronStepCut,-1,-1,3);
296 thehadronStepCut->SetMaxStep(MaxChargedStep) ;
297 thehadronStepCut->SetMaxStep(10*mm) ;
298
299 }
300 }
301}
302
303
304#include "G4Decay.hh"
305
306void F01PhysicsList::ConstructGeneral()
307{
308 // Add Decay Process
309
310 G4Decay* theDecayProcess = new G4Decay();
311 theParticleIterator->reset();
312
313 while( (*theParticleIterator)() )
314 {
315 G4ParticleDefinition* particle = theParticleIterator->value();
316 G4ProcessManager* pmanager = particle->GetProcessManager();
317
318 if (theDecayProcess->IsApplicable(*particle))
319 {
320 pmanager ->AddProcess(theDecayProcess);
321
322 // set ordering for PostStepDoIt and AtRestDoIt
323
324 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
325 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
326 }
327 }
328}
329
330
331
332/////////////////////////////////////////////////////////////////////////////
333
334void F01PhysicsList::SetCuts()
335{
336 G4Timer theTimer ;
337 theTimer.Start() ;
338 if (verboseLevel >0)
339 {
340 G4cout << "F01PhysicsList::SetCuts:";
341 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
342 }
343 // set cut values for gamma at first and for e- second and next for e+,
344 // because some processes for e+/e- need cut values for gamma
345
346 SetCutValue(cutForGamma,"gamma");
347
348 SetCutValue(cutForElectron,"e-");
349 SetCutValue(cutForElectron,"e+");
350
351 if (verboseLevel>1) DumpCutValuesTable();
352
353 theTimer.Stop();
354 G4cout.precision(6);
355 G4cout << G4endl ;
356 G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed() << " s " <<G4endl;
357
358}
359
360///////////////////////////////////////////////////////////////////////////
361
362void F01PhysicsList::SetGammaCut(G4double val)
363{
364 cutForGamma = val;
365}
366
367///////////////////////////////////////////////////////////////////////////
368
369void F01PhysicsList::SetElectronCut(G4double val)
370{
371 cutForElectron = val;
372}
373
374
375////////////////////////////////////////////////////////////////////////////
376
377void F01PhysicsList::SetMaxStep(G4double step)
378{
379 MaxChargedStep = step ;
380 G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
381 G4cout << G4endl;
382}
Note: See TracBrowser for help on using the repository browser.