Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AblaDataFile Class Reference

#include <G4AblaDataFile.hh>

+ Inheritance diagram for G4AblaDataFile:

Public Member Functions

 G4AblaDataFile ()
 
 ~G4AblaDataFile ()
 
bool readData ()
 
- Public Member Functions inherited from G4AblaVirtualData
G4bool setAlpha (G4int A, G4int Z, G4double value)
 
G4bool setEcnz (G4int A, G4int Z, G4double value)
 
G4bool setVgsld (G4int A, G4int Z, G4double value)
 
G4bool setPace2 (G4int A, G4int Z, G4double value)
 
G4bool setRms (G4int A, G4int Z, G4double value)
 
G4bool setMexp (G4int A, G4int Z, G4double value)
 
G4bool setMexpID (G4int A, G4int Z, G4int value)
 
G4bool setBeta2 (G4int A, G4int Z, G4double value)
 
G4bool setBeta4 (G4int A, G4int Z, G4double value)
 
G4double getAlpha (G4int A, G4int Z)
 
G4double getEcnz (G4int A, G4int Z)
 
G4double getVgsld (G4int A, G4int Z)
 
G4double getPace2 (G4int A, G4int Z)
 
G4double getRms (G4int A, G4int Z)
 
G4double getMexp (G4int A, G4int Z)
 
G4int getMexpID (G4int A, G4int Z)
 
G4double getBeta2 (G4int A, G4int Z)
 
G4double getBeta4 (G4int A, G4int Z)
 
G4int getAlphaRows ()
 
G4int getAlphaCols ()
 
G4int getPaceRows ()
 
G4int getPaceCols ()
 
virtual G4bool readData ()=0
 

Additional Inherited Members

- Protected Member Functions inherited from G4AblaVirtualData
 G4AblaVirtualData ()
 
virtual ~G4AblaVirtualData ()
 

Detailed Description

Read ABLA data from files.

Definition at line 45 of file G4AblaDataFile.hh.

Constructor & Destructor Documentation

◆ G4AblaDataFile()

G4AblaDataFile::G4AblaDataFile ( )

Definition at line 52 of file G4AblaDataFile.cc.

52 {
53#else
56 theConfig = config;
57#endif
58 verboseLevel = 0;
59}
struct config_s config

Referenced by G4AblaDataFile().

◆ ~G4AblaDataFile()

G4AblaDataFile::~G4AblaDataFile ( )

Definition at line 61 of file G4AblaDataFile.cc.

62{
63}

Member Function Documentation

◆ readData()

bool G4AblaDataFile::readData ( )
virtual

Read all data from files.

Implements G4AblaVirtualData.

Definition at line 68 of file G4AblaDataFile.cc.

69{
70#ifdef ABLAXX_IN_GEANT4_MODE
71 if(!G4FindDataDir("G4ABLADATA")) {
72 // throw G4HadronicException(__FILE__, __LINE__, "ERROR: Data
73 // missing. Set environment variable G4ABLA3.0 to point to the
74 // directory containing data files needed by INCL and ABLA
75 // models.");
76 // G4String errorMessage1 = "ERROR: Data missing. Set environment variable G4ABLADATA\n";
77 // G4String errorMessage2 = "\t to point to the directory containing data files needed\n";
78 // G4String errorMessage3 = "\t by INCL and ABLA models.\n";
79 // G4String errorMessage = errorMessage1 + errorMessage2 + errorMessage3;
80 // G4Exception(errorMessage);
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",
86 FatalException, ed);
87 }
88 G4String dataPath(G4FindDataDir("G4ABLADATA"));
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 // G4cout <<"Data path = " << dataPath << G4endl;
102 // G4cout <<"FlAlphaFile = " << flAlphaFile << G4endl;
103 // G4cout <<"FrldmFile = " << frldmFile << G4endl;
104 // G4cout <<"VgsldFile = " << vgsldFile << G4endl;
105 // G4cout <<"Pace2File = " << pace2File << G4endl;
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;
128 G4Exception("G4AblaDataFile::readData()", "ABLA", FatalException, ed);
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;
136 G4double fbeta2,fbeta4;
137 G4double a7;
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++) {
147 setAlpha(j, i, 0.0);
148 setEcnz( j, i, 0.0);
149 setVgsld(j, i, 0.0);
150 setRms(j, i, 0.0);
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;
160 setAlpha(j, i, fflalpha);
161 setEcnz( j, i, ffrldm);
162 setVgsld(j, i, fvgsld);
163 setRms(j, i, frms);
164 }
165 }
166
167
168 for(int i = 0; i < rowsbeta; i++) {
169 for(int j = 0; j < colsbeta; j++) {
170 setBeta2(j, i, 0.0);
171 setBeta4(j, i, 0.0);
172 }
173 }
174
175 for(int i = 0; i < 8983; i++) {
176 defoin >> fj >> fk >> fbeta2 >> fbeta4;
177 setBeta2(fk, fj, fbeta2);
178 setBeta4(fk, fj, fbeta4);
179 }
180
181 for(int i = 0; i < rowsmass; i++) {
182 for(int j = 0; j < colsmass; j++) {
183 setMexp(j, i, 0.0);
184 setMexpID(j,i,0);
185 }
186 }
187 massin >> a2 >> a3 >> a4 >> a7 ;
188 while(!massin.eof()){
189 //
190 if(a3<13.){
191 setMexpID(a2,a3,1);
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
204 G4String str1, str2, str3;
205 for(int i = 0; i < 500; i++) {
206 for(int j = 0; j < 500; j++) {
207 setPace2(i, j, 0.0);
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;
214 if(Zbegin >= 0 && Zbegin < getPaceCols() &&
215 A >= 0 && A < getPaceRows()) {
216 for(int j = Zbegin; j <= Zend; j++) {
217 pace2in >> fpace2;
218 setPace2(A, j, 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 *)
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
const G4double A[17]
#define G4endl
Definition: G4ios.hh:57
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)

Referenced by G4Abla::initEvapora().


The documentation for this class was generated from the following files: