source: trunk/examples/advanced/xray_fluorescence/src/XrayFluoPhysicsList.cc @ 1230

Last change on this file since 1230 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

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: XrayFluoPhysicsList.cc
28// GEANT4 tag $Name: xray_fluo-V03-02-00
29//
30// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
31//
32// History:
33// -----------
34// 28 Nov 2001 Elena Guardincerri     Created
35//
36// -------------------------------------------------------------------
37
38#include "G4ParticleDefinition.hh"
39#include "G4ParticleTypes.hh"
40#include "G4ProcessManager.hh"
41#include "XrayFluoPhysicsList.hh"
42#include "XrayFluoPhysicsListMessenger.hh"
43#include "XrayFluoDetectorConstruction.hh"
44#include "XrayFluoPlaneDetectorConstruction.hh"
45#include "XrayFluoMercuryDetectorConstruction.hh"
46
47/////////////////////////////////////////
48#include "G4LeptonConstructor.hh"
49#include "G4BosonConstructor.hh"
50//#include "G4MesonConstructor.hh"
51#include "G4IonConstructor.hh"
52#include "G4BaryonConstructor.hh"
53/////////////////////////////////////////
54
55/*
56#include "G4ParticleDefinition.hh"
57#include "G4ParticleWithCuts.hh"
58#include "G4ProcessManager.hh"
59#include "G4ParticleTypes.hh"
60#include "G4ParticleTable.hh"
61#include "G4ios.hh"
62*/
63
64//#include "G4Region.hh"
65//#include "G4RegionStore.hh"
66
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
69
70XrayFluoPhysicsList::XrayFluoPhysicsList(XrayFluoDetectorConstruction* p)
71  : G4VUserPhysicsList(),pDet(0),planeDet(0),mercuryDet(0)
72
73{
74  pDet = p;
75
76  SetGELowLimit(250*eV);
77
78  defaultCutValue = 10e-6*mm;
79
80  cutForGamma = defaultCutValue;
81  cutForElectron = defaultCutValue;
82  cutForProton    = 0.001*mm;
83  SetVerboseLevel(1);
84  physicsListMessenger = new XrayFluoPhysicsListMessenger(this);
85
86  /*
87  G4String regName = "SampleRegion";
88  G4double cutValue = 0.000001 * mm; 
89  G4Region* reg = G4RegionStore::GetInstance()->GetRegion(regName);
90
91  G4ProductionCuts* cuts = new G4ProductionCuts;
92  cuts->SetProductionCut(cutValue);
93  reg->SetProductionCuts(cuts);
94  */
95
96
97}
98
99//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
100
101XrayFluoPhysicsList::XrayFluoPhysicsList(XrayFluoPlaneDetectorConstruction* p)
102  : G4VUserPhysicsList(),pDet(0),planeDet(0),mercuryDet(0)
103{
104  planeDet = p;
105
106  //  SetGELowLimit(250*eV);
107
108  defaultCutValue = 0.000001*mm;
109
110  cutForGamma = defaultCutValue;
111  cutForElectron = defaultCutValue;
112  cutForProton    = 0.001*mm;
113  SetVerboseLevel(1);
114  physicsListMessenger = new XrayFluoPhysicsListMessenger(this);
115}
116
117//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
118
119XrayFluoPhysicsList::XrayFluoPhysicsList(XrayFluoMercuryDetectorConstruction* p)
120: G4VUserPhysicsList(),pDet(0),planeDet(0),mercuryDet(0)
121{
122  mercuryDet = p;
123
124  //  SetGELowLimit(250*eV);
125
126  defaultCutValue = 0.000001*mm;
127
128  cutForGamma = defaultCutValue;
129  cutForElectron = defaultCutValue;
130  cutForProton    = 0.001*mm;
131  SetVerboseLevel(1);
132  physicsListMessenger = new XrayFluoPhysicsListMessenger(this);
133}
134
135//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
136
137
138XrayFluoPhysicsList::~XrayFluoPhysicsList()
139{
140  delete physicsListMessenger;
141}
142
143//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
144
145void XrayFluoPhysicsList::ConstructParticle()
146{
147  // In this method, static member functions should be called
148  // for all particles which you want to use.
149  // This ensures that objects of these particle types will be
150  // created in the program.
151
152  ConstructBosons();
153  ConstructLeptons();
154  ConstructBarions();
155  ConstructIons();
156}
157
158//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
159
160void XrayFluoPhysicsList::ConstructBosons()
161{
162 
163  // gamma
164  G4Gamma::GammaDefinition();
165 
166}
167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
168
169void XrayFluoPhysicsList::ConstructLeptons()
170{
171  // leptons
172  G4Electron::ElectronDefinition();
173  G4Positron::PositronDefinition();
174}
175//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
176
177void XrayFluoPhysicsList::ConstructBarions()
178{
179  G4BaryonConstructor baryon;
180  baryon.ConstructParticle();
181  //  G4Proton::ProtonDefinition();
182}
183void XrayFluoPhysicsList::ConstructIons()
184{
185//  Ions
186  G4IonConstructor ions;
187  ions.ConstructParticle();
188  //  G4Alpha::AlphaDefinition();
189}
190
191void XrayFluoPhysicsList::ConstructProcess()
192{
193  AddTransportation();
194  ConstructEM();
195}
196
197//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
198
199
200#include "G4PhotoElectricEffect.hh"
201#include "G4LivermorePhotoElectricModel.hh"
202
203#include "G4ComptonScattering.hh"
204#include "G4LivermoreComptonModel.hh"
205
206#include "G4GammaConversion.hh"
207#include "G4LivermoreGammaConversionModel.hh"
208
209#include "G4RayleighScattering.hh"
210#include "G4LivermoreRayleighModel.hh"
211/*
212#include "G4LowEnergyCompton.hh"
213#include "G4LowEnergyGammaConversion.hh"
214#include "G4LowEnergyPhotoElectric.hh"
215#include "G4LowEnergyRayleigh.hh"
216*/
217
218// e+-
219/*
220#include "G4MultipleScattering.hh"
221#include "G4eIonisation.hh"
222#include "G4eBremsstrahlung.hh"
223
224
225#include "G4LowEnergyIonisation.hh"
226#include "G4LowEnergyBremsstrahlung.hh"
227*/
228
229#include "G4eMultipleScattering.hh"
230#include "G4UniversalFluctuation.hh"
231
232#include "G4eIonisation.hh"
233#include "G4LivermoreIonisationModel.hh"
234
235#include "G4eBremsstrahlung.hh"
236#include "G4LivermoreBremsstrahlungModel.hh"
237
238#include "G4eplusAnnihilation.hh"
239
240#include "G4hLowEnergyIonisation.hh"
241#include "G4hMultipleScattering.hh"
242
243// options
244
245#include "G4LossTableManager.hh"
246#include "G4EmProcessOptions.hh"
247
248//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
249
250void XrayFluoPhysicsList::ConstructEM()
251{
252  theParticleIterator->reset();
253  while( (*theParticleIterator)() ){
254    G4ParticleDefinition* particle = theParticleIterator->value();
255    G4ProcessManager* pmanager = particle->GetProcessManager();
256    G4String particleName = particle->GetParticleName();
257     
258    if (particleName == "gamma") {
259
260      // gamma         
261      /*
262      pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
263     
264      LePeprocess = new G4LowEnergyPhotoElectric();
265
266
267      pmanager->AddDiscreteProcess(LePeprocess);
268
269      pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh("Rayleigh"));
270     
271      */
272
273      G4PhotoElectricEffect* thePhotoElectricEffect = new G4PhotoElectricEffect();
274      G4LivermorePhotoElectricModel* theLivermorePhotoElectricModel = new G4LivermorePhotoElectricModel();
275
276      theLivermorePhotoElectricModel->ActivateAuger(true);
277      theLivermorePhotoElectricModel->SetCutForLowEnSecPhotons(0.010 * keV);
278      theLivermorePhotoElectricModel->SetCutForLowEnSecElectrons(0.010 * keV);
279
280      thePhotoElectricEffect->AddEmModel(0, theLivermorePhotoElectricModel);
281      pmanager->AddDiscreteProcess(thePhotoElectricEffect);
282
283
284      G4ComptonScattering* theComptonScattering = new G4ComptonScattering();
285      G4LivermoreComptonModel* theLivermoreComptonModel = new G4LivermoreComptonModel();
286      theComptonScattering->AddEmModel(0, theLivermoreComptonModel);
287      pmanager->AddDiscreteProcess(theComptonScattering);
288
289      G4GammaConversion* theGammaConversion = new G4GammaConversion();
290      G4LivermoreGammaConversionModel* theLivermoreGammaConversionModel = new G4LivermoreGammaConversionModel();
291      theGammaConversion->AddEmModel(0, theLivermoreGammaConversionModel);
292      pmanager->AddDiscreteProcess(theGammaConversion);
293
294      G4RayleighScattering* theRayleigh = new G4RayleighScattering();
295      G4LivermoreRayleighModel* theRayleighModel = new G4LivermoreRayleighModel();
296      theRayleigh->AddEmModel(0, theRayleighModel);
297      pmanager->AddDiscreteProcess(theRayleigh);
298
299
300
301    } else if (particleName == "e-") {
302      //electron
303      /*   
304      pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
305
306      LeIoprocess = new G4LowEnergyIonisation("IONI");
307      LeIoprocess->ActivateAuger(true);
308      //eIoProcess = new G4eIonisation("stdIONI");
309      LeIoprocess->SetCutForLowEnSecPhotons(0.01*keV);
310      LeIoprocess->SetCutForLowEnSecElectrons(0.01*keV);
311      pmanager->AddProcess(LeIoprocess, -1,  2, 2);
312
313      LeBrprocess = new G4LowEnergyBremsstrahlung();
314      pmanager->AddProcess(LeBrprocess, -1, -1, 3);
315      */     
316     
317      G4eMultipleScattering* msc = new G4eMultipleScattering();
318      pmanager->AddProcess(msc,                   -1, 1, 1);
319     
320      // Ionisation
321      G4eIonisation* eIoni = new G4eIonisation();
322      G4LivermoreIonisationModel* ioniModel = new G4LivermoreIonisationModel();
323      eIoni->AddEmModel(0, ioniModel, new G4UniversalFluctuation() );
324
325      //      ioniModel->SetCutForLowEnSecPhotons(0.01*keV);
326      //      ioniModel->SetCutForLowEnSecElectrons(0.01*keV);
327
328      eIoni->SetStepFunction(0.2, 100*um); //     
329      pmanager->AddProcess(eIoni,                 -1, 2, 2);
330     
331      // Bremsstrahlung
332      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
333      eBrem->AddEmModel(0, new G4LivermoreBremsstrahlungModel());
334      pmanager->AddProcess(eBrem,                 -1,-3, 3);
335
336
337
338
339      } else if (particleName == "e+") {
340      //positron
341      pmanager->AddProcess(new G4eMultipleScattering(),-1, 1,1);
342      pmanager->AddProcess(new G4eIonisation(),      -1, 2,2);
343      pmanager->AddProcess(new G4eBremsstrahlung(),   -1,-1,3);
344      pmanager->AddProcess(new G4eplusAnnihilation(),  0,-1,4);
345     
346    } 
347    else if (particleName == "proton") {
348      //proton
349      G4hLowEnergyIonisation* hIoni = new G4hLowEnergyIonisation();
350      hIoni->SetFluorescence(true);
351      pmanager->AddProcess(new G4hMultipleScattering(),-1,1,1);
352      pmanager->AddProcess(hIoni,-1, 2,2);
353    }
354    else if (   particleName == "alpha" )
355      {
356       
357        pmanager->AddProcess(new G4hMultipleScattering(),-1,1,1);
358        G4hLowEnergyIonisation* iIon = new G4hLowEnergyIonisation() ;
359        pmanager->AddProcess(iIon,-1,2,2);
360      }
361   
362  }
363
364}
365
366//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
367
368void XrayFluoPhysicsList::SetGELowLimit(G4double lowcut)
369{
370  if (verboseLevel >0){
371    G4cout << "XrayFluoPhysicsList::SetCuts:";
372    G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
373  } 
374
375  G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowcut,1e5);
376
377
378}
379
380void XrayFluoPhysicsList::SetGammaLowLimit(G4double lowcut)
381{
382  if (verboseLevel >0){
383    G4cout << "XrayFluoPhysicsList::SetCuts:";
384    G4cout << "Gamma cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
385  } 
386
387  SetGELowLimit(lowcut);
388
389//   G4Gamma::SetEnergyRange(lowcut,1e5);
390
391}
392
393void XrayFluoPhysicsList::SetElectronLowLimit(G4double lowcut)
394{
395  if (verboseLevel >0){
396
397    G4cout << "XrayFluoPhysicsList::SetCuts:";
398    G4cout << "Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
399
400  } 
401
402  SetGELowLimit(lowcut);
403
404//   G4Electron::SetEnergyRange(lowcut,1e5);
405
406}
407
408
409
410void XrayFluoPhysicsList::SetGammaCut(G4double val)
411{
412  ResetCuts();
413  cutForGamma = val;
414}
415
416//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
417
418
419
420void XrayFluoPhysicsList::SetElectronCut(G4double val)
421{
422  ResetCuts();
423  cutForElectron = val;
424}
425
426void XrayFluoPhysicsList::SetCuts(){
427
428  G4double lowlimit=20*eV;
429  G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowlimit, 100.*GeV);
430  SetCutValue(cutForGamma,"gamma");
431  SetCutValue(cutForElectron,"e-");
432  SetCutValue(cutForElectron,"e+");
433  SetCutValue(cutForProton, "proton");
434  //SetCutValueForOthers(cutForProton);
435  if (verboseLevel>0) DumpCutValuesTable();
436}
437
438//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
439
440void XrayFluoPhysicsList::SetLowEnSecPhotCut(G4double cut){
441
442  cut=0;
443 
444//  G4cout<<"Low energy secondary photons cut is now set to: "<<cut/MeV<<" (MeV)"<<G4endl;
445//  G4cout<<"for processes LowEnergyBremsstrahlung, LowEnergyPhotoElectric, LowEnergyIonisation"<<G4endl;
446//  LeBrprocess->SetCutForLowEnSecPhotons(cut);
447//  LePeprocess->SetCutForLowEnSecPhotons(cut);
448//  LeIoprocess->SetCutForLowEnSecPhotons(cut);
449}
450
451void XrayFluoPhysicsList::SetLowEnSecElecCut(G4double cut){
452 
453  cut = 0;
454//  G4cout<<"Low energy secondary electrons cut is now set to: "<<cut/MeV<<" (MeV)"<<G4endl;
455// 
456//  G4cout<<"for processes LowEnergyIonisation"<<G4endl;
457// 
458//  LeIoprocess->SetCutForLowEnSecElectrons(cut);
459}
460//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
461
462void XrayFluoPhysicsList::SetProtonCut(G4double val)
463{
464  ResetCuts();
465  cutForProton = val;
466}
467//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
468
469
470void XrayFluoPhysicsList::SetCutsByEnergy(G4double val)
471{
472  G4ParticleTable* theXrayFluoParticleTable =  G4ParticleTable::GetParticleTable();
473
474  G4Material* currMat = 0;
475   
476  if(pDet){
477    currMat = pDet->XrayFluoDetectorConstruction::GetSampleMaterial();
478  }
479  else if(planeDet){
480    currMat = planeDet->XrayFluoPlaneDetectorConstruction::GetPlaneMaterial(); 
481  }
482 
483  else if(mercuryDet){
484    currMat = mercuryDet->GetMercuryMaterial();
485  }
486
487  G4ParticleDefinition* part;
488  G4double cut;
489 
490  part = theXrayFluoParticleTable->FindParticle("e-");
491  cut = G4EnergyLossTables::GetRange(part,val,currMat);
492  SetCutValue(cut, "e-");
493 
494  part = theXrayFluoParticleTable->FindParticle("proton");
495  cut = G4EnergyLossTables::GetRange(part,val,currMat);
496  SetCutValue(cut, "proton");
497 
498  part = theXrayFluoParticleTable->FindParticle("gamma");
499  cut = G4EnergyLossTables::GetRange(part,val,currMat);
500  SetCutValue(cut, "gamma");
501
502}
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
Note: See TracBrowser for help on using the repository browser.