[yoda-svn] yoda: catch LowStatsError if writing multiple objects

YODA Mercurial yoda at projects.hepforge.org
Tue Sep 1 12:00:01 BST 2015


details:   https://yoda.hepforge.org/hg/yoda/rev/807c276c811c
branches:  
changeset: 1120:807c276c811c
user:      Peter Richardson <Peter.Richardson at durham.ac.uk>
date:      Tue Sep 01 11:51:19 2015 +0100
description:
catch LowStatsError if writing multiple objects

diffs (39 lines):

--- a/ChangeLog	Fri Aug 28 12:58:06 2015 +0100
+++ b/ChangeLog	Tue Sep 01 11:51:19 2015 +0100
@@ -1,3 +1,8 @@
+2015-08-28  Peter Richardson  <Peter.Richardson at durham.ac.uk>
+
+	* Catch LowStatsError when writing multiple histograms so only the
+	histogram with the problem is not written
+
 2015-08-28  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Version 1.5.0 release.
--- a/include/YODA/Writer.h	Fri Aug 28 12:58:06 2015 +0100
+++ b/include/YODA/Writer.h	Tue Sep 01 11:51:19 2015 +0100
@@ -79,7 +79,14 @@
     void write(std::ostream& stream, const AOITER& begin, const AOITER& end) {
       writeHeader(stream);
       for (AOITER ipao = begin; ipao != end; ++ipao) {
-        writeBody(stream, *ipao);
+	try {
+	  writeBody(stream, *ipao);
+	}
+	catch (const LowStatsError & ex) {
+	  std::cerr << "Not writing out Analysis Object " << (**ipao).title()
+	       << " as caught LowStatsError. The exception was\n "
+		    << ex.what() << "\n";
+	}
       }
       writeFooter(stream);
     }
--- a/src/Dbn1D.cc	Fri Aug 28 12:58:06 2015 +0100
+++ b/src/Dbn1D.cc	Tue Sep 01 11:51:19 2015 +0100
@@ -29,7 +29,6 @@
     const double num = sumWX2()*sumW() - sqr(sumWX());
     const double den = sqr(sumW()) - sumW2();
     if (den==0.) {
-      std::cerr << "testing is this the problem ??? " << num << " " << den << "\n";
       throw WeightError("Undefined weighted variance");
     }
     /// @todo Isn't this sensitive to the overall scale of the weights?


More information about the yoda-svn mailing list