[Rivet-svn] rivet: Safety check against calling median with empty vector

Rivet Mercurial rivet at projects.hepforge.org
Tue Jul 19 23:45:01 BST 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/06812dddef15
branches:  release-2-5-x
changeset: 5320:06812dddef15
user:      Holger Schulz <holger.schulz at durham.ac.uk>
date:      Tue Jul 19 23:35:08 2016 +0100
description:
Safety check against calling median with empty vector

diffs (12 lines):

--- a/src/Analyses/ATLAS_2010_S8914702.cc	Tue Jul 19 23:28:35 2016 +0100
+++ b/src/Analyses/ATLAS_2010_S8914702.cc	Tue Jul 19 23:35:08 2016 +0100
@@ -80,7 +80,8 @@
       // Now compute the median energy densities
       vector<double> ptDensity;
       for (size_t b = 0; b < _eta_bins_areaoffset.size()-1; ++b) {
-        ptDensity += median(ptDensities[b]);
+        if (ptDensities[b].size() >0 ) ptDensity += median(ptDensities[b]); // TODO move the check into median?
+                                                                            // Maybe check the logic as well
       }
 
       // Now figure out the correction


More information about the Rivet-svn mailing list