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3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 // History
 28 // 14/01/11 Alf re-adapt this file from Physiclist of testEm18
 29 //
 30 //
 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 33 
 34 #include "XrayFluoPhysicsList.hh"
 35 #include "XrayFluoPhysicsListMessenger.hh"
 36 
 37 #include "G4SystemOfUnits.hh"
 38 #include "G4LossTableManager.hh"
 39 #include "G4EmParameters.hh"
 40 #include "G4ProcessManager.hh"
 41 
 42 //#include "PhysListEmStandard.hh"
 43 
 44 #include "G4EmStandardPhysics.hh"
 45 #include "G4EmStandardPhysics_option1.hh"
 46 #include "G4EmStandardPhysics_option2.hh"
 47 #include "G4EmStandardPhysics_option3.hh"
 48 //#include "XrayFluoPhysListEmStandardFLUO.hh"
 49 #include "G4EmLivermorePhysics.hh"
 50 #include "G4EmPenelopePhysics.hh"
 51 //#include "G4UAtomicDeexcitation.hh"
 52 
 53 #include "G4Decay.hh"
 54 #include "XrayFluoStepMax.hh"
 55 
 56 #include "G4UnitsTable.hh"
 57 
 58 #include "G4ParticleDefinition.hh"
 59 #include "G4ProcessManager.hh"
 60 
 61 // Bosons
 62 #include "G4ChargedGeantino.hh"
 63 #include "G4Geantino.hh"
 64 #include "G4Gamma.hh"
 65 #include "G4OpticalPhoton.hh"
 66 
 67 // leptons
 68 #include "G4MuonPlus.hh"
 69 #include "G4MuonMinus.hh"
 70 #include "G4NeutrinoMu.hh"
 71 #include "G4AntiNeutrinoMu.hh"
 72 
 73 #include "G4Electron.hh"
 74 #include "G4Positron.hh"
 75 #include "G4NeutrinoE.hh"
 76 #include "G4AntiNeutrinoE.hh"
 77 
 78 // Hadrons
 79 #include "G4Proton.hh"
 80 #include "G4MesonConstructor.hh"
 81 #include "G4BaryonConstructor.hh"
 82 #include "G4IonConstructor.hh"
 83 
 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 85 
 86 XrayFluoPhysicsList::XrayFluoPhysicsList() : G4VModularPhysicsList()
 87 {
 88   pMessenger = new XrayFluoPhysicsListMessenger(this); 
 89    
 90   // EM physics
 91   G4LossTableManager::Instance()->SetVerbose(1);
 92       
 93   defaultCutValue = 1.*mm;
 94 
 95   cutForGamma     = defaultCutValue;
 96   cutForElectron  = defaultCutValue;
 97   cutForPositron  = defaultCutValue;
 98   cutForProton    = defaultCutValue;
 99  
100   // set cut values for gamma at first and for e- second and next for e+,
101   // because some processes for e+/e- need cut values for gamma
102   SetCutValue(cutForGamma, "gamma");
103   SetCutValue(cutForElectron, "e-");
104   SetCutValue(cutForPositron, "e+");
105 
106   DumpCutValuesTable();
107   SetVerboseLevel(1);
108 
109   // EM physics
110   emName = G4String("emlivermore");
111   emPhysicsList = new G4EmLivermorePhysics;
112 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115 
116 XrayFluoPhysicsList::~XrayFluoPhysicsList()
117 {
118   delete emPhysicsList;
119   delete pMessenger;  
120 }
121 
122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
123 
124 void XrayFluoPhysicsList::ConstructParticle()
125 {
126   // pseudo-particles
127   G4Geantino::GeantinoDefinition();
128   G4ChargedGeantino::ChargedGeantinoDefinition();
129   
130   // gamma
131   G4Gamma::GammaDefinition();
132   
133   // leptons
134   G4Electron::ElectronDefinition();
135   G4Positron::PositronDefinition();
136   G4MuonPlus::MuonPlusDefinition();
137   G4MuonMinus::MuonMinusDefinition();
138 
139   G4NeutrinoE::NeutrinoEDefinition();
140   G4AntiNeutrinoE::AntiNeutrinoEDefinition();
141   G4NeutrinoMu::NeutrinoMuDefinition();
142   G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();  
143 
144   // mesons
145   G4MesonConstructor mConstructor;
146   mConstructor.ConstructParticle();
147 
148   // barions
149   G4BaryonConstructor bConstructor;
150   bConstructor.ConstructParticle();
151 
152   // ions
153   G4IonConstructor iConstructor;
154   iConstructor.ConstructParticle();
155 }
156 
157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
158 
159 void XrayFluoPhysicsList::ConstructProcess()
160 {
161   AddTransportation();
162   emPhysicsList->ConstructProcess();
163   AddDecay();  
164   AddStepMax();
165 
166   // Em options
167   //
168   G4EmParameters* param = G4EmParameters::Instance();
169   param->SetFluo(true);
170   param->SetAuger(true);
171   param->SetPixe(true);
172 }
173 
174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
175 
176 void XrayFluoPhysicsList::AddDecay()
177 {
178   // Add Decay Process
179 
180   G4Decay* fDecayProcess = new G4Decay();
181 
182   auto particleIterator=GetParticleIterator();
183   particleIterator->reset();
184   while( (*particleIterator)() ){
185     G4ParticleDefinition* particle = particleIterator->value();
186     G4ProcessManager* pmanager = particle->GetProcessManager();
187 
188     if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 
189 
190       pmanager ->AddProcess(fDecayProcess);
191 
192       // set ordering for PostStepDoIt and AtRestDoIt
193       pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
194       pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
195 
196     }
197   }
198 }
199 
200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
201 
202 void XrayFluoPhysicsList::AddStepMax()
203 {
204   // Step limitation seen as a process
205   XrayFluoStepMax* stepMaxProcess = new XrayFluoStepMax();
206 
207   auto particleIterator=GetParticleIterator();
208   particleIterator->reset();
209   while ((*particleIterator)()){
210       G4ParticleDefinition* particle = particleIterator->value();
211       G4ProcessManager* pmanager = particle->GetProcessManager();
212 
213       if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
214         {
215     pmanager ->AddDiscreteProcess(stepMaxProcess);
216         }
217   }
218 }
219 
220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
221 
222 void XrayFluoPhysicsList::AddPhysicsList(const G4String& name)
223 {
224   if (verboseLevel>-1) {
225     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
226   }
227 
228   if (name == emName) return;
229 
230   if (name == "emlivermore") {
231 
232     emName = name;
233     delete emPhysicsList;
234     emPhysicsList = new G4EmLivermorePhysics;
235 
236   } else if (name == "emstandard") {
237     emName = name;
238     delete emPhysicsList;
239     emPhysicsList = new G4EmStandardPhysics(); 
240 
241   } else if (name == "emstandard_opt1") {
242 
243     emName = name;
244     delete emPhysicsList;
245     emPhysicsList = new G4EmStandardPhysics_option1();
246 
247   } else if (name == "emstandard_opt2") {
248 
249     emName = name;
250     delete emPhysicsList;
251     emPhysicsList = new G4EmStandardPhysics_option2();
252 
253   } else if (name == "emstandard_opt3") {
254 
255     emName = name;
256     delete emPhysicsList;
257     emPhysicsList = new G4EmStandardPhysics_option3();
258     
259   } else if (name == "empenelope"){
260     emName = name;
261     delete emPhysicsList;
262     emPhysicsList = new G4EmPenelopePhysics();
263 
264   } else {
265 
266     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
267            << " is not defined"
268            << G4endl;
269   }
270 }
271 
272 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
273 
274 void XrayFluoPhysicsList::SetCutForGamma(G4double cut)
275 {
276   cutForGamma = cut;
277   SetParticleCuts(cutForGamma, G4Gamma::Gamma());
278 }
279 
280 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
281 
282 void XrayFluoPhysicsList::SetCutForElectron(G4double cut)
283 {
284   cutForElectron = cut;
285   SetParticleCuts(cutForElectron, G4Electron::Electron());
286 }
287 
288 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
289 
290 void XrayFluoPhysicsList::SetCutForPositron(G4double cut)
291 {
292   cutForPositron = cut;
293   SetParticleCuts(cutForPositron, G4Positron::Positron());
294 }
295 
296 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
297 
298 void XrayFluoPhysicsList::SetCutForProton(G4double cut)
299 {
300   cutForProton = cut;
301   SetParticleCuts(cutForProton, G4Proton::Proton());
302 }
303 
304 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
305 
306 //void XrayFluoPhysicsList::SetFluorescence(G4bool value)
307 //{
308 //  G4VAtomDeexcitation* de = G4LossTableManager::Instance()->AtomDeexcitation();
309 //  if(de) { de->SetFluo(value); }
310 //}
311 
312 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
313 
314 //void XrayFluoPhysicsList::SetPIXE(G4bool value)
315 //{
316 //  G4VAtomDeexcitation* de = G4LossTableManager::Instance()->AtomDeexcitation();
317 //  if(de) { de->SetPIXE(value); }
318 //}
319 
320 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
321