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 // ABLAXX statistical de-excitation model 26 // ABLAXX statistical de-excitation model 27 // Jose Luis Rodriguez, UDC (translation from << 27 // Pekka Kaitaniemi, HIP (translation) 28 // Pekka Kaitaniemi, HIP (initial translation << 28 // Christelle Schmidt, IPNL (fission code) 29 // Aleksandra Kelic, GSI (ABLA07 code) << 29 // Davide Mancusi, CEA (contact person INCL/ABLA) 30 // Davide Mancusi, CEA (contact person INCL) << 31 // Aatos Heikkinen, HIP (project coordination) 30 // Aatos Heikkinen, HIP (project coordination) 32 // 31 // >> 32 #define ABLAXX_IN_GEANT4_MODE 1 33 33 34 #include "G4AblaDataFile.hh" << 35 #include "G4AblaDataDefs.hh" << 36 #include "globals.hh" 34 #include "globals.hh" 37 35 38 #include <cmath> << 36 #include "G4AblaDataFile.hh" 39 #include <cstdlib> << 37 //#include "G4HadronicException.hh" >> 38 #ifdef ABLAXX_IN_GEANT4_MODE >> 39 #include "globals.hh" >> 40 #else >> 41 #include "G4INCLGeant4Compat.hh" >> 42 #endif 40 #include <fstream> 43 #include <fstream> >> 44 #include <cmath> 41 #include <iostream> 45 #include <iostream> >> 46 #include <cstdlib> >> 47 >> 48 #ifdef ABLAXX_IN_GEANT4_MODE >> 49 G4AblaDataFile::G4AblaDataFile() { >> 50 #else >> 51 G4AblaDataFile::G4AblaDataFile(G4INCL::Config *config) >> 52 : G4AblaVirtualData(config) { >> 53 theConfig = config; >> 54 #endif >> 55 verboseLevel = 0; >> 56 } 42 57 43 G4AblaDataFile::G4AblaDataFile() { verboseLeve << 58 G4AblaDataFile::~G4AblaDataFile() >> 59 { >> 60 } 44 61 45 /** 62 /** 46 * Read all data from files. 63 * Read all data from files. 47 */ 64 */ 48 G4bool G4AblaDataFile::readData() << 65 bool G4AblaDataFile::readData() 49 { 66 { 50 if (!G4FindDataDir("G4ABLADATA")) << 67 #ifdef ABLAXX_IN_GEANT4_MODE 51 { << 68 if(!getenv("G4ABLADATA")) { 52 G4ExceptionDescription ed; << 69 // throw G4HadronicException(__FILE__, __LINE__, "ERROR: Data 53 ed << " Data missing: set environment << 70 // missing. Set environment variable G4ABLA3.0 to point to the 54 << " to point to the directory cont << 71 // directory containing data files needed by INCL and ABLA 55 << " by the ABLA model" << G4endl; << 72 // models."); 56 G4Exception("G4AblaDataFile::readData( << 73 // G4String errorMessage1 = "ERROR: Data missing. Set environment variable G4ABLADATA\n"; 57 } << 74 // G4String errorMessage2 = "\t to point to the directory containing data files needed\n"; 58 G4String dataPath(G4FindDataDir("G4ABLADAT << 75 // G4String errorMessage3 = "\t by INCL and ABLA models.\n"; 59 << 76 // G4String errorMessage = errorMessage1 + errorMessage2 + errorMessage3; 60 G4String flAlphaFile(dataPath + "/flalpha. << 77 // G4Exception(errorMessage); 61 G4String frldmFile(dataPath + "/frldm.dat" << 78 G4ExceptionDescription ed; 62 G4String vgsldFile(dataPath + "/vgsld.dat" << 79 ed << " Data missing: set environment variable G4ABLADATA\n" 63 G4String rmsFile(dataPath + "/rms.dat"); << 80 << " to point to the directory containing data files needed\n" 64 G4String defoFile(dataPath + "/defo.dat"); << 81 << " by the ABLA model" << G4endl; 65 G4String massFile(dataPath + "/mass2020.da << 82 G4Exception("G4AblaDataFile::readData()","ABLA_001", 66 << 83 FatalException, ed); 67 if (verboseLevel > 1) << 84 } 68 { << 85 69 // G4cout <<"Data path = " << dataPa << 86 G4String dataPath(getenv("G4ABLADATA")); 70 // G4cout <<"FlAlphaFile = " << flAlph << 87 #else 71 // G4cout <<"FrldmFile = " << frldmF << 88 G4String dataPath(theConfig->getABLAv3pCxxDataFilePath().c_str()); 72 // G4cout <<"VgsldFile = " << vgsldF << 89 #endif 73 } << 90 G4String flAlphaFile(dataPath + "/flalpha.dat"); 74 << 91 G4String frldmFile( dataPath + "/frldm.dat"); 75 std::ifstream flalphain(flAlphaFile.c_str( << 92 G4String vgsldFile( dataPath + "/vgsld.dat"); 76 std::ifstream frldmin(frldmFile.c_str()); << 93 G4String pace2File( dataPath + "/pace2.dat"); 77 std::ifstream vgsldin(vgsldFile.c_str()); << 94 78 std::ifstream rmsin(rmsFile.c_str()); << 95 if(verboseLevel > 1) { 79 std::ifstream defoin(defoFile.c_str()); << 96 // G4cout <<"Data path = " << dataPath << G4endl; 80 std::ifstream massin(massFile.c_str()); << 97 // G4cout <<"FlAlphaFile = " << flAlphaFile << G4endl; 81 << 98 // G4cout <<"FrldmFile = " << frldmFile << G4endl; 82 if (!massin.is_open()) << 99 // G4cout <<"VgsldFile = " << vgsldFile << G4endl; 83 { << 100 // G4cout <<"Pace2File = " << pace2File << G4endl; 84 massFile = dataPath + "/mass2016.dat"; << 101 } 85 massin.close(); << 102 86 massin.open(massFile.c_str()); << 103 std::ifstream flalphain(flAlphaFile.c_str()); 87 std::cout << "Mass evaluation file mas << 104 std::ifstream frldmin(frldmFile.c_str()); 88 << 105 std::ifstream vgsldin(vgsldFile.c_str()); 89 if (!massin.is_open()) << 106 std::ifstream pace2in(pace2File.c_str()); 90 { << 107 91 massFile = dataPath + "/mass2003.d << 108 std::filebuf *buf1 = flalphain.rdbuf(); 92 massin.close(); << 109 std::filebuf *buf2 = frldmin.rdbuf(); 93 massin.open(massFile.c_str()); << 110 std::filebuf *buf3 = vgsldin.rdbuf(); 94 std::cout << "Mass evaluation file << 111 std::filebuf *buf4 = pace2in.rdbuf(); 95 } << 112 if (!((buf1->is_open()) && (buf2->is_open()) && (buf3->is_open()) && (buf4->is_open()))) { 96 } << 113 #ifdef ABLAXX_IN_GEANT4_MODE >> 114 G4ExceptionDescription ed; >> 115 ed << " Data missing: could not find ABLA data file in " << dataPath >> 116 << "defined by environment variable G4ABLADATA" << G4endl; >> 117 G4Exception("G4AblaDataFile::readData()", "ABLA002", FatalException, ed); >> 118 #else >> 119 std::cerr << "Error opening file." << std::endl; >> 120 #endif >> 121 } >> 122 >> 123 G4double fflalpha, ffrldm, fvgsld, fpace2; >> 124 const G4int rows = 99; >> 125 const G4int cols = 154; >> 126 const G4int massnumbers = 263; >> 127 for(int i = 0; i < rows; i++) { >> 128 for(int j = 0; j < cols; j++) { >> 129 setAlpha(j, i, 0.0); >> 130 setEcnz( j, i, 0.0); >> 131 setVgsld(j, i, 0.0); >> 132 } >> 133 } >> 134 >> 135 for(int i = 0; i < rows; i++) { >> 136 for(int j = 0; j < cols; j++) { >> 137 flalphain >> fflalpha; >> 138 frldmin >> ffrldm; >> 139 vgsldin >> fvgsld; >> 140 setAlpha(j, i, fflalpha); >> 141 setEcnz( j, i, ffrldm); >> 142 setVgsld(j, i, fvgsld); >> 143 } >> 144 } >> 145 flalphain.close(); >> 146 frldmin.close(); >> 147 vgsldin.close(); >> 148 >> 149 G4String str1, str2, str3; >> 150 for(int i = 0; i < 500; i++) { >> 151 for(int j = 0; j < 500; j++) { >> 152 setPace2(i, j, 0.0); >> 153 } >> 154 } >> 155 >> 156 int A = 0, Zbegin = 0, Zend = 0; >> 157 for(int i = 0; i < massnumbers; i++) { >> 158 pace2in >> str1 >> A >> str2 >> Zbegin >> str3 >> Zend; >> 159 if(Zbegin >= 0 && Zbegin < getPaceCols() && >> 160 A >= 0 && A < getPaceRows()) { >> 161 for(int j = Zbegin; j <= Zend; j++) { >> 162 pace2in >> fpace2; >> 163 setPace2(A, j, fpace2); >> 164 } >> 165 } >> 166 } >> 167 pace2in.close(); >> 168 if(std::abs(getPace2(A, Zend) - 114516.10) > 1e-6) { >> 169 std::cerr << "ERROR: Problem in parsing datafile " + pace2File << std::endl; >> 170 return false; >> 171 } 97 172 98 std::filebuf* buf1 = flalphain.rdbuf(); << 173 return true; 99 std::filebuf* buf2 = frldmin.rdbuf(); << 100 std::filebuf* buf3 = vgsldin.rdbuf(); << 101 std::filebuf* buf4 = rmsin.rdbuf(); << 102 std::filebuf* buf5 = defoin.rdbuf(); << 103 std::filebuf* buf6 = massin.rdbuf(); << 104 if (!((buf1->is_open()) && (buf2->is_open( << 105 (buf6->is_open()))) << 106 { << 107 G4ExceptionDescription ed; << 108 ed << "Data missing: could not find AB << 109 << "defined by environment variable << 110 G4Exception("G4AblaDataFile::readData( << 111 } << 112 << 113 G4double fflalpha, ffrldm, fvgsld, frms; << 114 G4int fj = 0, fk = 0, a2, a3, a4; << 115 G4double fbeta2, fbeta4; << 116 G4double a7; << 117 const G4int rows = 99; << 118 const G4int cols = 154; << 119 const G4int rowsbeta = 137; << 120 const G4int colsbeta = 251; << 121 << 122 for (G4int i = 0; i < zcols; i++) << 123 { << 124 for (G4int j = 0; j < nrows; j++) << 125 { << 126 setAlpha(j, i, 0.0); << 127 setEcnz(j, i, 0.0); << 128 setVgsld(j, i, 0.0); << 129 setRms(j, i, 0.0); << 130 } << 131 } << 132 << 133 for (G4int i = 0; i < rows; i++) << 134 { << 135 for (G4int j = 0; j < cols; j++) << 136 { << 137 flalphain >> fflalpha; << 138 frldmin >> ffrldm; << 139 vgsldin >> fvgsld; << 140 rmsin >> frms; << 141 setAlpha(j, i, fflalpha); << 142 setEcnz(j, i, ffrldm); << 143 setVgsld(j, i, fvgsld); << 144 setRms(j, i, frms); << 145 } << 146 } << 147 << 148 for (G4int i = 0; i < rowsbeta; i++) << 149 { << 150 for (G4int j = 0; j < colsbeta; j++) << 151 { << 152 setBeta2(j, i, 0.0); << 153 setBeta4(j, i, 0.0); << 154 } << 155 } << 156 << 157 defoin >> fj >> fk >> fbeta2 >> fbeta4; << 158 while (!defoin.eof()) << 159 { << 160 setBeta2(fk, fj, fbeta2); << 161 setBeta4(fk, fj, fbeta4); << 162 defoin >> fj >> fk >> fbeta2 >> fbeta4 << 163 } << 164 << 165 for (G4int i = 0; i < zcols; i++) << 166 { << 167 for (G4int j = 0; j < nrows; j++) << 168 { << 169 setMexp(j, i, 0.0); << 170 setMexpID(j, i, 0); << 171 } << 172 } << 173 massin >> a2 >> a3 >> a4 >> a7; << 174 while (!massin.eof()) << 175 { << 176 // << 177 if (a3 < lpcols) << 178 { << 179 setMexpID(a2, a3, 1); << 180 setMexp(a2, a3, 938.7829835 * a3 + << 181 } << 182 massin >> a2 >> a3 >> a4 >> a7; << 183 } << 184 << 185 flalphain.close(); << 186 frldmin.close(); << 187 vgsldin.close(); << 188 rmsin.close(); << 189 defoin.close(); << 190 massin.close(); << 191 << 192 return true; << 193 } 174 } >> 175 194 176