#include <Radiation.h>
Inheritance diagram for GenDecay::BetaRadiation:
Public Member Functions | |
BetaRadiation (double energy, int parentZ) | |
virtual | ~BetaRadiation () |
RadiationType | type () const |
std::string | typeString () const |
std::string | asString () const |
int | sign () const |
double | kineticEnergy () const |
int | pid () const |
double | mass () const |
double | dnde (double kineticEnergy) const |
double | dnde_noff (double kineticEnergy) const |
double | fermi_function (double kineticEnergy) const |
Protected Attributes | |
double | m_energy |
Private Member Functions | |
void | normalize () |
Private Attributes | |
int | m_parentZ |
int | m_daughterZ |
int | m_betaSign |
double | m_endpoint |
double | m_norm |
double | m_maximum |
Rndm::Numbers | m_rand |
Definition at line 71 of file Radiation.h.
BetaRadiation::BetaRadiation | ( | double | energy, | |
int | parentZ | |||
) |
Definition at line 73 of file Radiation.cc.
00074 : Radiation(energy) 00075 , m_parentZ(parentZ) 00076 , m_daughterZ(0) 00077 , m_betaSign(0) 00078 , m_endpoint(0.0) 00079 { 00080 if (parentZ < 0) { // beta+ decay 00081 m_parentZ = -parentZ; 00082 m_daughterZ = m_parentZ - 1; 00083 m_betaSign = +1; 00084 m_endpoint = m_energy - 2.0*CLHEP::electron_mass_c2; 00085 } 00086 else { // # beta- decay 00087 m_parentZ = parentZ; 00088 m_daughterZ = m_parentZ + 1; 00089 m_betaSign = -1; 00090 m_endpoint = m_energy; 00091 } 00092 00093 ServiceHandle<IRndmGenSvc> rgsh("RndmGenSvc","BetaRadiation"); 00094 IRndmGenSvc *rgs = rgsh.operator->(); 00095 if (m_rand.initialize(rgs, Rndm::Flat(0,1)).isFailure()) { 00096 throw GaudiException("Failed to initialize uniform random numbers", 00097 "GenDecay::Radiation",StatusCode::FAILURE); 00098 } 00099 if (!m_rand) { 00100 throw GaudiException("Got null Rndm::Numbers object", 00101 "GenDecay::Radiation",StatusCode::FAILURE); 00102 } 00103 00104 this->normalize(); 00105 }
BetaRadiation::~BetaRadiation | ( | ) | [virtual] |
void BetaRadiation::normalize | ( | ) | [private] |
Definition at line 107 of file Radiation.cc.
00108 { 00109 const int steps = 1000; 00110 double dx = m_endpoint/steps; 00111 double lo = dx/2.0; 00112 00113 m_norm = 1.0; 00114 double sum = 0.0; 00115 for (int ind=0; ind<steps; ++ind) { 00116 sum += dx * this->dnde(ind*dx+lo); 00117 } 00118 m_norm = sum; 00119 00120 double max = 0; 00121 for (int ind=0; ind<steps; ++ind) { 00122 double tmp = this->dnde(ind*dx+lo); 00123 if (tmp > max) max = tmp; 00124 } 00125 m_maximum = max; 00126 }
RadiationType GenDecay::BetaRadiation::type | ( | ) | const [inline, virtual] |
Implements GenDecay::Radiation.
Definition at line 88 of file Radiation.h.
00088 { return (m_betaSign < 0 ? BetaMinus : BetaPlus); }
std::string GenDecay::BetaRadiation::typeString | ( | ) | const [inline, virtual] |
Implements GenDecay::Radiation.
Definition at line 89 of file Radiation.h.
00089 { return (m_betaSign < 0 ? "BetaMinus" : "BetaPlus"); }
std::string BetaRadiation::asString | ( | ) | const [virtual] |
Implements GenDecay::Radiation.
Definition at line 132 of file Radiation.cc.
00133 { 00134 stringstream ss; 00135 ss << "beta"<< (m_betaSign < 0 ? '-' : '+') <<": Z=" 00136 << m_parentZ << ", E_endpoint=" << m_energy << ends; 00137 return ss.str().c_str(); 00138 }
int GenDecay::BetaRadiation::sign | ( | ) | const [inline] |
double BetaRadiation::kineticEnergy | ( | ) | const [virtual] |
Reimplemented from GenDecay::Radiation.
Definition at line 140 of file Radiation.cc.
00141 { 00142 // MC/rejection method to sample dN/dE spectrum 00143 while (true) { 00144 double T = m_rand() * m_endpoint; 00145 double P = m_rand() * m_maximum; 00146 if (P <= this->dnde(T)) return T; 00147 } 00148 return 0.0; 00149 }
int BetaRadiation::pid | ( | ) | const [virtual] |
Implements GenDecay::Radiation.
Definition at line 177 of file Radiation.cc.
00178 { 00179 return -1*m_betaSign*11; 00180 }
double BetaRadiation::mass | ( | ) | const [virtual] |
Implements GenDecay::Radiation.
Definition at line 181 of file Radiation.cc.
00182 { 00183 return CLHEP::electron_mass_c2; 00184 }
double BetaRadiation::dnde | ( | double | kineticEnergy | ) | const |
Definition at line 151 of file Radiation.cc.
00152 { 00153 if (kineticEnergy > m_endpoint) return 0.0; 00154 if (kineticEnergy < 0.0) return 0.0; 00155 return this->fermi_function(kineticEnergy) * this->dnde_noff(kineticEnergy) / m_norm; 00156 }
double BetaRadiation::dnde_noff | ( | double | kineticEnergy | ) | const |
Definition at line 158 of file Radiation.cc.
00159 { 00160 double W = m_endpoint / CLHEP::electron_mass_c2 + 1.0; 00161 double E = kineticEnergy / CLHEP::electron_mass_c2 + 1.0; 00162 return sqrt(E*E-1.0) * (W-E)*(W-E) * E; 00163 }
double BetaRadiation::fermi_function | ( | double | kineticEnergy | ) | const |
Definition at line 165 of file Radiation.cc.
00166 { 00167 double E = kineticEnergy / CLHEP::electron_mass_c2 + 1.0; 00168 double P = sqrt(E*E-1.0); 00169 double U = -1*m_betaSign*m_daughterZ/137.0; 00170 double S = sqrt(1.0 - U*U) - 1.0; 00171 double Y = 2.0*M_PI*U*E/P; 00172 double A1 = U*U * E*E + P*P/4.0; 00173 double A2 = fabs(Y/(1.0-exp(-Y))); 00174 return pow(A1,S)*A2; 00175 }
int GenDecay::BetaRadiation::m_parentZ [private] |
Definition at line 73 of file Radiation.h.
int GenDecay::BetaRadiation::m_daughterZ [private] |
Definition at line 74 of file Radiation.h.
int GenDecay::BetaRadiation::m_betaSign [private] |
Definition at line 75 of file Radiation.h.
double GenDecay::BetaRadiation::m_endpoint [private] |
Definition at line 76 of file Radiation.h.
double GenDecay::BetaRadiation::m_norm [private] |
Definition at line 78 of file Radiation.h.
double GenDecay::BetaRadiation::m_maximum [private] |
Definition at line 78 of file Radiation.h.
Rndm::Numbers GenDecay::BetaRadiation::m_rand [mutable, private] |
Definition at line 79 of file Radiation.h.
double GenDecay::Radiation::m_energy [protected, inherited] |
Definition at line 32 of file Radiation.h.