source: trunk/source/geometry/magneticfield/test/field02/src/F02PhysicsList.cc@ 1306

Last change on this file since 1306 was 1199, checked in by garnier, 16 years ago

nvx fichiers dans CVS

File size: 14.7 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.4 2006/06/29 18:28:04 gunter Exp $
28// GEANT4 tag $Name: HEAD $
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#include "G4FastSimulationManagerProcess.hh"
50
51
52/////////////////////////////////////////////////////////////
53//
54//
55
56F02PhysicsList::F02PhysicsList(F02DetectorConstruction* p)
57: G4VUserPhysicsList(),
58 thePhotoElectricEffect(NULL),theComptonScattering(NULL),
59 theGammaConversion(NULL),
60 theeminusMultipleScattering(NULL),theeminusIonisation(NULL),
61 theeminusBremsstrahlung(NULL),
62 theeplusMultipleScattering(NULL),theeplusIonisation(NULL),
63 theeplusBremsstrahlung(NULL),
64 theeplusAnnihilation(NULL),
65 theeminusStepCut(NULL),theeplusStepCut(NULL),
66 MaxChargedStep(DBL_MAX)
67{
68 pDet = p;
69
70 defaultCutValue = 1.000*mm ;
71
72 cutForGamma = defaultCutValue ;
73 cutForElectron = defaultCutValue ;
74 cutForProton = defaultCutValue ;
75
76 SetVerboseLevel(1);
77 physicsListMessenger = new F02PhysicsListMessenger(this);
78}
79
80/////////////////////////////////////////////////////////////////////////
81//
82//
83
84F02PhysicsList::~F02PhysicsList()
85{
86 delete physicsListMessenger;
87}
88
89///////////////////////////////////////////////////////////////////////////
90//
91//
92
93void F02PhysicsList::ConstructParticle()
94{
95 // In this method, static member functions should be called
96 // for all particles which you want to use.
97 // This ensures that objects of these particle types will be
98 // created in the program.
99
100 ConstructBosons();
101 ConstructLeptons();
102 ConstructMesons();
103 ConstructBarions();
104}
105
106////////////////////////////////////////////////////////////////////////////
107//
108//
109
110void F02PhysicsList::ConstructBosons()
111{
112 // gamma
113
114 G4Gamma::GammaDefinition();
115
116 // charged geantino
117
118 G4ChargedGeantino::ChargedGeantinoDefinition();
119
120
121}
122
123void F02PhysicsList::ConstructLeptons()
124{
125 // leptons
126
127 G4Electron::ElectronDefinition();
128 G4Positron::PositronDefinition();
129 G4MuonPlus::MuonPlusDefinition();
130 G4MuonMinus::MuonMinusDefinition();
131
132 G4NeutrinoE::NeutrinoEDefinition();
133 G4AntiNeutrinoE::AntiNeutrinoEDefinition();
134 G4NeutrinoMu::NeutrinoMuDefinition();
135 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
136}
137
138void F02PhysicsList::ConstructMesons()
139{
140 // mesons
141
142 G4PionPlus::PionPlusDefinition();
143 G4PionMinus::PionMinusDefinition();
144 G4PionZero::PionZeroDefinition();
145 G4KaonPlus::KaonPlusDefinition();
146 G4KaonMinus::KaonMinusDefinition();
147}
148
149
150void F02PhysicsList::ConstructBarions()
151{
152// barions
153
154 G4Proton::ProtonDefinition();
155 G4AntiProton::AntiProtonDefinition();
156}
157
158
159///////////////////////////////////////////////////////////////////////
160//
161//
162
163void F02PhysicsList::ConstructProcess()
164{
165 AddTransportation();
166 AddParameterisation();
167
168 ConstructEM();
169 ConstructGeneral();
170}
171
172/////////////////////////////////////////////////////////////////////////////
173//
174//
175
176#include "G4ComptonScattering.hh"
177#include "G4GammaConversion.hh"
178#include "G4PhotoElectricEffect.hh"
179
180#include "G4MultipleScattering.hh"
181
182#include "G4eIonisation.hh"
183#include "G4eBremsstrahlung.hh"
184#include "G4eplusAnnihilation.hh"
185
186#include "G4MuIonisation.hh"
187#include "G4MuBremsstrahlung.hh"
188#include "G4MuPairProduction.hh"
189
190#include "G4hIonisation.hh"
191#include "G4PAIonisation.hh"
192#include "G4ForwardXrayTR.hh"
193
194#include "F02StepCut.hh"
195
196#include "G4IonisationByLogicalVolume.hh"
197
198void F02PhysicsList::ConstructEM()
199{
200 theParticleIterator->reset();
201
202 while( (*theParticleIterator)() )
203 {
204 G4ParticleDefinition* particle = theParticleIterator->value();
205 G4ProcessManager* pmanager = particle->GetProcessManager();
206 G4String particleName = particle->GetParticleName();
207
208 if (particleName == "gamma")
209 {
210 // Construct processes for gamma
211
212 thePhotoElectricEffect = new G4PhotoElectricEffect();
213 theComptonScattering = new G4ComptonScattering();
214 theGammaConversion = new G4GammaConversion();
215
216 pmanager->AddDiscreteProcess(thePhotoElectricEffect);
217 pmanager->AddDiscreteProcess(theComptonScattering);
218
219 pmanager->AddDiscreteProcess(theGammaConversion);
220
221 }
222 else if (particleName == "e-")
223 {
224 // Construct processes for electron
225
226 // theeminusMultipleScattering = new G4MultipleScattering();
227 theeminusIonisation = new G4eIonisation();
228 theeminusBremsstrahlung = new G4eBremsstrahlung();
229
230 // fPAIonisation = new G4PAIonisation("Xenon") ;
231 // fForwardXrayTR = new G4ForwardXrayTR("Air","Polypropelene","XrayTR") ;
232
233 theeminusStepCut = new F02StepCut();
234
235 // pmanager->AddProcess(theeminusMultipleScattering,-1,1,1);
236
237 pmanager->AddProcess(theeminusIonisation,-1,2,2);
238
239 // pmanager->AddProcess(new G4IonisationByLogicalVolume(particleName,
240 // pDet->GetLogicalAbsorber(),
241 // "IonisationByLogVol"),-1,-1,1);
242
243 pmanager->AddProcess(theeminusBremsstrahlung,-1,1,1);
244
245 // pmanager->AddProcess(fPAIonisation,-1,2,2);
246
247 // pmanager->AddProcess(fForwardXrayTR,-1,-1,2);
248
249 pmanager->AddProcess(theeminusStepCut,-1,-1,4);
250 theeminusStepCut->SetMaxStep(MaxChargedStep) ;
251
252 }
253 else if (particleName == "e+")
254 {
255 // Construct processes for positron
256
257 // theeplusMultipleScattering = new G4MultipleScattering();
258 theeplusIonisation = new G4eIonisation();
259 theeplusBremsstrahlung = new G4eBremsstrahlung();
260 // theeplusAnnihilation = new G4eplusAnnihilation();
261
262 // fPAIonisation = new G4PAIonisation("Xenon") ;
263 // fForwardXrayTR = new G4ForwardXrayTR("Air","Polypropelene","XrayTR") ;
264
265 theeplusStepCut = new F02StepCut();
266
267 // pmanager->AddProcess(theeplusMultipleScattering,-1,1,1);
268 pmanager->AddProcess(theeplusIonisation,-1,2,2);
269 pmanager->AddProcess(theeplusBremsstrahlung,-1,-1,3);
270 // pmanager->AddProcess(theeplusAnnihilation,0,-1,4);
271
272 // pmanager->AddProcess(fPAIonisation,-1,2,2);
273
274
275 // pmanager->AddProcess(fForwardXrayTR,-1,-1,2);
276
277 pmanager->AddProcess(theeplusStepCut,-1,-1,5);
278 theeplusStepCut->SetMaxStep(MaxChargedStep) ;
279
280 }
281 else if( particleName == "mu+" ||
282 particleName == "mu-" )
283 {
284 // Construct processes for muon+
285
286 // F02StepCut* muonStepCut = new F02StepCut();
287
288 // G4MuIonisation* themuIonisation = new G4MuIonisation() ;
289 // pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
290 // pmanager->AddProcess(themuIonisation,-1,2,2);
291 // pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
292 // pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
293
294 // pmanager->AddProcess(new G4PAIonisation("Xenon"),-1,2,2) ;
295 // pmanager->AddProcess( muonStepCut,-1,-1,3);
296 // muonStepCut->SetMaxStep(MaxChargedStep) ;
297
298 }
299 else if (
300 particleName == "proton"
301 || particleName == "antiproton"
302 || particleName == "pi+"
303 || particleName == "pi-"
304 || particleName == "kaon+"
305 || particleName == "kaon-"
306 )
307 {
308 F02StepCut* thehadronStepCut = new F02StepCut();
309
310 // G4hIonisation* thehIonisation = new G4hIonisation() ;
311 // G4MultipleScattering* thehMultipleScattering =
312 // new G4MultipleScattering() ;
313
314 // pmanager->AddProcess(new G4IonisationByLogicalVolume(particleName,
315 // pDet->GetLogicalAbsorber(),
316 // "IonisationByLogVolHadr"),-1,2,2);
317
318 // pmanager->AddProcess(thehMultipleScattering,-1,1,1);
319 // pmanager->AddProcess(thehIonisation,-1,2,2);
320
321 // pmanager->AddProcess(new G4PAIonisation("Xenon"),-1,2,2) ;
322 // pmanager->AddProcess(new G4PAIonisation("Argon"),-1,2,2) ;
323
324 pmanager->AddProcess( thehadronStepCut,-1,-1,3);
325 thehadronStepCut->SetMaxStep(MaxChargedStep) ;
326 // thehadronStepCut->SetMaxStep(10*mm) ;
327
328 }
329 }
330}
331
332
333#include "G4Decay.hh"
334
335void F02PhysicsList::ConstructGeneral()
336{
337 // Add Decay Process
338
339 G4Decay* theDecayProcess = new G4Decay();
340 theParticleIterator->reset();
341
342 while( (*theParticleIterator)() )
343 {
344 G4ParticleDefinition* particle = theParticleIterator->value();
345 G4ProcessManager* pmanager = particle->GetProcessManager();
346
347 if (theDecayProcess->IsApplicable(*particle))
348 {
349 pmanager ->AddProcess(theDecayProcess);
350
351 // set ordering for PostStepDoIt and AtRestDoIt
352
353 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
354 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
355 }
356 }
357}
358
359/////////////////////////////////////////////////////////////////////////////
360
361void F02PhysicsList::AddParameterisation()
362{
363 G4FastSimulationManagerProcess* theFastSimulationManagerProcess =
364 new G4FastSimulationManagerProcess() ;
365 theParticleIterator->reset();
366
367 while( (*theParticleIterator)() )
368 {
369 G4ParticleDefinition* particle = theParticleIterator->value() ;
370 G4ProcessManager* pmanager = particle->GetProcessManager() ;
371
372 // both postStep and alongStep action are required: because
373 // of the use of ghost volumes. If no ghost, the postStep is sufficient.
374
375 pmanager->AddProcess(theFastSimulationManagerProcess, -1, 1, 1);
376 }
377}
378
379
380
381/////////////////////////////////////////////////////////////////////////////
382
383void F02PhysicsList::SetCuts()
384{
385 G4Timer theTimer ;
386 theTimer.Start() ;
387 if (verboseLevel >0)
388 {
389 G4cout << "F02PhysicsList::SetCuts:";
390 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
391 }
392 // set cut values for gamma at first and for e- second and next for e+,
393 // because some processes for e+/e- need cut values for gamma
394
395 SetCutValue(cutForGamma,"gamma");
396
397 SetCutValue(cutForElectron,"e-");
398 SetCutValue(cutForElectron,"e+");
399
400 SetCutValue(defaultCutValue,"mu-");
401 SetCutValue(defaultCutValue,"mu+");
402
403 // set cut values for proton and anti_proton before all other hadrons
404 // because some processes for hadrons need cut values for proton/anti_proton
405
406 SetCutValue(defaultCutValue, "proton");
407 SetCutValue(defaultCutValue, "anti_proton");
408
409 SetCutValueForOthers(defaultCutValue);
410
411 if (verboseLevel>1) DumpCutValuesTable();
412
413 theTimer.Stop();
414 G4cout.precision(6);
415 G4cout << G4endl ;
416 G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed() << " s " <<G4endl;
417
418}
419
420///////////////////////////////////////////////////////////////////////////
421
422void F02PhysicsList::SetGammaCut(G4double val)
423{
424 ResetCuts();
425 cutForGamma = val;
426}
427
428///////////////////////////////////////////////////////////////////////////
429
430void F02PhysicsList::SetElectronCut(G4double val)
431{
432 ResetCuts();
433 cutForElectron = val;
434}
435
436//////////////////////////////////////////////////////////////////////
437
438void F02PhysicsList::SetProtonCut(G4double val)
439{
440 ResetCuts();
441 cutForProton = val;
442}
443
444////////////////////////////////////////////////////////////////////////////
445
446void F02PhysicsList::SetCutsByEnergy(G4double val)
447{
448 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
449 G4Material* currMat = pDet->GetAbsorberMaterial();
450
451 // set cut values for gamma at first and for e- second and next for e+,
452 // because some processes for e+/e- need cut values for gamma
453
454 G4ParticleDefinition* part;
455 G4double cut;
456
457 part = theParticleTable->FindParticle("e-");
458 cut = G4EnergyLossTables::GetRange(part,val,currMat);
459 SetCutValue(cut, "e-");
460
461 part = theParticleTable->FindParticle("e+");
462 cut = G4EnergyLossTables::GetRange(part,val,currMat);
463 SetCutValue(cut, "e+");
464
465 // set cut values for proton and anti_proton before all other hadrons
466 // because some processes for hadrons need cut values for proton/anti_proton
467
468 part = theParticleTable->FindParticle("proton");
469 cut = G4EnergyLossTables::GetRange(part,val,currMat);
470 SetCutValue(cut, "proton");
471
472 part = theParticleTable->FindParticle("anti_proton");
473 cut = G4EnergyLossTables::GetRange(part,val,currMat);
474 SetCutValue(cut, "anti_proton");
475
476 SetCutValueForOthers(cut);
477}
478
479//////////////////////////////////////////////////////////////////////////////
480
481void F02PhysicsList::GetRange(G4double val)
482{
483 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
484 G4Material* currMat = pDet->GetAbsorberMaterial();
485
486 G4ParticleDefinition* part;
487 G4double cut;
488 part = theParticleTable->FindParticle("e-");
489 cut = G4EnergyLossTables::GetRange(part,val,currMat);
490 G4cout << "material : " << currMat->GetName() << G4endl;
491 G4cout << "particle : " << part->GetParticleName() << G4endl;
492 G4cout << "energy : " << val / keV << " (keV)" << G4endl;
493 G4cout << "range : " << cut / mm << " (mm)" << G4endl;
494}
495
496////////////////////////////////////////////////////////////////////////////
497
498void F02PhysicsList::SetMaxStep(G4double step)
499{
500 MaxChargedStep = step ;
501 G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
502 G4cout << G4endl;
503}
504
Note: See TracBrowser for help on using the repository browser.