[Rivet-svn] rivet: make check works

Rivet Mercurial rivet at projects.hepforge.org
Thu Oct 27 13:00:01 BST 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/0ccf48948e08
branches:  multiweight
changeset: 5591:0ccf48948e08
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Thu Oct 27 12:57:46 2016 +0100
description:
make check works

diffs (truncated from 238 to 50 lines):

--- a/include/Rivet/Tools/RivetYODA.hh	Thu Oct 27 11:51:11 2016 +0100
+++ b/include/Rivet/Tools/RivetYODA.hh	Thu Oct 27 12:57:46 2016 +0100
@@ -24,14 +24,9 @@
 
 namespace YODA {
     typedef std::shared_ptr<YODA::AnalysisObject> AnalysisObjectPtr;
-    typedef std::shared_ptr<YODA::Histo1D> Histo1DPtr;
-    typedef std::shared_ptr<YODA::Histo2D> Histo2DPtr;
-    typedef std::shared_ptr<YODA::Profile1D> Profile1DPtr;
-    typedef std::shared_ptr<YODA::Profile2D> Profile2DPtr;
     typedef std::shared_ptr<YODA::Scatter1D> Scatter1DPtr;
     typedef std::shared_ptr<YODA::Scatter2D> Scatter2DPtr;
     typedef std::shared_ptr<YODA::Scatter3D> Scatter3DPtr;
-    typedef std::shared_ptr<YODA::Counter> CounterPtr;
 }
 
 
@@ -162,12 +157,29 @@
 class TupleWrapper;
 
 template<>
+class TupleWrapper<YODA::Counter> : public YODA::Counter {
+public:
+    typedef shared_ptr<TupleWrapper<YODA::Counter>> Ptr;
+    TupleWrapper(const YODA::Counter & h) : YODA::Counter(h) {}
+    // todo: do we need to deal with users using fractions directly?
+    void fill( double weight=1.0, double fraction=1.0 ) {
+        fills_.insert( {YODA::Counter::FillType(),weight} );
+    }
+    void reset() { fills_.clear(); }
+    const Fills<YODA::Counter> & fills() const { return fills_; }
+private:
+    // x / weight pairs 
+    Fills<YODA::Counter> fills_;
+};
+
+template<>
 class TupleWrapper<YODA::Histo1D> : public YODA::Histo1D {
 public:
     typedef shared_ptr<TupleWrapper<YODA::Histo1D>> Ptr;
     TupleWrapper(const YODA::Histo1D & h) : YODA::Histo1D(h) {}
     // todo: do we need to deal with users using fractions directly?
     void fill( double x, double weight=1.0, double fraction=1.0 ) {
+        if ( std::isnan(x) ) throw YODA::RangeError("X is NaN");
         fills_.insert( { x , weight } );
     }
     void reset() { fills_.clear(); }
@@ -184,6 +196,8 @@
     TupleWrapper(const YODA::Profile1D & h) : YODA::Profile1D(h) {}
     // todo: do we need to deal with users using fractions directly?


More information about the Rivet-svn mailing list