78 inline void score(
unsigned short ncase, EGS_Float f) {
79 if (ncase == current_ncase) {
90 inline void finishCase(
unsigned short new_case, EGS_Float new_result) {
91 current_ncase = new_case;
106 ncase = current_ncase;
129 dr = sqrt(dr/(ncase-1));
147 data << current_ncase <<
" " << sum+tmp <<
" " << sum2+tmp *tmp
162 data >> current_ncase >> sum >> sum2;
185 sum += tmp + x.
sum + x.
tmp;
237 void setHistory(EGS_I64 ncase);
244 inline void score(
int ireg, EGS_Float f) {
245 result[ireg].score(current_ncase_short,f);
255 return result[ireg].currentScore();
262 result[ireg].currentScore(res,nc);
263 return nc == current_ncase_short ? res : 0;
272 result[ireg].currentScore(s,s2);
281 result[ireg].currentResult(current_ncase,r,dr);
302 void reportResults(
double norm,
const char *title,
bool relative_error,
303 const char *format = 0);
317 data << nreg <<
" " << current_ncase_short <<
"\n";
325 for (
int j=0; j<nreg; j++) {
326 if (!result[j].storeState(data)) {
342 data >> nreg1 >> current_ncase_short;
343 if (!data.good() || nreg1 < 1) {
349 if (!
egsGetI64(data,current_ncase_65536)) {
359 for (
int j=0; j<nreg; j++) {
360 if (!result[j].setState(data)) {
370 current_ncase_65536 = 0;
371 current_ncase_short = 0;
372 for (
int j=0; j<nreg; j++) {
385 current_ncase_65536 = current_ncase >> 16;
386 EGS_I64 aux = current_ncase - (current_ncase_65536 << 16);
387 current_ncase_short = (
unsigned short) aux;
388 for (
int j=0; j<nreg; j++) {
413 EGS_I64 current_ncase;
#define EGS_EXPORT
Export symbols from the egspp library.
A class for scoring an array of quantities (e.g. a dose distribution) in a Monte Carlo simulation...
unsigned short current_ncase_short
bool EGS_EXPORT egsGetI64(istream &data, EGS_I64 &n)
Reads a 64 bit integer from the stream data and assigns it to n. Returns true on success, false on failure.
int regions() const
Returns the number of regions (or elements or bins, the most appropriate term depending on the way th...
EGS_ScoringSingle()
Construct a scoring object initialized to zero.
bool EGS_EXPORT egsStoreI64(ostream &data, EGS_I64 n)
Writes the 64 bit integer n to the output stream data and returns true on success, false on failure.
int bins() const
Returns the number of bins (or elements or regions, the most appropriate term depending on the way th...
Global egspp functions header file.
EGS_ScoringSingle * result
bool setState(istream &data)
Sets the state fof the scoring array object from the data in the input stream data.
void currentScore(EGS_Float &s, unsigned short &ncase) const
Sets s to the score of the current event and ncase to the index of the current event.
void finishCase(unsigned short new_case, EGS_Float new_result)
Finish the current 'case' (event) and start a new event with index new_case and a score of new_result...
bool storeState(ostream &data)
Stores the state of the scoring array object into the data stream data.
EGS_I64 current_ncase_65536
A class for scoring a single quantity of interest in a Monte Carlo simulation.
void score(unsigned short ncase, EGS_Float f)
Add f to the score of the ncase'th statistically independent event.
bool storeState(ostream &data)
Stores the state of the scoring object into the data stream data. Returns true on success...
EGS_ScoringSingle & operator+=(const EGS_ScoringSingle &x)
Combine the results of two scoring objects.
unsigned short current_ncase
void reset()
Reset the scoring array to a pristine state.
void currentResult(int ireg, double &r, double &dr)
Sets r to the result in region ireg and dr to its statistical uncertainty.
void score(int ireg, EGS_Float f)
Add f to the score in the element ireg.
Attempts to fix broken math header files.
void reset()
Reset the scoring object to a pristine state (i.e. all counters set to zero).
EGS_Float currentScore() const
Returns the score of the current event.
void currentScore(int ireg, double &s, double &s2)
Sets s and s2 to the sum of scores and sum of scores squared in element ireg.
EGS_ScoringArray & operator+=(const EGS_ScoringArray &x)
Add the results of x to the rtesults of the invoking object.
EGS_Float currentScore(int ireg) const
Returns the score in element ireg from the last statistically indepent event that contributed to ireg...
Defines the EGS_EXPORT and EGS_LOCAL macros.
void currentScore(double &s, double &s2)
Sets s to the sum of scores collected so far and s2 to the sum of scores squared. ...
void currentResult(EGS_I64 ncase, double &r, double &dr)
Sets r to the current result and dr to its statistical uncertainty assuming ncase statistically indep...
bool setState(istream &data)
Set the state of the scoring object from the data stream data.
EGS_Float thisHistoryScore(int ireg) const
Returns the score in ireg in the current event.