Geant4 11.3.0
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 ()
 
virtual ~G4AblaDataFile ()=default
 
G4bool 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 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 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)
 

Additional Inherited Members

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

Detailed Description

Read ABLA data from files.

Definition at line 42 of file G4AblaDataFile.hh.

Constructor & Destructor Documentation

◆ G4AblaDataFile()

G4AblaDataFile::G4AblaDataFile ( )

Definition at line 43 of file G4AblaDataFile.cc.

43{ verboseLevel = 0; }

◆ ~G4AblaDataFile()

virtual G4AblaDataFile::~G4AblaDataFile ( )
virtualdefault

Member Function Documentation

◆ readData()

G4bool G4AblaDataFile::readData ( )
virtual

Read all data from files.

Implements G4AblaVirtualData.

Definition at line 48 of file G4AblaDataFile.cc.

49{
50 if (!G4FindDataDir("G4ABLADATA"))
51 {
53 ed << " Data missing: set environment variable G4ABLADATA\n"
54 << " to point to the directory containing data files needed\n"
55 << " by the ABLA model" << G4endl;
56 G4Exception("G4AblaDataFile::readData()", "ABLA_001", FatalException, ed);
57 }
58 G4String dataPath(G4FindDataDir("G4ABLADATA"));
59
60 G4String flAlphaFile(dataPath + "/flalpha.dat");
61 G4String frldmFile(dataPath + "/frldm.dat");
62 G4String vgsldFile(dataPath + "/vgsld.dat");
63 G4String rmsFile(dataPath + "/rms.dat");
64 G4String defoFile(dataPath + "/defo.dat");
65 G4String massFile(dataPath + "/mass2020.dat");
66
67 if (verboseLevel > 1)
68 {
69 // G4cout <<"Data path = " << dataPath << G4endl;
70 // G4cout <<"FlAlphaFile = " << flAlphaFile << G4endl;
71 // G4cout <<"FrldmFile = " << frldmFile << G4endl;
72 // G4cout <<"VgsldFile = " << vgsldFile << G4endl;
73 }
74
75 std::ifstream flalphain(flAlphaFile.c_str());
76 std::ifstream frldmin(frldmFile.c_str());
77 std::ifstream vgsldin(vgsldFile.c_str());
78 std::ifstream rmsin(rmsFile.c_str());
79 std::ifstream defoin(defoFile.c_str());
80 std::ifstream massin(massFile.c_str());
81
82 if (!massin.is_open())
83 {
84 massFile = dataPath + "/mass2016.dat";
85 massin.close();
86 massin.open(massFile.c_str());
87 std::cout << "Mass evaluation file mass2020.dat not found, current file: " << massFile.c_str() << std::endl;
88
89 if (!massin.is_open())
90 {
91 massFile = dataPath + "/mass2003.dat";
92 massin.close();
93 massin.open(massFile.c_str());
94 std::cout << "Mass evaluation file mass2016.dat not found, current file: " << massFile.c_str() << std::endl;
95 }
96 }
97
98 std::filebuf* buf1 = flalphain.rdbuf();
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()) && (buf3->is_open()) && (buf4->is_open()) && (buf5->is_open()) &&
105 (buf6->is_open())))
106 {
108 ed << "Data missing: could not find ABLA data file in " << dataPath
109 << "defined by environment variable G4ABLADATA" << G4endl;
110 G4Exception("G4AblaDataFile::readData()", "ABLA", FatalException, ed);
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 + 939.5653301 * a2 - 1. * a4 * a7 / 1000.);
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}
constexpr const G4int zcols
constexpr const G4int nrows
constexpr const G4int lpcols
const char * G4FindDataDir(const char *)
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4bool setEcnz(G4int A, G4int Z, G4double value)
G4bool setBeta4(G4int A, G4int Z, G4double value)
G4bool setVgsld(G4int A, G4int Z, G4double value)
G4bool setAlpha(G4int A, G4int Z, G4double value)
G4bool setMexp(G4int A, G4int Z, G4double value)
G4bool setBeta2(G4int A, G4int Z, G4double value)
G4bool setMexpID(G4int A, G4int Z, G4int value)
G4bool setRms(G4int A, G4int Z, G4double value)

Referenced by G4Abla::initEvapora().


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