|
[yoda-svn] yoda: Fix cut & paste typo, and add LowStatsError catching in Pr...YODA Mercurial yoda at projects.hepforge.orgWed Aug 12 23:00:02 BST 2015
details: https://yoda.hepforge.org/hg/yoda/rev/1a56ca393652 branches: changeset: 1110:1a56ca393652 user: Andy Buckley <andy at insectnation.org> date: Wed Aug 12 22:55:43 2015 +0100 description: Fix cut & paste typo, and add LowStatsError catching in Profile division. diffs (truncated from 109 to 50 lines): --- a/ChangeLog Tue Aug 11 01:35:55 2015 +0100 +++ b/ChangeLog Wed Aug 12 22:55:43 2015 +0100 @@ -1,3 +1,7 @@ +2015-08-12 Andy Buckley <andy.buckley at cern.ch> + + * Fix cut & paste typo, and add LowStatsError catching in Profile division. + 2015-08-11 Andy Buckley <andy.buckley at cern.ch> * Replace old Spirit-based ReaderYODA with the new hand-rolled one. --- a/src/Histo1D.cc Tue Aug 11 01:35:55 2015 +0100 +++ b/src/Histo1D.cc Wed Aug 12 22:55:43 2015 +0100 @@ -169,10 +169,10 @@ const double explus = b1.xMax() - x; // Assemble the y value and error + /// @todo Provide optional alt behaviours to fill with NaN or remove the invalid point or throw double y = 0; double ey = 0; if (b2.height() == 0 || (b1.height() == 0 && b1.heightErr() != 0)) { ///< @todo Ok? - /// @todo Provide optional alt behaviours to fill with NaN or remove the invalid point or throw /// @todo Don't throw here: set a flag and throw after all bins have been handled. // throw LowStatsError("Requested division of empty bin"); } else { --- a/src/Profile1D.cc Tue Aug 11 01:35:55 2015 +0100 +++ b/src/Profile1D.cc Wed Aug 12 22:55:43 2015 +0100 @@ -170,18 +170,23 @@ const double explus = b1.xMax() - x; // Assemble the y value and error + /// @todo Provide optional alt behaviours to fill with NaN or remove the invalid point or throw double y = 0; double ey = 0; - if (b2.mean() == 0 || (b1.mean() == 0 && b1.stdErr() != 0)) { ///< @todo Ok? - /// @todo Provide optional alt behaviours to fill with NaN or remove the invalid point or throw - /// @todo Don't throw here: set a flag and throw after all bins have been handled. - // throw LowStatsError("Requested division of empty bin"); - } else { - y = b1.mean() / b2.mean(); - /// @todo Is this the exact error treatment for all (uncorrelated) cases? Behaviour around 0? +1 and -1 fills? - const double relerr_1 = b1.stdErr() != 0 ? b1.stdErr()/b1.mean() : 0; - const double relerr_2 = b2.stdErr() != 0 ? b1.stdErr()/b1.mean() : 0; - ey = y * sqrt(sqr(relerr_1) + sqr(relerr_2)); + try { + if (b2.mean() == 0 || (b1.mean() == 0 && b1.stdErr() != 0)) { ///< @todo Ok? + /// @todo Don't throw here: set a flag and throw after all bins have been handled. + // throw LowStatsError("Requested division by zero-valued bin"); + } else { + y = b1.mean() / b2.mean(); + /// @todo Is this the exact error treatment for all (uncorrelated) cases? Behaviour around 0? +1 and -1 fills?
More information about the yoda-svn mailing list |