44#include "egs_application.h"
46#include "egs_functions.h"
54 EGS_BaseSource(input,f) {
56 otype =
"EB_IAEAPHSPSource";
60 egsWarning(
"EB_IAEASource: no 'header file' input\n");
73 EGS_Application *app = EGS_Application::activeApplication();
87 "EB_IAEASource: errors while opening the phase space file %s\n",
99 ss <<
" Number of original particles = " <<
Nincident << endl;
100 ss <<
" Number of particles in phsp = " <<
Nparticle << endl;
101 ss <<
" Max energy of particles = " <<
Emax <<
" MeV" << endl;
102 description = ss.str();
139 Emax = (EGS_Float)ftmp;
141 iaea_get_total_original_particles(
p_source_id, &i64tmp);
145 iaea_get_max_particles(
p_source_id, &type, &i64tmp);
148 iaea_get_used_original_particles(
p_source_id, &i64tmp);
149 Nused = (IAEA_I64)i64tmp;
158 int &latch, EGS_Float &E, EGS_Float &wt, EGS_Vector &x, EGS_Vector &u) {
160 IAEA_I32 n_stat, type, extra_ints;
161 IAEA_Float Ei, wti, xi, yi, zi, ui, vi, wi, extra_floats;
168 &extra_floats, &extra_ints
174 "\nEB_IAEASource:: Error reading particle from phsp file (n_stat=%d).\n"
175 "Rewinding to first record (may cause statistical biases)\n",
186 }
else if (type == 2) {
188 }
else if (type == 3) {
210 if (nstart < 0 || nrun < 1 || nstart + nrun >
Nparticle) {
212 "EB_IAEASource::setSimulationChunk(): illegal attempt "
213 "to set the simulation chunk between %lld and %lld ignored\n",
214 nstart, nstart + nrun - 1);
226 egsFatal(
"EB_IAEASource:: failed to set record to %d",
Npos);
249 bool res = egsStoreI64(data,
Nread);
255 res = egsStoreI64(data,
Nfirst);
261 res = egsStoreI64(data,
Nlast);
267 res = egsStoreI64(data,
Npos);
273 res = egsStoreI64(data,
count);
285 bool res = egsGetI64(data,
Nread);
290 res = egsGetI64(data,
Nfirst);
295 res = egsGetI64(data,
Nlast);
300 res = egsGetI64(data,
Npos);
309 egsInformation(
"Failed to find record %d\n", ires);
313 res = egsGetI64(data,
count);
321 IAEA_I64 tmp_Nread =
Nread;
322 IAEA_I64 tmp_count =
count;
338 return createSourceTemplate<EB_IAEASource>(input,f,
"iaea phsp source");
static IAEA_I32 next_source_id
static const string iaea_header_ext
EGS_Float Emax
Maximum energy (obtained from the phsp file)
string phsp_file_name
The phase space file name.
IAEA_I64 Nfirst
first record this source can use
bool addState(istream &data)
EGS_Float getFluence() const
EGS_Float Nincident
Number of incident particles that created the file.
IAEA_I64 Nlast
Last record this source can use.
IAEA_I64 count
Particles delivered so far.
EB_IAEASource(EGS_Input *, EGS_ObjectFactory *f=0)
Constructor.
IAEA_I64 Nparticle
Number of particles in the file.
IAEA_I64 Npos
Next record to be read.
bool storeState(ostream &data) const
EGS_Float getEmax() const
EGS_I64 getNextParticle(EGS_RandomGenerator *rndm, int &q, int &latch, EGS_Float &E, EGS_Float &wt, EGS_Vector &x, EGS_Vector &u)
IAEA_I64 Nread
Number of particles read from file so far.
IAEA_I64 Nused
Number of particles used so far.
void setSimulationChunk(EGS_I64 nstart, EGS_I64 nrun)
EGS_Float Emin
Minimum energy (obtained from the phsp file)
bool setState(istream &data)
EB_IAEA_SOURCE_EXPORT EGS_BaseSource * createSource(EGS_Input *input, EGS_ObjectFactory *f)
a minimal IAEA phase space source for egs_brachy
#define EB_IAEA_SOURCE_EXPORT