34#define INCLXX_IN_GEANT4_MODE 1
45#ifndef INCLXX_IN_GEANT4_MODE
67 const G4int Npairing = (
A-Z)%2;
68 const G4int Zpairing = Z%2;
74 + 93.15*((fA/2.-fZ)*(fA/2.-fZ))/fA
76 if( Npairing == Zpairing )
binding += (Npairing+Zpairing-1) * 12.0 / std::sqrt(fA);
83 theTable[
A][Z] = mass;
100 friend std::istream &
operator>>(std::istream &in, MassRecord &record);
107 std::istream &
operator>>(std::istream &in, MassRecord &record) {
108 return (in >> record.A >> record.Z >> record.excess);
111 G4bool compareA(
const MassRecord &lhs,
const MassRecord &rhs) {
112 return (lhs.A < rhs.A);
117 namespace NuclearMassTable {
119 void initialize(
const std::string &path,
const G4double pMass,
const G4double nMass) {
127 std::string fileName(path +
"/walletlifetime.dat");
128 INCL_DEBUG(
"Reading real nuclear masses from file " << fileName <<
'\n');
131 std::ifstream massTableIn(fileName.c_str());
132 if(!massTableIn.good()) {
133 std::cerr <<
"Cannot open " << fileName <<
" data file." <<
'\n';
139 std::vector<MassRecord> records;
141 while(massTableIn.good()) {
142 massTableIn >> record;
143 records.push_back(record);
146 INCL_DEBUG(
"Read " << records.size() <<
" nuclear masses" <<
'\n');
149 AMax = std::max_element(records.begin(), records.end(), compareA)->A;
150 INCL_DEBUG(
"Max A in nuclear-mass table = " << AMax <<
'\n');
151 ZMaxArray =
new G4int[AMax+1];
152 std::fill(ZMaxArray, ZMaxArray+AMax+1, 0);
154 std::fill(theTable, theTable+AMax+1,
static_cast<G4double*
>(NULL));
157 for(std::vector<MassRecord>::const_iterator i=records.begin(), e=records.end(); i!=e; ++i) {
158 ZMaxArray[i->A] = std::max(ZMaxArray[i->A], i->Z);
164 std::fill(theTable[
A], theTable[
A]+ZMaxArray[
A]+1, -1.);
168 for(std::vector<MassRecord>::const_iterator i=records.begin(), e=records.end(); i!=e; ++i) {
169 setMass(i->A, i->Z, i->A*amu + i->excess - i->Z*eMass);
174 if(
A>AMax || Z>ZMaxArray[
A]) {
175 INCL_DEBUG(
"Real mass unavailable for isotope A=" <<
A <<
", Z=" << Z
176 <<
", using Weizsaecker's formula"
178 return getWeizsaeckerMass(
A,Z);
183 INCL_DEBUG(
"Real mass unavailable for isotope A=" <<
A <<
", Z=" << Z
184 <<
", using Weizsaecker's formula"
186 return getWeizsaeckerMass(
A,Z);
192 if(
S>=0)
return getMass(
A,Z);
198 const G4double mL = ParticleTable::getRealMass(Lambda);
199 if(
A == (-1)*
S)
return A*mL;
201 if(
A==2 && Z == 0) {
202 return mL+ParticleTable::getRealMass(
Neutron);
205 return (
A+
S)*ParticleTable::getRealMass(
Neutron)-mL*
S;
207 else if(
A==2 && Z == 1) {
208 return mL+ParticleTable::getRealMass(
Proton);
222 else if(
A+
S ==3) bs=a3;
223 else if(
A+
S >3) bs=b7*std::exp(-b8/(
A+
S+1.));
224 mass += (-1)*
S*(mL-bs) + eps;
233 delete[] theTable[
A];
std::istream & operator>>(std::istream &s, G4BetaDecayType &q)
G4double S(G4double temp)
Functions that encapsulate a mass table.
G4double pow23(G4double x)
G4double powMinus13(G4double x)
G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2)