Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4ElementSelector Class Reference

#include <G4ElementSelector.hh>

Public Member Functions

 G4ElementSelector ()
 
virtual ~G4ElementSelector ()
 
virtual G4ElementSelectZandA (const G4Track &track, G4Nucleus *)
 

Detailed Description

Definition at line 61 of file G4ElementSelector.hh.

Constructor & Destructor Documentation

G4ElementSelector::G4ElementSelector ( )

Definition at line 49 of file G4ElementSelector.cc.

50 {}
G4ElementSelector::~G4ElementSelector ( )
virtual

Definition at line 54 of file G4ElementSelector.cc.

55 {}

Member Function Documentation

G4Element * G4ElementSelector::SelectZandA ( const G4Track track,
G4Nucleus target 
)
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().

61 {
62  // Fermi-Teller Z-low of mu- capture and exceptions
63  // for halogens and oxigen.
64  // N.C.Mukhopadhyay Phys. Rep. 30 (1977) 1.
65 
66  size_t i = 0;
67  const G4Material* mat = track.GetMaterial();
68  size_t numberOfElements = mat->GetNumberOfElements();
69  const G4ElementVector* theElementVector = mat->GetElementVector();
70 
71  if(1 < numberOfElements) {
72  if(numberOfElements > prob.size()) { prob.resize(numberOfElements, 0.0); }
73 
74  const G4double* theAtomNumDensity = mat->GetAtomicNumDensityVector();
75 
76  G4double sum = 0.0;
77  for (i=0; i < numberOfElements; ++i) {
78 
79  G4int Z = G4lrint((*theElementVector)[i]->GetZ());
80 
81  // Halogens
82  if( (9 == Z) || (17 == Z) || (35 == Z) || (53 == Z) || (85 == Z) ) {
83  sum += 0.66 * Z * theAtomNumDensity[i];
84 
85  // Oxigen
86  } else if( 8 == Z ) {
87  sum += 0.56 * Z * theAtomNumDensity[i];
88 
89  // Others
90  } else {
91  sum += Z * theAtomNumDensity[i];
92  }
93  prob[i] = sum;
94  }
95 
96  sum *= G4UniformRand();
97  for (i=0; i < numberOfElements; ++i) {
98  if(sum <= prob[i]) { break; }
99  }
100  }
101 
102  G4Element* elm = (*theElementVector)[i];
103  G4int Z = G4lrint(elm->GetZ());
104 
105  // select isotope
106  const G4IsotopeVector* isv = elm->GetIsotopeVector();
107  size_t ni = isv->size();
108  i = 0;
109 
110  if(1 < ni) {
111 
112  const G4double* ab = elm->GetRelativeAbundanceVector();
113  G4double y = G4UniformRand();
114  for(i=0; i<ni; ++i) {
115  y -= ab[i];
116  if(y <= 0.0) { break; }
117  }
118  }
119 
120  G4int A = elm->GetIsotope(i)->GetN();
121  target->SetParameters(A, Z);
122 
123  return elm;
124 }
std::vector< G4Isotope * > G4IsotopeVector
std::vector< G4Element * > G4ElementVector
G4double GetZ() const
Definition: G4Element.hh:131
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:188
int G4int
Definition: G4Types.hh:78
G4int GetN() const
Definition: G4Isotope.hh:94
#define G4UniformRand()
Definition: Randomize.hh:87
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
const G4double * GetAtomicNumDensityVector() const
Definition: G4Material.hh:214
G4Material * GetMaterial() const
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:162
int G4lrint(double ad)
Definition: templates.hh:163
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:169
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
double G4double
Definition: G4Types.hh:76
void SetParameters(const G4double A, const G4double Z)
Definition: G4Nucleus.cc:198

The documentation for this class was generated from the following files: