Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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.

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:190
int G4int
Definition: G4Types.hh:78
G4int GetN() const
Definition: G4Isotope.hh:94
#define G4UniformRand()
Definition: Randomize.hh:97
double A(double temperature)
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:167
const G4double * GetAtomicNumDensityVector() const
Definition: G4Material.hh:216
G4Material * GetMaterial() const
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:163
static const G4double ab
int G4lrint(double ad)
Definition: templates.hh:163
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:170
size_t GetNumberOfElements() const
Definition: G4Material.hh:186
double G4double
Definition: G4Types.hh:76
void SetParameters(const G4double A, const G4double Z)
Definition: G4Nucleus.cc:212

Here is the call graph for this function:

Here is the caller graph for this function:


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