Hack to enable perl totaling of standard deviation statistics.
statistics.hh: same statistics.cc: Hack to enable perl totaling. make FancyDisplay print a total parameter to enable totaling standard deviations for bins after a run is over with perl. currently a total hack. base/statistics.cc: Hack to enable perl totaling. make FancyDisplay print a total parameter to enable totaling standard deviations for bins after a run is over with perl. currently a total hack. base/statistics.hh: same --HG-- extra : convert_revision : c4087a138543e66acee4e395617ce7fd7e458a39
This commit is contained in:
parent
553df008cf
commit
16d0b2f85a
2 changed files with 8 additions and 4 deletions
|
@ -879,14 +879,18 @@ DistDisplay(ostream &stream, const string &name, const string &desc,
|
|||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @todo get rid of the ugly hack **Ignore for total
|
||||
*/
|
||||
void
|
||||
FancyDisplay(ostream &stream, const string &name, const string &desc,
|
||||
int precision, FormatFlags flags, result_t mean,
|
||||
result_t variance)
|
||||
result_t variance, result_t total)
|
||||
{
|
||||
result_t stdev = isnan(variance) ? NAN : sqrt(variance);
|
||||
PrintOne(stream, mean, name + NAMESEP + "mean", desc, precision, flags);
|
||||
PrintOne(stream, stdev, name + NAMESEP + "stdev", desc, precision, flags);
|
||||
PrintOne(stream, total, "**Ignore: " + name + NAMESEP + "TOT", desc, precision, flags);
|
||||
}
|
||||
|
||||
BinBase::BinBase()
|
||||
|
|
|
@ -1309,7 +1309,7 @@ struct DistStor
|
|||
|
||||
void FancyDisplay(std::ostream &stream, const std::string &name,
|
||||
const std::string &desc, int precision, FormatFlags flags,
|
||||
result_t mean, result_t variance);
|
||||
result_t mean, result_t variance, result_t total);
|
||||
|
||||
/**
|
||||
* Templatized storage and interface for a distribution that calculates mean
|
||||
|
@ -1369,16 +1369,16 @@ struct FancyStor
|
|||
result_t mean = NAN;
|
||||
result_t variance = NAN;
|
||||
|
||||
result_t ftot = total;
|
||||
if (total != 0) {
|
||||
result_t fsum = sum;
|
||||
result_t fsq = squares;
|
||||
result_t ftot = total;
|
||||
|
||||
mean = fsum / ftot;
|
||||
variance = (ftot * fsq - (fsum * fsum)) / (ftot * (ftot - 1.0));
|
||||
}
|
||||
|
||||
FancyDisplay(stream, name, desc, precision, flags, mean, variance);
|
||||
FancyDisplay(stream, name, desc, precision, flags, mean, variance, ftot);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue