[Rivet-svn] rivet: prevent exit in normalize if histogram is empty

Rivet Mercurial rivet at projects.hepforge.org
Fri Jun 29 23:15:01 BST 2018


details:   https://rivet.hepforge.org/hg/rivet/rev/a548f6adb2a0
branches:  release-2-6-x
changeset: 6355:a548f6adb2a0
user:      Christian Gutschow <chris.g at cern.ch>
date:      Fri Jun 29 23:10:50 2018 +0100
description:
prevent exit in normalize if histogram is empty

diffs (24 lines):

--- a/src/Core/Analysis.cc	Fri Jun 29 14:15:08 2018 +0100
+++ b/src/Core/Analysis.cc	Fri Jun 29 23:10:50 2018 +0100
@@ -785,7 +785,9 @@
     }
     MSG_TRACE("Normalizing histo " << histo->path() << " to " << norm);
     try {
-      histo->normalize(norm, includeoverflows);
+      const double hint = histo->integral(includeoverflows);
+      if (hint == 0)  MSG_WARNING("Skipping histo with null area " << histo->path());
+      else            histo->normalize(norm, includeoverflows);
     } catch (YODA::Exception& we) {
       MSG_WARNING("Could not normalize histo " << histo->path());
       return;
@@ -819,7 +821,9 @@
     }
     MSG_TRACE("Normalizing histo " << histo->path() << " to " << norm);
     try {
-      histo->normalize(norm, includeoverflows);
+      const double hint = histo->integral(includeoverflows);
+      if (hint == 0)  MSG_WARNING("Skipping histo with null area " << histo->path());
+      else            histo->normalize(norm, includeoverflows);
     } catch (YODA::Exception& we) {
       MSG_WARNING("Could not normalize histo " << histo->path());
       return;


More information about the Rivet-svn mailing list