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] [ 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 ]

Diff markup

Differences between /processes/electromagnetic/standard/src/G4PEEffectFluoModel.cc (Version 11.3.0) and /processes/electromagnetic/standard/src/G4PEEffectFluoModel.cc (Version 5.2.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 //                                                
 27 // -------------------------------------------    
 28 //                                                
 29 // GEANT4 Class file                              
 30 //                                                
 31 //                                                
 32 // File name:     G4PEEffectFluoModel             
 33 //                                                
 34 // Author:        Vladimir Ivanchenko on base     
 35 //                                                
 36 // Creation date: 13.06.2010                      
 37 //                                                
 38 // Modifications:                                 
 39 //                                                
 40 // Class Description:                             
 41 // Implementation of the photo-electric effect    
 42 //                                                
 43 // -------------------------------------------    
 44 //                                                
 45 //....oooOO0OOooo........oooOO0OOooo........oo    
 46 //....oooOO0OOooo........oooOO0OOooo........oo    
 47                                                   
 48 #include "G4PEEffectFluoModel.hh"                 
 49 #include "G4PhysicalConstants.hh"                 
 50 #include "G4SystemOfUnits.hh"                     
 51 #include "G4Electron.hh"                          
 52 #include "G4Gamma.hh"                             
 53 #include "Randomize.hh"                           
 54 #include "G4Material.hh"                          
 55 #include "G4DataVector.hh"                        
 56 #include "G4ParticleChangeForGamma.hh"            
 57 #include "G4VAtomDeexcitation.hh"                 
 58 #include "G4LossTableManager.hh"                  
 59 #include "G4SauterGavrilaAngularDistribution.h    
 60                                                   
 61 //....oooOO0OOooo........oooOO0OOooo........oo    
 62                                                   
 63 using namespace std;                              
 64                                                   
 65 G4PEEffectFluoModel::G4PEEffectFluoModel(const    
 66   : G4VEmModel(nam)                               
 67 {                                                 
 68   theGamma    = G4Gamma::Gamma();                 
 69   theElectron = G4Electron::Electron();           
 70   fminimalEnergy = 1.0*CLHEP::eV;                 
 71   SetDeexcitationFlag(true);                      
 72                                                   
 73   fSandiaCof.resize(4,0.0);                       
 74                                                   
 75   // default generator                            
 76   SetAngularDistribution(new G4SauterGavrilaAn    
 77 }                                                 
 78                                                   
 79 //....oooOO0OOooo........oooOO0OOooo........oo    
 80                                                   
 81 G4PEEffectFluoModel::~G4PEEffectFluoModel() =     
 82                                                   
 83 //....oooOO0OOooo........oooOO0OOooo........oo    
 84                                                   
 85 void G4PEEffectFluoModel::Initialise(const G4P    
 86              const G4DataVector&)                 
 87 {                                                 
 88   fAtomDeexcitation = G4LossTableManager::Inst    
 89   fPEBelowKShell = G4EmParameters::Instance()-    
 90   if(nullptr == fParticleChange) {                
 91     fParticleChange = GetParticleChangeForGamm    
 92   }                                               
 93   std::size_t nmat = G4Material::GetNumberOfMa    
 94   fMatEnergyTh.resize(nmat, 0.0);                 
 95   for(std::size_t i=0; i<nmat; ++i) {             
 96     fMatEnergyTh[i] = (*(G4Material::GetMateri    
 97       ->GetSandiaTable()->GetSandiaCofForMater    
 98     //G4cout << "G4PEEffectFluoModel::Initiali    
 99     //     << fMatEnergyTh[i]/eV << G4endl;       
100   }                                               
101 }                                                 
102                                                   
103 //....oooOO0OOooo........oooOO0OOooo........oo    
104                                                   
105 G4double                                          
106 G4PEEffectFluoModel::ComputeCrossSectionPerAto    
107             G4double energy,                      
108             G4double Z, G4double,                 
109             G4double, G4double)                   
110 {                                                 
111   // This method may be used only if G4Materia    
112   //   has been set properly                      
113   CurrentCouple()->GetMaterial()                  
114     ->GetSandiaTable()->GetSandiaCofPerAtom((G    
115                                                   
116   G4double x1 = 1 / energy;                       
117                                                   
118   return x1 * (fSandiaCof[0] + x1 * (fSandiaCo    
119     x1 * (fSandiaCof[2] + x1 * fSandiaCof[3]))    
120 }                                                 
121                                                   
122 //....oooOO0OOooo........oooOO0OOooo........oo    
123                                                   
124 G4double                                          
125 G4PEEffectFluoModel::CrossSectionPerVolume(con    
126              const G4ParticleDefinition*,         
127              G4double energy,                     
128              G4double, G4double)                  
129 {                                                 
130   // This method may be used only if G4Materia    
131   //   has been set properly                      
132   energy = std::max(energy, fMatEnergyTh[mater    
133   const G4double* SandiaCof =                     
134     material->GetSandiaTable()->GetSandiaCofFo    
135                                                   
136   G4double x1 = 1 / energy;                       
137                                                   
138   return x1 * (SandiaCof[0] + x1 * (SandiaCof[    
139     x1 * (SandiaCof[2] + x1 * SandiaCof[3])));    
140 }                                                 
141                                                   
142 //....oooOO0OOooo........oooOO0OOooo........oo    
143                                                   
144 void                                              
145 G4PEEffectFluoModel::SampleSecondaries(std::ve    
146                const G4MaterialCutsCouple* cou    
147                const G4DynamicParticle* aDynam    
148                G4double,                          
149                G4double)                          
150 {                                                 
151   SetCurrentCouple(couple);                       
152   const G4Material* aMaterial = couple->GetMat    
153                                                   
154   G4double energy = aDynamicPhoton->GetKinetic    
155                                                   
156   // select randomly one element constituing t    
157   const G4Element* anElement = SelectRandomAto    
158                                                   
159   //                                              
160   // Photo electron                               
161   //                                              
162                                                   
163   // Select atomic shell                          
164   G4int nShells = anElement->GetNbOfAtomicShel    
165   G4int i = 0;                                    
166   for(; i<nShells; ++i) {                         
167     /*                                            
168     G4cout << "i= " << i << " E(eV)= " << ener    
169          << " Eb(eV)= " << anElement->GetAtomi    
170            << "  " << anElement->GetName()        
171      << G4endl;                                   
172     */                                            
173     if(energy >= anElement->GetAtomicShell(i))    
174   }                                               
175                                                   
176   G4double edep = energy;                         
177                                                   
178   // photo-electron is not sampled if shell is    
179   // the flag of photoeffect is "false" and sh    
180   if ( (fPEBelowKShell || 0 == i) && i < nShel    
181                                                   
182     G4double bindingEnergy = anElement->GetAto    
183     edep = bindingEnergy;                         
184     G4double esec = 0.0;                          
185                                                   
186     // sample deexcitation cascade                
187     //                                            
188     if(nullptr != fAtomDeexcitation) {            
189       G4int index = couple->GetIndex();           
190       if(fAtomDeexcitation->CheckDeexcitationA    
191   G4int Z = G4lrint(anElement->GetZ());           
192   auto as = (G4AtomicShellEnumerator)(i);         
193   const G4AtomicShell* shell = fAtomDeexcitati    
194         G4double eshell = shell->BindingEnergy    
195         if(eshell > bindingEnergy && eshell <=    
196           bindingEnergy = eshell;                 
197           edep = eshell;                          
198   }                                               
199   std::size_t nbefore = fvect->size();            
200   fAtomDeexcitation->GenerateParticles(fvect,     
201   std::size_t nafter = fvect->size();             
202   for (std::size_t j=nbefore; j<nafter; ++j) {    
203     G4double e = ((*fvect)[j])->GetKineticEner    
204     if(esec + e > edep) {                         
205       // correct energy in order to have energ    
206       e = edep - esec;                            
207       ((*fvect)[j])->SetKineticEnergy(e);         
208       esec += e;                                  
209       /*                                          
210         G4cout << "### G4PEffectFluoModel Edep    
211          << " Esec(eV)= " << esec/eV              
212          << " E["<< j << "](eV)= " << e/eV        
213          << " N= " << nafter                      
214          << " Z= " << Z << " shell= " << i        
215          << "  Ebind(keV)= " << bindingEnergy/    
216          << "  Eshell(keV)= " << shell->Bindin    
217          << G4endl;                               
218       */                                          
219       // delete the rest of secondaries (shoul    
220       for (std::size_t jj=nafter-1; jj>j; --jj    
221         delete (*fvect)[jj];                      
222         fvect->pop_back();                        
223       }                                           
224       break;                                      
225     }                                             
226     esec += e;                                    
227   }                                               
228         edep -= esec;                             
229       }                                           
230     }                                             
231     // create photo electron                      
232     //                                            
233     G4double elecKineEnergy = energy - binding    
234     if (elecKineEnergy > fminimalEnergy) {        
235       auto aParticle = new G4DynamicParticle(t    
236   GetAngularDistribution()->SampleDirection(aD    
237               elecKineEnergy,                     
238               i, couple->GetMaterial()),          
239                  elecKineEnergy);                 
240       fvect->push_back(aParticle);                
241     } else {                                      
242       edep += elecKineEnergy;                     
243       elecKineEnergy = 0.0;                       
244     }                                             
245     if(std::abs(energy - elecKineEnergy - esec    
246       G4cout << "### G4PEffectFluoModel dE(eV)    
247        << (energy - elecKineEnergy - esec - ed    
248        << " shell= " << i                         
249        << "  E(keV)= " << energy/keV              
250        << "  Ebind(keV)= " << bindingEnergy/ke    
251        << "  Ee(keV)= " << elecKineEnergy/keV     
252        << "  Esec(keV)= " << esec/keV             
253        << "  Edep(keV)= " << edep/keV             
254        << G4endl;                                 
255     }                                             
256   }                                               
257                                                   
258   // kill primary photon                          
259   fParticleChange->SetProposedKineticEnergy(0.    
260   fParticleChange->ProposeTrackStatus(fStopAnd    
261   if(edep > 0.0) {                                
262     fParticleChange->ProposeLocalEnergyDeposit    
263   }                                               
264 }                                                 
265                                                   
266 //....oooOO0OOooo........oooOO0OOooo........oo    
267