Read all data from files.
47{
48 if(!getenv("G4ABLADATA")) {
49
50
51
52
53 G4String errorMessage1 =
"ERROR: Data missing. Set environment variable G4ABLADATA\n";
54 G4String errorMessage2 =
"\t to point to the directory containing data files needed\n";
55 G4String errorMessage3 =
"\t by INCL and ABLA models.\n";
56 G4String errorMessage = errorMessage1 + errorMessage2 + errorMessage3;
58 }
59
60 G4String dataPath(getenv(
"G4ABLADATA"));
61 G4String flAlphaFile(dataPath +
"/flalpha.dat");
62 G4String frldmFile( dataPath +
"/frldm.dat");
63 G4String vgsldFile( dataPath +
"/vgsld.dat");
64 G4String pace2File( dataPath +
"/pace2.dat");
65
66 if(verboseLevel > 1) {
72 }
73
74 std::ifstream flalphain(flAlphaFile.c_str());
75 std::ifstream frldmin(frldmFile.c_str());
76 std::ifstream vgsldin(vgsldFile.c_str());
77 std::ifstream pace2in(pace2File.c_str());
78
79 std::filebuf *buf1 = flalphain.rdbuf();
80 std::filebuf *buf2 = frldmin.rdbuf();
81 std::filebuf *buf3 = vgsldin.rdbuf();
82 std::filebuf *buf4 = pace2in.rdbuf();
83 if (!((buf1->is_open()) && (buf2->is_open()) && (buf3->is_open()) && (buf4->is_open()))) {
84 G4Exception(
"ERROR: Data missing. Could not find ABLA data file in " + dataPath +
85 " defined by environment variable G4ABLADATA");
86 }
87
88 G4double flalpha, frldm, vgsld, pace2;
89 const G4int rows = 98;
90 const G4int cols = 153;
91 const G4int massnumbers = 263;
92 for(int i = 0; i < rows; i++) {
93 for(int j = 0; j < cols; j++) {
94 setAlpha(j, i, 0.0);
95 setEcnz( j, i, 0.0);
96 setVgsld(j, i, 0.0);
97 }
98 }
99
100 for(int i = 0; i < rows; i++) {
101 for(int j = 0; j < cols; j++) {
102 flalphain >> flalpha;
103 frldmin >> frldm;
104 vgsldin >> vgsld;
105 setAlpha(j, i, flalpha);
106 setEcnz( j, i, frldm);
107 setVgsld(j, i, vgsld);
108 }
109 }
110 flalphain.close();
111 frldmin.close();
112 vgsldin.close();
113
114 int A = 0, Zbegin = 0, Zend = 0;
116 for(int i = 0; i < 500; i++) {
117 for(int j = 0; j < 500; j++) {
118 setPace2(i, j, 0.0);
119 }
120 }
121
122 for(int i = 0; i < massnumbers; i++) {
123 pace2in >> str1 >> A >> str2 >> Zbegin >> str3 >> Zend;
124 for(int j = Zbegin; j <= Zend; j++) {
125 pace2in >> pace2;
126 setPace2(A, j, pace2);
127 }
128 }
129 pace2in.close();
130 if(std::fabs(getPace2(A, Zend) - 114516.10) > 1e-6) {
131 G4cout <<
"ERROR: Problem in parsing datafile " + pace2File <<
G4endl;
132 return false;
133 }
134
135 return true;
136}
G4DLLIMPORT std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)