[Rivet-svn] rivet: Intermediate checkin.

Rivet Mercurial rivet at projects.hepforge.org
Tue Oct 25 19:00:01 BST 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/ba2a18ee4a3e
branches:  multiweight
changeset: 5576:ba2a18ee4a3e
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Tue Oct 25 18:57:05 2016 +0100
description:
Intermediate checkin.

diffs (truncated from 182 to 50 lines):

--- a/include/Rivet/Tools/RivetYODA.hh	Tue Oct 25 18:14:17 2016 +0100
+++ b/include/Rivet/Tools/RivetYODA.hh	Tue Oct 25 18:57:05 2016 +0100
@@ -179,6 +179,37 @@
     Fills<T> fills_;
 };
 
+template<>
+class TupleWrapper<YODA::Profile1D> : public YODA::Profile1D {
+public:
+    typedef shared_ptr<TupleWrapper<YODA::Profile1D>> Ptr;
+    TupleWrapper(const YODA::Profile1D & h) : YODA::Profile1D(h) {}
+    // todo: do we need to deal with users using fractions directly?
+    void fill( double x, double y, double weight=1.0, double fraction=1.0 ) {
+        fills_.insert( { {x,y}, weight } );
+    }
+    void reset() { fills_.clear(); }
+    const Fills<YODA::Profile1D> & fills() const { return fills_; }
+private:
+    // x / weight pairs 
+    Fills<YODA::Profile1D> fills_;
+};
+
+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 T>
     class Wrapper : public MultiweightAOPtr {
@@ -307,7 +338,7 @@
     // otherwise the Tuple fakery won't work.
 
     using Histo1DPtr = Wrapper<YODA::Histo1D>;
-    //using Histo2DPtr = Wrapper<YODA::Histo2D>;
+    using Histo2DPtr = Wrapper<YODA::Histo2D>;
     using Profile1DPtr = Wrapper<YODA::Profile1D>;
     using Profile2DPtr = Wrapper<YODA::Profile2D>;
     using CounterPtr = Wrapper<YODA::Counter>;
--- a/src/Tools/RivetYODA.cc	Tue Oct 25 18:14:17 2016 +0100


More information about the Rivet-svn mailing list