[Rivet-svn] rivet: protect against unfilled histo bins

Rivet Mercurial rivet at projects.hepforge.org
Tue Sep 27 17:45:02 BST 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/236d7836e10d
branches:  release-2-5-x
changeset: 5526:236d7836e10d
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Tue Sep 27 17:31:49 2016 +0100
description:
protect against unfilled histo bins

diffs (20 lines):

--- a/bin/make-plots	Tue Sep 27 17:20:59 2016 +0100
+++ b/bin/make-plots	Tue Sep 27 17:31:49 2016 +0100
@@ -1563,11 +1563,13 @@
                     foo += self.data[i].val
                 else:
                     foo += self.data[i].val*(self.data[i].xmax-self.data[i].xmin)
+
             # TODO: change to "in self.data"?
-            for i in range(len(self.data)):
-                self.data[i].val /= foo
-                self.data[i].err[0] /= foo
-                self.data[i].err[1] /= foo
+            if foo != 0:
+                for i in range(len(self.data)):
+                    self.data[i].val /= foo
+                    self.data[i].err[0] /= foo
+                    self.data[i].err[1] /= foo
         scale = self.attr_float('Scale', 1.0)
         if scale != 1.0:
             # TODO: change to "in self.data"?


More information about the Rivet-svn mailing list