Geant4  10.00.p03
G4StopElementSelector.cc
Go to the documentation of this file.
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 // $Id: G4StopElementSelector.cc 69573 2013-05-08 13:35:53Z gcosmo $
27 //
28 // File: G4StopElementSelector
29 //
30 // Author: V.Ivanchenko (Vladimir.Ivanchenko@cern.ch)
31 //
32 // Creation date: 2 April 2000
33 //
34 // Modifications:
35 // 18/08/2000 V.Ivanchenko Update description
36 // 17/05/2006 V.Ivanchenko Cleanup
37 // 02/10/2007 V.Ivanchenko Fixed typo in computation of Lambda-factor
38 // proposed by Victor Pec
39 // 04/23/2013 K.Genser used new G4MuonMinusBoundDecay
40 // in GetMuonCaptureRate and GetMuonDecayRate
41 //---------------------------------------------------------------------
42 
43 #include "G4StopElementSelector.hh"
44 #include "G4PhysicalConstants.hh"
45 #include "G4SystemOfUnits.hh"
46 #include "Randomize.hh"
47 #include "G4Material.hh"
48 #include "G4MuonMinusBoundDecay.hh"
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51 
52 // constructor
54 { }
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
57 
58 // destructor
60 { }
61 
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64 
66 {
67  // Fermi-Teller Z-low of mu- capture and exceptions
68  // for halogens and oxigen.
69  // N.C.Mukhopadhyay Phys. Rep. 30 (1977) 1.
70  G4int i;
71  G4double Z;
72  const G4int numberOfElements = aMaterial->GetNumberOfElements();
73  const G4ElementVector* theElementVector = aMaterial->GetElementVector();
74 
75  if(1 == numberOfElements) return (*theElementVector)[0];
76 
77  const G4double* theAtomicNumberDensity = aMaterial->GetAtomicNumDensityVector();
78 
79  G4double sum = 0.0;
80  for ( i=0; i < numberOfElements; i++ ) {
81 
82  Z = (*theElementVector)[i]->GetZ();
83 
84  // Halogens
85  if( (9.0 == Z) || (17.0 == Z) || (35.0 == Z) || (53.0 == Z) || (85.0 == Z) ) {
86  sum += 0.66 * Z * theAtomicNumberDensity[i] ;
87 
88  // Oxigen
89  } else if( 8.0 == Z ) {
90  sum += 0.56 * Z * theAtomicNumberDensity[i] ;
91 
92  // Others
93  } else {
94  sum += Z * theAtomicNumberDensity[i] ;
95  }
96  }
97 
98  G4double random = G4UniformRand() * sum;
99  sum = 0.0 ;
100  i = -1;
101 
102  // Selection of element
103  do {
104  i++;
105  Z = (*theElementVector)[i]->GetZ();
106 
107  // Galogens
108  if( (9.0 == Z) || (17.0 == Z) || (35.0 == Z) || (53.0 == Z) || (85.0 == Z) ) {
109  sum += 0.66 * Z * theAtomicNumberDensity[i] ;
110 
111  // Oxigen
112  } else if( 8.0 == Z ) {
113  sum += 0.56 * Z * theAtomicNumberDensity[i] ;
114 
115  // Others
116  } else {
117  sum += Z * theAtomicNumberDensity[i] ;
118  }
119  } while ( (sum < random) && (i < numberOfElements - 1) );
120 
121  return (*theElementVector)[i];
122 }
123 
124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
125 
127 {
129 }
130 
131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
132 
134 {
136 }
std::vector< G4Element * > G4ElementVector
G4double GetMuonCaptureRate(G4double Z, G4double A)
G4double GetMuonDecayRate(G4double Z, G4double A)
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:188
int G4int
Definition: G4Types.hh:78
#define G4UniformRand()
Definition: Randomize.hh:87
static const G4double A[nN]
const G4double * GetAtomicNumDensityVector() const
Definition: G4Material.hh:214
G4Element * GetElement(const G4Material *aMaterial)
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
double G4double
Definition: G4Types.hh:76
static G4double GetMuonDecayRate(G4int Z)
static G4double GetMuonCaptureRate(G4int Z, G4int A)