33 #define INCLXX_IN_GEANT4_MODE 1
44 #ifndef INCLXX_IN_GEANT4_MODE
66 const G4int Npairing = (A-Z)%2;
67 const G4int Zpairing = Z%2;
73 + 93.15*((fA/2.-fZ)*(fA/2.-fZ))/fA
75 if( Npairing == Zpairing ) binding += (Npairing+Zpairing-1) * 12.0 / std::sqrt(fA);
82 theTable[A][Z] = mass;
99 friend std::istream &
operator>>(std::istream &in, MassRecord &record);
106 std::istream &
operator>>(std::istream &in, MassRecord &record) {
107 return (in >> record.A >> record.Z >> record.excess);
110 G4bool compareA(
const MassRecord &lhs,
const MassRecord &rhs) {
111 return (lhs.A < rhs.A);
116 namespace NuclearMassTable {
126 std::string fileName(path +
"/walletlifetime.dat");
127 INCL_DEBUG(
"Reading real nuclear masses from file " << fileName << std::endl);
130 std::ifstream massTableIn(fileName.c_str());
131 if(!massTableIn.good()) {
132 std::cerr <<
"Cannot open " << fileName <<
" data file." << std::endl;
138 std::vector<MassRecord> records;
140 while(massTableIn.good()) {
141 massTableIn >> record;
142 records.push_back(record);
145 INCL_DEBUG(
"Read " << records.size() <<
" nuclear masses" << std::endl);
148 AMax = std::max_element(records.begin(), records.end(), compareA)->A;
149 INCL_DEBUG(
"Max A in nuclear-mass table = " << AMax << std::endl);
150 ZMaxArray =
new G4int[AMax+1];
151 std::fill(ZMaxArray, ZMaxArray+AMax+1, 0);
153 std::fill(theTable, theTable+AMax+1, static_cast<G4double*>(NULL));
156 for(std::vector<MassRecord>::const_iterator i=records.begin(), e=records.end(); i!=e; ++i) {
157 ZMaxArray[i->A] =
std::max(ZMaxArray[i->A], i->Z);
161 for(
G4int A=1; A<=AMax; ++A) {
162 theTable[A] =
new G4double[ZMaxArray[A]+1];
163 std::fill(theTable[A], theTable[A]+ZMaxArray[A]+1, -1.);
167 for(std::vector<MassRecord>::const_iterator i=records.begin(), e=records.end(); i!=e; ++i) {
168 setMass(i->A, i->Z, i->A*
amu + i->excess - i->Z*eMass);
173 if(A>AMax || Z>ZMaxArray[A]) {
174 INCL_DEBUG(
"Real mass unavailable for isotope A=" << A <<
", Z=" << Z
175 <<
", using Weizsaecker's formula"
177 return getWeizsaeckerMass(A,Z);
180 const G4double mass = theTable[A][Z];
182 INCL_DEBUG(
"Real mass unavailable for isotope A=" << A <<
", Z=" << Z
183 <<
", using Weizsaecker's formula"
185 return getWeizsaeckerMass(A,Z);
193 for(
G4int A=1; A<=AMax; ++A)
194 delete[] theTable[A];
202 #endif // INCLXX_IN_GEANT4_MODE
G4double pow23(G4double x)
G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2)
Functions that encapsulate a mass table.
T max(const T t1, const T t2)
brief Return the largest of the two arguments
std::istream & operator>>(std::istream &is, HepRandom &dist)
G4double powMinus13(G4double x)
void initialize(Config const *const theConfig=0)
Initialize the particle table.