Read all data from files.
69{
70#ifdef ABLAXX_IN_GEANT4_MODE
72
73
74
75
76
77
78
79
80
82 ed << " Data missing: set environment variable G4ABLADATA\n"
83 << " to point to the directory containing data files needed\n"
84 <<
" by the ABLA model" <<
G4endl;
85 G4Exception(
"G4AblaDataFile::readData()",
"ABLA_001",
87 }
89#else
90 G4String dataPath(theConfig->getABLAXXDataFilePath().c_str());
91#endif
92 G4String flAlphaFile(dataPath +
"/flalpha.dat");
93 G4String frldmFile( dataPath +
"/frldm.dat");
94 G4String vgsldFile( dataPath +
"/vgsld.dat");
95 G4String pace2File( dataPath +
"/pace2.dat");
96 G4String rmsFile( dataPath +
"/rms.dat");
97 G4String defoFile( dataPath +
"/defo.dat");
98 G4String massFile( dataPath +
"/mass2003.dat");
99
100 if(verboseLevel > 1) {
101
102
103
104
105
106 }
107
108 std::ifstream flalphain(flAlphaFile.c_str());
109 std::ifstream frldmin(frldmFile.c_str());
110 std::ifstream vgsldin(vgsldFile.c_str());
111 std::ifstream pace2in(pace2File.c_str());
112 std::ifstream rmsin(rmsFile.c_str());
113 std::ifstream defoin(defoFile.c_str());
114 std::ifstream massin(massFile.c_str());
115
116 std::filebuf *buf1 = flalphain.rdbuf();
117 std::filebuf *buf2 = frldmin.rdbuf();
118 std::filebuf *buf3 = vgsldin.rdbuf();
119 std::filebuf *buf4 = pace2in.rdbuf();
120 std::filebuf *buf5 = rmsin.rdbuf();
121 std::filebuf *buf6 = defoin.rdbuf();
122 std::filebuf *buf7 = massin.rdbuf();
123 if (!((buf1->is_open()) && (buf2->is_open()) && (buf3->is_open()) && (buf4->is_open()) && (buf5->is_open()) && (buf6->is_open()) && (buf7->is_open()))) {
124#ifdef ABLAXX_IN_GEANT4_MODE
126 ed << "Data missing: could not find ABLA data file in " << dataPath
127 <<
"defined by environment variable G4ABLADATA" <<
G4endl;
129#else
130 std::cerr << "Error opening file." << std::endl;
131#endif
132 }
133
134 G4double fflalpha, ffrldm, fvgsld, fpace2, frms;
135 int fj,fk,a2,a3,a4;
138 const G4int rows = 99;
139 const G4int cols = 154;
140 const G4int rowsbeta = 137;
141 const G4int colsbeta = 251;
142 const G4int rowsmass = 13;
143 const G4int colsmass = 154;
144 const G4int massnumbers = 263;
145 for(int i = 0; i < rows; i++) {
146 for(int j = 0; j < cols; j++) {
151 }
152 }
153
154 for(int i = 0; i < rows; i++) {
155 for(int j = 0; j < cols; j++) {
156 flalphain >> fflalpha;
157 frldmin >> ffrldm;
158 vgsldin >> fvgsld;
159 rmsin >> frms;
164 }
165 }
166
167
168 for(int i = 0; i < rowsbeta; i++) {
169 for(int j = 0; j < colsbeta; j++) {
172 }
173 }
174
175 for(int i = 0; i < 8983; i++) {
176 defoin >> fj >> fk >> fbeta2 >> fbeta4;
179 }
180
181 for(int i = 0; i < rowsmass; i++) {
182 for(int j = 0; j < colsmass; j++) {
185 }
186 }
187 massin >> a2 >> a3 >> a4 >> a7 ;
188 while(!massin.eof()){
189
190 if(a3<13.){
192 setMexp(a2,a3,938.7829835*a3+939.5653301*a2-1.*a4*a7/1000.);
193 }
194 massin >> a2 >> a3 >> a4 >> a7 ;
195 }
196
197 flalphain.close();
198 frldmin.close();
199 vgsldin.close();
200 rmsin.close();
201 defoin.close();
202 massin.close();
203
205 for(int i = 0; i < 500; i++) {
206 for(int j = 0; j < 500; j++) {
208 }
209 }
210
211 int A = 0, Zbegin = 0, Zend = 0;
212 for(int i = 0; i < massnumbers; i++) {
213 pace2in >> str1 >>
A >> str2 >> Zbegin >> str3 >> Zend;
216 for(int j = Zbegin; j <= Zend; j++) {
217 pace2in >> fpace2;
219 }
220 }
221 }
222 pace2in.close();
223 if(std::abs(
getPace2(
A, Zend) - 114516.10) > 1e-6) {
224 std::cerr << "ERROR: Problem in parsing datafile " + pace2File << std::endl;
225 return false;
226 }
227
228 return true;
229}
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4bool setVgsld(G4int A, G4int Z, G4double value)
G4double getPace2(G4int A, G4int Z)
G4bool setMexp(G4int A, G4int Z, G4double value)
G4bool setEcnz(G4int A, G4int Z, G4double value)
G4bool setPace2(G4int A, G4int Z, G4double value)
G4bool setRms(G4int A, G4int Z, G4double value)
G4bool setMexpID(G4int A, G4int Z, G4int value)
G4bool setAlpha(G4int A, G4int Z, G4double value)
G4bool setBeta2(G4int A, G4int Z, G4double value)
G4bool setBeta4(G4int A, G4int Z, G4double value)