|
[yoda-svn] r490 - trunk/srcblackhole at projects.hepforge.org blackhole at projects.hepforge.orgWed Jul 4 17:57:49 BST 2012
Author: dgrell Date: Wed Jul 4 17:57:48 2012 New Revision: 490 Log: fixes for unfilled histos Modified: trunk/src/Histo1D.cc trunk/src/WriterYODA.cc Modified: trunk/src/Histo1D.cc ============================================================================== --- trunk/src/Histo1D.cc Wed Jul 4 02:19:45 2012 (r489) +++ trunk/src/Histo1D.cc Wed Jul 4 17:57:48 2012 (r490) @@ -60,6 +60,9 @@ sumwx += b.sumWX(); sumw += b.sumW(); } + if ( sumw == 0 ) { + throw LowStatsError("Requested mean of a Histo1D with no net fill weights"); + } return sumwx/sumw; } Modified: trunk/src/WriterYODA.cc ============================================================================== --- trunk/src/WriterYODA.cc Wed Jul 4 02:19:45 2012 (r489) +++ trunk/src/WriterYODA.cc Wed Jul 4 17:57:48 2012 (r490) @@ -44,7 +44,8 @@ os << "# BEGIN YODA_HISTO1D " << h.path() << "\n"; _writeAnnotations(os, h); - os << "# Mean: " << h.mean() << "\n"; + if ( h.totalDbn().numEntries() > 0 ) + os << "# Mean: " << h.mean() << "\n"; os << "# Area: " << h.integral() << "\n"; os << "# xlow\t xhigh\t sumw\t sumw2\t sumwx\t sumwx2\t numEntries\n"; os << "Total \tTotal \t";
More information about the yoda-svn mailing list |