[yoda-svn] yoda: Moving the empty histogram check from YODA to Rivet as per...

YODA Mercurial yoda at projects.hepforge.org
Fri Jun 29 22:30:01 BST 2018


details:   https://yoda.hepforge.org/hg/yoda/rev/1cb9c48fc4e5
branches:  release-1-7
changeset: 1470:1cb9c48fc4e5
user:      Christian Gutschow <chris.g at cern.ch>
date:      Fri Jun 29 22:20:04 2018 +0100
description:
Moving the empty histogram check from YODA to Rivet as per Andy's suggestion

diffs (14 lines):

--- a/include/YODA/Histo1D.h	Fri Jun 29 16:28:17 2018 +0100
+++ b/include/YODA/Histo1D.h	Fri Jun 29 22:20:04 2018 +0100
@@ -153,8 +153,9 @@
     /// be less than @a normto. This is probably what you want.
     void normalize(double normto=1.0, bool includeoverflows=true) {
       const double oldintegral = integral(includeoverflows);
-      if (oldintegral == 0) std::cerr << "Attempted to normalize a histogram with null area" << std::endl;
-      else                  scaleW(normto / oldintegral);
+      if (oldintegral == 0) throw WeightError("Attempted to normalize a histogram with null area");
+      /// @todo Check that this is the desired behaviour
+      scaleW(normto / oldintegral);
     }
 
 


More information about the yoda-svn mailing list