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

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

update

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.11 2007/05/23 13:40:28 tnikitin Exp $
28// GEANT4 tag $Name: $
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), theGammaConversion(0),
59 theeminusMultipleScattering(0), theeminusIonisation(0),
60 theeminusBremsstrahlung(0),
61 theeplusMultipleScattering(0), theeplusIonisation(0),
62 theeplusBremsstrahlung(0), theeplusAnnihilation(0),
63 theeminusStepCut(0), theeplusStepCut(0)
64{
65 pDet = p;
66
67 defaultCutValue = 1.000*mm ;
68
69 cutForGamma = defaultCutValue ;
70 cutForElectron = defaultCutValue ;
71
72 SetVerboseLevel(1);
73 physicsListMessenger = new F02PhysicsListMessenger(this);
74}
75
76/////////////////////////////////////////////////////////////////////////
77//
78//
79
80F02PhysicsList::~F02PhysicsList()
81{
82 delete physicsListMessenger;
83}
84
85///////////////////////////////////////////////////////////////////////////
86//
87//
88
89void F02PhysicsList::ConstructParticle()
90{
91 // In this method, static member functions should be called
92 // for all particles which you want to use.
93 // This ensures that objects of these particle types will be
94 // created in the program.
95
96 ConstructBosons();
97 ConstructLeptons();
98 ConstructMesons();
99 ConstructBarions();
100}
101
102////////////////////////////////////////////////////////////////////////////
103//
104//
105
106void F02PhysicsList::ConstructBosons()
107{
108 // gamma
109
110 G4Gamma::GammaDefinition();
111
112 // charged geantino
113
114 G4ChargedGeantino::ChargedGeantinoDefinition();
115
116
117}
118
119void F02PhysicsList::ConstructLeptons()
120{
121 // leptons
122
123 G4Electron::ElectronDefinition();
124 G4Positron::PositronDefinition();
125 G4MuonPlus::MuonPlusDefinition();
126 G4MuonMinus::MuonMinusDefinition();
127
128 G4NeutrinoE::NeutrinoEDefinition();
129 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
130 G4NeutrinoMu::NeutrinoMuDefinition();
131 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
132}
133
134void F02PhysicsList::ConstructMesons()
135{
136 // mesons
137
138 G4PionPlus::PionPlusDefinition();
139 G4PionMinus::PionMinusDefinition();
140 G4PionZero::PionZeroDefinition();
141 G4KaonPlus::KaonPlusDefinition();
142 G4KaonMinus::KaonMinusDefinition();
143}
144
145
146void F02PhysicsList::ConstructBarions()
147{
148// barions
149
150 G4Proton::ProtonDefinition();
151 G4AntiProton::AntiProtonDefinition();
152}
153
154
155///////////////////////////////////////////////////////////////////////
156//
157//
158
159void F02PhysicsList::ConstructProcess()
160{
161 AddTransportation();
162 // AddParameterisation();
163
164 ConstructEM();
165 ConstructGeneral();
166}
167
168/////////////////////////////////////////////////////////////////////////////
169//
170//
171
172#include "G4ComptonScattering.hh"
173#include "G4GammaConversion.hh"
174#include "G4PhotoElectricEffect.hh"
175
176#include "G4MultipleScattering.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 "F02StepCut.hh"
189
190void F02PhysicsList::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 theeminusStepCut = new F02StepCut();
221
222 pmanager->AddProcess(theeminusIonisation,-1,2,2);
223 pmanager->AddProcess(theeminusBremsstrahlung,-1,-1,3);
224 pmanager->AddProcess(theeminusStepCut,-1,-1,4);
225 theeminusStepCut->SetMaxStep(MaxChargedStep) ;
226
227 }
228 else if (particleName == "e+")
229 {
230 // Construct processes for positron
231
232 theeplusIonisation = new G4eIonisation();
233 theeplusBremsstrahlung = new G4eBremsstrahlung();
234 theeplusStepCut = new F02StepCut();
235
236 pmanager->AddProcess(theeplusIonisation,-1,2,2);
237 pmanager->AddProcess(theeplusBremsstrahlung,-1,-1,3);
238 pmanager->AddProcess(theeplusStepCut,-1,-1,5);
239 theeplusStepCut->SetMaxStep(MaxChargedStep) ;
240
241 }
242 else if( particleName == "mu+" ||
243 particleName == "mu-" )
244 {
245 // Construct processes for muon+
246
247 F02StepCut* muonStepCut = new F02StepCut();
248
249 G4MuIonisation* themuIonisation = new G4MuIonisation() ;
250 pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
251 pmanager->AddProcess(themuIonisation,-1,2,2);
252 pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
253 pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
254
255 pmanager->AddProcess( muonStepCut,-1,-1,3);
256 muonStepCut->SetMaxStep(MaxChargedStep) ;
257
258 }
259 else if (
260 particleName == "proton"
261 || particleName == "antiproton"
262 || particleName == "pi+"
263 || particleName == "pi-"
264 || particleName == "kaon+"
265 || particleName == "kaon-"
266 )
267 {
268 F02StepCut* thehadronStepCut = new F02StepCut();
269
270 G4hIonisation* thehIonisation = new G4hIonisation() ;
271 G4MultipleScattering* thehMultipleScattering =
272 new G4MultipleScattering() ;
273
274
275 pmanager->AddProcess(thehMultipleScattering,-1,1,1);
276 pmanager->AddProcess(thehIonisation,-1,2,2);
277
278 pmanager->AddProcess( thehadronStepCut,-1,-1,3);
279 thehadronStepCut->SetMaxStep(MaxChargedStep) ;
280 }
281 }
282}
283
284#include "G4Decay.hh"
285
286void F02PhysicsList::ConstructGeneral()
287{
288 // Add Decay Process
289
290 G4Decay* theDecayProcess = new G4Decay();
291 theParticleIterator->reset();
292
293 while( (*theParticleIterator)() )
294 {
295 G4ParticleDefinition* particle = theParticleIterator->value();
296 G4ProcessManager* pmanager = particle->GetProcessManager();
297
298 if (theDecayProcess->IsApplicable(*particle))
299 {
300 pmanager ->AddProcess(theDecayProcess);
301
302 // set ordering for PostStepDoIt and AtRestDoIt
303
304 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
305 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
306 }
307 }
308}
309
310/////////////////////////////////////////////////////////////////////////////
311
312void F02PhysicsList::SetCuts()
313{
314 G4Timer theTimer ;
315 theTimer.Start() ;
316 if (verboseLevel >0)
317 {
318 G4cout << "F02PhysicsList::SetCuts:";
319 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
320 }
321 // set cut values for gamma at first and for e- second and next for e+,
322 // because some processes for e+/e- need cut values for gamma
323
324 SetCutValue(cutForGamma,"gamma");
325
326 SetCutValue(cutForElectron,"e-");
327 SetCutValue(cutForElectron,"e+");
328
329 if (verboseLevel>1) DumpCutValuesTable();
330
331 theTimer.Stop();
332 G4cout.precision(6);
333 G4cout << G4endl ;
334 G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed() << " s " <<G4endl;
335
336}
337
338///////////////////////////////////////////////////////////////////////////
339
340void F02PhysicsList::SetGammaCut(G4double val)
341{
342 cutForGamma = val;
343}
344
345///////////////////////////////////////////////////////////////////////////
346
347void F02PhysicsList::SetElectronCut(G4double val)
348{
349 cutForElectron = val;
350}
351
352////////////////////////////////////////////////////////////////////////////
353
354void F02PhysicsList::SetMaxStep(G4double step)
355{
356 MaxChargedStep = step ;
357 G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
358 G4cout << G4endl;
359}
360
Note: See TracBrowser for help on using the repository browser.