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);
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 {
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);
199 if(A == (-1)*S)
return A*
mL;
201 if( A==2 && Z == 0) {
207 else if( A==2 && Z == 1) {
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;
232 for(
G4int A=1; A<=AMax; ++
A)
233 delete[] theTable[A];
241 #endif // INCLXX_IN_GEANT4_MODE