#include <G4ElementSelector.hh>
Public Member Functions | |
G4ElementSelector () | |
virtual | ~G4ElementSelector () |
virtual G4Element * | SelectZandA (const G4Track &track, G4Nucleus *) |
Definition at line 61 of file G4ElementSelector.hh.
G4ElementSelector::G4ElementSelector | ( | ) |
G4ElementSelector::~G4ElementSelector | ( | ) | [virtual] |
Definition at line 60 of file G4ElementSelector.cc.
References G4lrint(), G4UniformRand, G4Material::GetAtomicNumDensityVector(), G4Material::GetElementVector(), G4Element::GetIsotope(), G4Element::GetIsotopeVector(), G4Track::GetMaterial(), G4Isotope::GetN(), G4Material::GetNumberOfElements(), G4Element::GetRelativeAbundanceVector(), G4Element::GetZ(), and G4Nucleus::SetParameters().
Referenced by G4HadronStoppingProcess::AtRestDoIt().
00061 { 00062 // Fermi-Teller Z-low of mu- capture and exceptions 00063 // for halogens and oxigen. 00064 // N.C.Mukhopadhyay Phys. Rep. 30 (1977) 1. 00065 00066 size_t i = 0; 00067 const G4Material* mat = track.GetMaterial(); 00068 size_t numberOfElements = mat->GetNumberOfElements(); 00069 const G4ElementVector* theElementVector = mat->GetElementVector(); 00070 00071 if(1 < numberOfElements) { 00072 if(numberOfElements > prob.size()) { prob.resize(numberOfElements, 0.0); } 00073 00074 const G4double* theAtomNumDensity = mat->GetAtomicNumDensityVector(); 00075 00076 G4double sum = 0.0; 00077 for (i=0; i < numberOfElements; ++i) { 00078 00079 G4int Z = G4lrint((*theElementVector)[i]->GetZ()); 00080 00081 // Halogens 00082 if( (9 == Z) || (17 == Z) || (35 == Z) || (53 == Z) || (85 == Z) ) { 00083 sum += 0.66 * Z * theAtomNumDensity[i]; 00084 00085 // Oxigen 00086 } else if( 8 == Z ) { 00087 sum += 0.56 * Z * theAtomNumDensity[i]; 00088 00089 // Others 00090 } else { 00091 sum += Z * theAtomNumDensity[i]; 00092 } 00093 prob[i] = sum; 00094 } 00095 00096 sum *= G4UniformRand(); 00097 for (i=0; i < numberOfElements; ++i) { 00098 if(sum <= prob[i]) { break; } 00099 } 00100 } 00101 00102 G4Element* elm = (*theElementVector)[i]; 00103 G4int Z = G4lrint(elm->GetZ()); 00104 00105 // select isotope 00106 const G4IsotopeVector* isv = elm->GetIsotopeVector(); 00107 size_t ni = isv->size(); 00108 i = 0; 00109 00110 if(1 < ni) { 00111 00112 const G4double* ab = elm->GetRelativeAbundanceVector(); 00113 G4double y = G4UniformRand(); 00114 for(i=0; i<ni; ++i) { 00115 y -= ab[i]; 00116 if(y <= 0.0) { break; } 00117 } 00118 } 00119 00120 G4int A = elm->GetIsotope(i)->GetN(); 00121 target->SetParameters(A, Z); 00122 00123 return elm; 00124 }