Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // INCL++ intra-nuclear cascade model 26 // INCL++ intra-nuclear cascade model 27 // Alain Boudard, CEA-Saclay, France 27 // Alain Boudard, CEA-Saclay, France 28 // Joseph Cugnon, University of Liege, Belgium 28 // Joseph Cugnon, University of Liege, Belgium 29 // Jean-Christophe David, CEA-Saclay, France 29 // Jean-Christophe David, CEA-Saclay, France 30 // Pekka Kaitaniemi, CEA-Saclay, France, and H 30 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland 31 // Sylvie Leray, CEA-Saclay, France 31 // Sylvie Leray, CEA-Saclay, France 32 // Davide Mancusi, CEA-Saclay, France 32 // Davide Mancusi, CEA-Saclay, France 33 // 33 // 34 #define INCLXX_IN_GEANT4_MODE 1 34 #define INCLXX_IN_GEANT4_MODE 1 35 35 36 #include "globals.hh" 36 #include "globals.hh" 37 37 38 /** \file G4INCLNuclearMassTable.cc 38 /** \file G4INCLNuclearMassTable.cc 39 * \brief Functions that encapsulate a mass ta 39 * \brief Functions that encapsulate a mass table 40 * 40 * 41 * \date 22nd October 2013 41 * \date 22nd October 2013 42 * \author Davide Mancusi 42 * \author Davide Mancusi 43 */ 43 */ 44 44 45 #ifndef INCLXX_IN_GEANT4_MODE 45 #ifndef INCLXX_IN_GEANT4_MODE 46 46 47 #include "G4INCLNuclearMassTable.hh" 47 #include "G4INCLNuclearMassTable.hh" 48 #include "G4INCLParticleTable.hh" 48 #include "G4INCLParticleTable.hh" 49 #include "G4INCLGlobals.hh" 49 #include "G4INCLGlobals.hh" 50 #include <algorithm> 50 #include <algorithm> 51 #include <istream> 51 #include <istream> 52 52 53 namespace G4INCL { 53 namespace G4INCL { 54 54 55 namespace { 55 namespace { 56 56 57 G4ThreadLocal G4double **theTable = NULL; 57 G4ThreadLocal G4double **theTable = NULL; 58 G4ThreadLocal G4int AMax = 0; 58 G4ThreadLocal G4int AMax = 0; 59 G4ThreadLocal G4int *ZMaxArray = NULL; 59 G4ThreadLocal G4int *ZMaxArray = NULL; 60 G4ThreadLocal G4double protonMass = 0.; 60 G4ThreadLocal G4double protonMass = 0.; 61 G4ThreadLocal G4double neutronMass = 0.; 61 G4ThreadLocal G4double neutronMass = 0.; 62 62 63 const G4double amu = 931.494061; // atomic 63 const G4double amu = 931.494061; // atomic mass unit in MeV/c^2 64 const G4double eMass = 0.5109988; // elect 64 const G4double eMass = 0.5109988; // electron mass in MeV/c^2 65 65 66 G4double getWeizsaeckerMass(const G4int A, 66 G4double getWeizsaeckerMass(const G4int A, const G4int Z) { 67 const G4int Npairing = (A-Z)%2; 67 const G4int Npairing = (A-Z)%2; // pairing 68 const G4int Zpairing = Z%2; 68 const G4int Zpairing = Z%2; 69 const G4double fA = (G4double) A; 69 const G4double fA = (G4double) A; 70 const G4double fZ = (G4double) Z; 70 const G4double fZ = (G4double) Z; 71 G4double binding = 71 G4double binding = 72 - 15.67*fA // 72 - 15.67*fA // nuclear volume 73 + 17.23*Math::pow23(fA) 73 + 17.23*Math::pow23(fA) // surface energy 74 + 93.15*((fA/2.-fZ)*(fA/2.-fZ))/fA 74 + 93.15*((fA/2.-fZ)*(fA/2.-fZ))/fA // asymmetry 75 + 0.6984523*fZ*fZ*Math::powMinus13(fA) 75 + 0.6984523*fZ*fZ*Math::powMinus13(fA); // coulomb 76 if( Npairing == Zpairing ) binding += (N 76 if( Npairing == Zpairing ) binding += (Npairing+Zpairing-1) * 12.0 / std::sqrt(fA); // pairing 77 77 78 return fZ*::G4INCL::ParticleTable::getRe 78 return fZ*::G4INCL::ParticleTable::getRealMass(Proton)+((G4double)(A-Z)) 79 *::G4INCL::ParticleTable::getRealMass( 79 *::G4INCL::ParticleTable::getRealMass(Neutron)+binding; 80 } 80 } 81 81 82 void setMass(const G4int A, const G4int Z, 82 void setMass(const G4int A, const G4int Z, const G4double mass) { 83 theTable[A][Z] = mass; 83 theTable[A][Z] = mass; 84 } 84 } 85 85 86 class MassRecord { 86 class MassRecord { 87 public: 87 public: 88 MassRecord() : 88 MassRecord() : 89 A(0), 89 A(0), 90 Z(0), 90 Z(0), 91 excess(0.) 91 excess(0.) 92 {} 92 {} 93 93 94 MassRecord(const G4int a, const G4int 94 MassRecord(const G4int a, const G4int z, const G4double e) : 95 A(a), 95 A(a), 96 Z(z), 96 Z(z), 97 excess(e) 97 excess(e) 98 {} 98 {} 99 99 100 friend std::istream &operator>>(std::i 100 friend std::istream &operator>>(std::istream &in, MassRecord &record); 101 101 102 G4int A; 102 G4int A; 103 G4int Z; 103 G4int Z; 104 G4double excess; 104 G4double excess; 105 }; 105 }; 106 106 107 std::istream &operator>>(std::istream &in, 107 std::istream &operator>>(std::istream &in, MassRecord &record) { 108 return (in >> record.A >> record.Z >> re 108 return (in >> record.A >> record.Z >> record.excess); 109 } 109 } 110 110 111 G4bool compareA(const MassRecord &lhs, con 111 G4bool compareA(const MassRecord &lhs, const MassRecord &rhs) { 112 return (lhs.A < rhs.A); 112 return (lhs.A < rhs.A); 113 } 113 } 114 114 115 } 115 } 116 116 117 namespace NuclearMassTable { 117 namespace NuclearMassTable { 118 118 119 void initialize(const std::string &path, c 119 void initialize(const std::string &path, const G4double pMass, const G4double nMass) { 120 protonMass = pMass; 120 protonMass = pMass; 121 neutronMass = nMass; 121 neutronMass = nMass; 122 122 123 // Clear the existing tables, if any 123 // Clear the existing tables, if any 124 deleteTable(); 124 deleteTable(); 125 125 126 // File name 126 // File name 127 std::string fileName(path + "/walletlife 127 std::string fileName(path + "/walletlifetime.dat"); 128 INCL_DEBUG("Reading real nuclear masses 128 INCL_DEBUG("Reading real nuclear masses from file " << fileName << '\n'); 129 129 130 // Open the file stream 130 // Open the file stream 131 std::ifstream massTableIn(fileName.c_str 131 std::ifstream massTableIn(fileName.c_str()); 132 if(!massTableIn.good()) { 132 if(!massTableIn.good()) { 133 std::cerr << "Cannot open " << fileNam 133 std::cerr << "Cannot open " << fileName << " data file." << '\n'; 134 std::abort(); 134 std::abort(); 135 return; 135 return; 136 } 136 } 137 137 138 // read the file 138 // read the file 139 std::vector<MassRecord> records; 139 std::vector<MassRecord> records; 140 MassRecord record; 140 MassRecord record; 141 while(massTableIn.good()) { /* Loop chec 141 while(massTableIn.good()) { /* Loop checking, 10.07.2015, D.Mancusi */ 142 massTableIn >> record; 142 massTableIn >> record; 143 records.push_back(record); 143 records.push_back(record); 144 } 144 } 145 massTableIn.close(); 145 massTableIn.close(); 146 INCL_DEBUG("Read " << records.size() << 146 INCL_DEBUG("Read " << records.size() << " nuclear masses" << '\n'); 147 147 148 // determine the max A 148 // determine the max A 149 AMax = std::max_element(records.begin(), 149 AMax = std::max_element(records.begin(), records.end(), compareA)->A; 150 INCL_DEBUG("Max A in nuclear-mass table 150 INCL_DEBUG("Max A in nuclear-mass table = " << AMax << '\n'); 151 ZMaxArray = new G4int[AMax+1]; 151 ZMaxArray = new G4int[AMax+1]; 152 std::fill(ZMaxArray, ZMaxArray+AMax+1, 0 152 std::fill(ZMaxArray, ZMaxArray+AMax+1, 0); 153 theTable = new G4double*[AMax+1]; 153 theTable = new G4double*[AMax+1]; 154 std::fill(theTable, theTable+AMax+1, sta 154 std::fill(theTable, theTable+AMax+1, static_cast<G4double*>(NULL)); 155 155 156 // determine the max A per Z 156 // determine the max A per Z 157 for(std::vector<MassRecord>::const_itera 157 for(std::vector<MassRecord>::const_iterator i=records.begin(), e=records.end(); i!=e; ++i) { 158 ZMaxArray[i->A] = std::max(ZMaxArray[i 158 ZMaxArray[i->A] = std::max(ZMaxArray[i->A], i->Z); 159 } 159 } 160 160 161 // allocate the arrays 161 // allocate the arrays 162 for(G4int A=1; A<=AMax; ++A) { 162 for(G4int A=1; A<=AMax; ++A) { 163 theTable[A] = new G4double[ZMaxArray[A 163 theTable[A] = new G4double[ZMaxArray[A]+1]; 164 std::fill(theTable[A], theTable[A]+ZMa 164 std::fill(theTable[A], theTable[A]+ZMaxArray[A]+1, -1.); 165 } 165 } 166 166 167 // fill the actual masses 167 // fill the actual masses 168 for(std::vector<MassRecord>::const_itera 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->exce 169 setMass(i->A, i->Z, i->A*amu + i->excess - i->Z*eMass); 170 } 170 } 171 } 171 } 172 172 173 G4double getMass(const G4int A, const G4in 173 G4double getMass(const G4int A, const G4int Z) { 174 if(A>AMax || Z>ZMaxArray[A]) { 174 if(A>AMax || Z>ZMaxArray[A]) { 175 INCL_DEBUG("Real mass unavailable for 175 INCL_DEBUG("Real mass unavailable for isotope A=" << A << ", Z=" << Z 176 << ", using Weizsaecker's f 176 << ", using Weizsaecker's formula" 177 << '\n'); 177 << '\n'); 178 return getWeizsaeckerMass(A,Z); 178 return getWeizsaeckerMass(A,Z); 179 } 179 } 180 180 181 const G4double mass = theTable[A][Z]; 181 const G4double mass = theTable[A][Z]; 182 if(mass<0.) { 182 if(mass<0.) { 183 INCL_DEBUG("Real mass unavailable for 183 INCL_DEBUG("Real mass unavailable for isotope A=" << A << ", Z=" << Z 184 << ", using Weizsaecker's f 184 << ", using Weizsaecker's formula" 185 << '\n'); 185 << '\n'); 186 return getWeizsaeckerMass(A,Z); 186 return getWeizsaeckerMass(A,Z); 187 } else 187 } else 188 return mass; 188 return mass; 189 } 189 } 190 190 191 G4double getMass(const G4int A, const G4in 191 G4double getMass(const G4int A, const G4int Z, const G4int S){ 192 if(S>=0) return getMass(A,Z); 192 if(S>=0) return getMass(A,Z); 193 193 194 // assert(A >= 1); 194 // assert(A >= 1); 195 // assert(Z < A); 195 // assert(Z < A); 196 // assert(S*(-1)<=A); 196 // assert(S*(-1)<=A); 197 197 198 const G4double mL = ParticleTable::getReal 198 const G4double mL = ParticleTable::getRealMass(Lambda); // mLambda 199 if(A == (-1)*S) return A*mL; 199 if(A == (-1)*S) return A*mL; 200 200 201 if( A==2 && Z == 0) { // No stable hypernu 201 if( A==2 && Z == 0) { // No stable hypernuclei with A=2 202 return mL+ParticleTable::getRealMass(Neu 202 return mL+ParticleTable::getRealMass(Neutron); 203 } 203 } 204 else if( Z == 0) { // No stable hypernucle 204 else if( Z == 0) { // No stable hypernuclei with Z=0 205 return (A+S)*ParticleTable::getRealMass( << 205 return ParticleTable::getRealMass(Neutron)-mL*S; 206 } 206 } 207 else if( A==2 && Z == 1) { 207 else if( A==2 && Z == 1) { 208 return mL+ParticleTable::getRealMass(Pro 208 return mL+ParticleTable::getRealMass(Proton); 209 } 209 } 210 210 211 211 212 const G4double b7=25.; // (MeV) 212 const G4double b7=25.; // (MeV) 213 const G4double b8=10.5; // Slope 213 const G4double b8=10.5; // Slope 214 const G4double a2=0.13; // BindingEnergy f 214 const G4double a2=0.13; // BindingEnergy for d+Lambda(MeV) 215 const G4double a3=2.2; // BindingEnergy f 215 const G4double a3=2.2; // BindingEnergy for (t/He3)+Lamb(MeV) 216 const G4double eps =0.0001; // security va 216 const G4double eps =0.0001; // security value (MeV) 217 217 218 G4double mass = getMass(A+S, Z); 218 G4double mass = getMass(A+S, Z); 219 219 220 G4double bs=0.; 220 G4double bs=0.; 221 if (A+S ==2) bs=a2; // for nnL 221 if (A+S ==2) bs=a2; // for nnL,npL,ppL 222 else if(A+S ==3) bs=a3; // for 3nL 222 else if(A+S ==3) bs=a3; // for 3nL,2npL,n2pL,3pL 223 else if(A+S >3) bs=b7*std::exp(-b8/(A+S+1 223 else if(A+S >3) bs=b7*std::exp(-b8/(A+S+1.)); 224 mass += (-1)*S*(mL-bs) + eps; 224 mass += (-1)*S*(mL-bs) + eps; 225 225 226 return mass; 226 return mass; 227 } 227 } 228 228 229 void deleteTable() { 229 void deleteTable() { 230 delete[] ZMaxArray; 230 delete[] ZMaxArray; 231 ZMaxArray = NULL; 231 ZMaxArray = NULL; 232 for(G4int A=1; A<=AMax; ++A) 232 for(G4int A=1; A<=AMax; ++A) 233 delete[] theTable[A]; 233 delete[] theTable[A]; 234 delete[] theTable; 234 delete[] theTable; 235 theTable = NULL; 235 theTable = NULL; 236 } 236 } 237 } 237 } 238 238 239 } 239 } 240 240 241 #endif // INCLXX_IN_GEANT4_MODE 241 #endif // INCLXX_IN_GEANT4_MODE 242 242