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

Last change on this file since 812 was 807, checked in by garnier, 16 years ago

update

File size: 11.6 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 "XrayFluoPhysicsList.hh"
39#include "XrayFluoPhysicsListMessenger.hh"
40#include "XrayFluoDetectorConstruction.hh"
41#include "XrayFluoPlaneDetectorConstruction.hh"
42#include "XrayFluoMercuryDetectorConstruction.hh"
43
44/////////////////////////////////////////
45//#include "G4LeptonConstructor.hh"
46//#include "G4BosonConstructor.hh"
47//#include "G4MesonConstructor.hh"
48#include "G4BaryonConstructor.hh"
49/////////////////////////////////////////
50
51
52#include "G4ParticleDefinition.hh"
53#include "G4ParticleWithCuts.hh"
54#include "G4ProcessManager.hh"
55#include "G4ParticleTypes.hh"
56#include "G4ParticleTable.hh"
57#include "G4ios.hh"
58
59#include "G4Region.hh"
60#include "G4RegionStore.hh"
61
62
63//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64
65XrayFluoPhysicsList::XrayFluoPhysicsList(XrayFluoDetectorConstruction* p)
66  : G4VUserPhysicsList(),pDet(0),planeDet(0),mercuryDet(0)
67
68{
69  pDet = p;
70
71  //  SetGELowLimit(250*eV);
72
73  defaultCutValue = 10e-6*mm;
74
75  cutForGamma = defaultCutValue;
76  cutForElectron = defaultCutValue;
77  cutForProton    = 0.001*mm;
78  SetVerboseLevel(1);
79  physicsListMessenger = new XrayFluoPhysicsListMessenger(this);
80
81  G4String regName = "SampleRegion";
82  G4double cutValue = 0.000001 * mm; 
83  G4Region* reg = G4RegionStore::GetInstance()->GetRegion(regName);
84
85  G4ProductionCuts* cuts = new G4ProductionCuts;
86  cuts->SetProductionCut(cutValue);
87  reg->SetProductionCuts(cuts);
88
89
90
91}
92
93//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
94
95XrayFluoPhysicsList::XrayFluoPhysicsList(XrayFluoPlaneDetectorConstruction* p)
96  : G4VUserPhysicsList(),pDet(0),planeDet(0),mercuryDet(0)
97{
98  planeDet = p;
99
100  //  SetGELowLimit(250*eV);
101
102  defaultCutValue = 0.000001*mm;
103
104  cutForGamma = defaultCutValue;
105  cutForElectron = defaultCutValue;
106  cutForProton    = 0.001*mm;
107  SetVerboseLevel(1);
108  physicsListMessenger = new XrayFluoPhysicsListMessenger(this);
109}
110
111//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
112
113XrayFluoPhysicsList::XrayFluoPhysicsList(XrayFluoMercuryDetectorConstruction* p)
114: G4VUserPhysicsList(),pDet(0),planeDet(0),mercuryDet(0)
115{
116  mercuryDet = p;
117
118  //  SetGELowLimit(250*eV);
119
120  defaultCutValue = 0.000001*mm;
121
122  cutForGamma = defaultCutValue;
123  cutForElectron = defaultCutValue;
124  cutForProton    = 0.001*mm;
125  SetVerboseLevel(1);
126  physicsListMessenger = new XrayFluoPhysicsListMessenger(this);
127}
128
129//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
130
131
132XrayFluoPhysicsList::~XrayFluoPhysicsList()
133{
134  delete physicsListMessenger;
135}
136
137//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
138
139void XrayFluoPhysicsList::ConstructParticle()
140{
141  // In this method, static member functions should be called
142  // for all particles which you want to use.
143  // This ensures that objects of these particle types will be
144  // created in the program.
145
146  ConstructBosons();
147  ConstructLeptons();
148  ConstructBarions();
149  ConstructIons();
150}
151
152//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
153
154void XrayFluoPhysicsList::ConstructBosons()
155{
156 
157  // gamma
158  G4Gamma::GammaDefinition();
159 
160}
161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
162
163void XrayFluoPhysicsList::ConstructLeptons()
164{
165  // leptons
166  G4Electron::ElectronDefinition();
167  G4Positron::PositronDefinition();
168}
169//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
170
171void XrayFluoPhysicsList::ConstructBarions()
172{
173  G4BaryonConstructor baryon;
174  baryon.ConstructParticle();
175  //  G4Proton::ProtonDefinition();
176}
177void XrayFluoPhysicsList::ConstructIons()
178{
179//  Ions
180  G4Alpha::AlphaDefinition();
181}
182
183void XrayFluoPhysicsList::ConstructProcess()
184{
185  AddTransportation();
186  ConstructEM();
187}
188
189//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
190
191#include "G4LowEnergyCompton.hh"
192#include "G4LowEnergyGammaConversion.hh"
193#include "G4LowEnergyPhotoElectric.hh"
194#include "G4LowEnergyRayleigh.hh"
195
196// e+
197#include "G4MultipleScattering.hh"
198#include "G4eIonisation.hh"
199#include "G4eBremsstrahlung.hh"
200#include "G4eplusAnnihilation.hh"
201
202#include "G4LowEnergyIonisation.hh"
203#include "G4LowEnergyBremsstrahlung.hh"
204#include "G4hLowEnergyIonisation.hh"
205
206//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
207
208void XrayFluoPhysicsList::ConstructEM()
209{
210  theParticleIterator->reset();
211  while( (*theParticleIterator)() ){
212    G4ParticleDefinition* particle = theParticleIterator->value();
213    G4ProcessManager* pmanager = particle->GetProcessManager();
214    G4String particleName = particle->GetParticleName();
215     
216    if (particleName == "gamma") {
217
218      // gamma         
219      pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
220     
221      LePeprocess = new G4LowEnergyPhotoElectric();
222
223      LePeprocess->ActivateAuger(true);
224      LePeprocess->SetCutForLowEnSecPhotons(0.250 * keV);
225      LePeprocess->SetCutForLowEnSecElectrons(0.250 * keV);
226
227      pmanager->AddDiscreteProcess(LePeprocess);
228
229      pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh("Rayleigh"));
230     
231    } else if (particleName == "e-") {
232      //electron
233      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
234     
235      LeIoprocess = new G4LowEnergyIonisation("IONI");
236      LeIoprocess->ActivateAuger(true);
237      //eIoProcess = new G4eIonisation("stdIONI");
238      LeIoprocess->SetCutForLowEnSecPhotons(0.1*keV);
239      LeIoprocess->SetCutForLowEnSecElectrons(0.1*keV);
240      pmanager->AddProcess(LeIoprocess, -1,  2, 2); 
241
242      LeBrprocess = new G4LowEnergyBremsstrahlung();
243      pmanager->AddProcess(LeBrprocess, -1, -1, 3);
244     
245      } else if (particleName == "e+") {
246      //positron
247      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
248      pmanager->AddProcess(new G4eIonisation,      -1, 2,2);
249      pmanager->AddProcess(new G4eBremsstrahlung,   -1,-1,3);
250      pmanager->AddProcess(new G4eplusAnnihilation,  0,-1,4);
251     
252    } 
253    else if (particleName == "proton") {
254      //proton
255      G4hLowEnergyIonisation* hIoni = new G4hLowEnergyIonisation;
256      hIoni->SetFluorescence(true);
257      pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
258      pmanager->AddProcess(hIoni,-1, 2,2);
259    }
260    else if (   particleName == "alpha" )
261      {
262       
263        pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
264        G4hLowEnergyIonisation* iIon = new G4hLowEnergyIonisation() ;
265        pmanager->AddProcess(iIon,-1,2,2);
266      }
267   
268  }
269
270}
271
272//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
273
274void XrayFluoPhysicsList::SetGELowLimit(G4double lowcut)
275{
276  if (verboseLevel >0){
277    G4cout << "XrayFluoPhysicsList::SetCuts:";
278    G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
279  } 
280
281  G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowcut,1e5);
282
283
284}
285
286void XrayFluoPhysicsList::SetGammaLowLimit(G4double lowcut)
287{
288  if (verboseLevel >0){
289    G4cout << "XrayFluoPhysicsList::SetCuts:";
290    G4cout << "Gamma cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
291  } 
292
293  SetGELowLimit(lowcut);
294
295//   G4Gamma::SetEnergyRange(lowcut,1e5);
296
297}
298
299void XrayFluoPhysicsList::SetElectronLowLimit(G4double lowcut)
300{
301  if (verboseLevel >0){
302
303    G4cout << "XrayFluoPhysicsList::SetCuts:";
304    G4cout << "Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
305
306  } 
307
308  SetGELowLimit(lowcut);
309
310//   G4Electron::SetEnergyRange(lowcut,1e5);
311
312}
313
314
315
316void XrayFluoPhysicsList::SetGammaCut(G4double val)
317{
318  ResetCuts();
319  cutForGamma = val;
320}
321
322//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
323
324
325
326void XrayFluoPhysicsList::SetElectronCut(G4double val)
327{
328  ResetCuts();
329  cutForElectron = val;
330}
331
332void XrayFluoPhysicsList::SetCuts(){
333
334   SetCutValue(cutForGamma,"gamma");
335   SetCutValue(cutForElectron,"e-");
336   SetCutValue(cutForElectron,"e+");
337   SetCutValue(cutForProton, "proton");
338   //SetCutValueForOthers(cutForProton);
339   if (verboseLevel>0) DumpCutValuesTable();
340}
341
342//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
343
344void XrayFluoPhysicsList::SetLowEnSecPhotCut(G4double cut){
345 
346  G4cout<<"Low energy secondary photons cut is now set to: "<<cut/MeV<<" (MeV)"<<G4endl;
347  G4cout<<"for processes LowEnergyBremsstrahlung, LowEnergyPhotoElectric, LowEnergyIonisation"<<G4endl;
348  LeBrprocess->SetCutForLowEnSecPhotons(cut);
349  LePeprocess->SetCutForLowEnSecPhotons(cut);
350  LeIoprocess->SetCutForLowEnSecPhotons(cut);
351}
352
353void XrayFluoPhysicsList::SetLowEnSecElecCut(G4double cut){
354 
355  G4cout<<"Low energy secondary electrons cut is now set to: "<<cut/MeV<<" (MeV)"<<G4endl;
356 
357  G4cout<<"for processes LowEnergyIonisation"<<G4endl;
358 
359  LeIoprocess->SetCutForLowEnSecElectrons(cut);
360}
361//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
362
363void XrayFluoPhysicsList::SetProtonCut(G4double val)
364{
365  ResetCuts();
366  cutForProton = val;
367}
368//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
369
370
371void XrayFluoPhysicsList::SetCutsByEnergy(G4double val)
372{
373  G4ParticleTable* theXrayFluoParticleTable =  G4ParticleTable::GetParticleTable();
374
375  G4Material* currMat = 0;
376   
377  if(pDet){
378    currMat = pDet->XrayFluoDetectorConstruction::GetSampleMaterial();
379  }
380  else if(planeDet){
381    currMat = planeDet->XrayFluoPlaneDetectorConstruction::GetPlaneMaterial(); 
382  }
383 
384  else if(mercuryDet){
385    currMat = mercuryDet->GetMercuryMaterial();
386  }
387
388  G4ParticleDefinition* part;
389  G4double cut;
390 
391  part = theXrayFluoParticleTable->FindParticle("e-");
392  cut = G4EnergyLossTables::GetRange(part,val,currMat);
393  SetCutValue(cut, "e-");
394 
395  part = theXrayFluoParticleTable->FindParticle("proton");
396  cut = G4EnergyLossTables::GetRange(part,val,currMat);
397  SetCutValue(cut, "proton");
398 
399//   part = theXrayFluoParticleTable->FindParticle("gamma");
400//   cut = G4EnergyLossTables::GetRange(part,val,currMat);
401//   SetCutValue(cut, "gamma");
402
403}
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
Note: See TracBrowser for help on using the repository browser.