|
[Rivet-svn] rivet: adding TupleWrapper instances for Histo2D and Profile2DRivet Mercurial rivet at projects.hepforge.orgWed Oct 26 10:45:01 BST 2016
details: https://rivet.hepforge.org/hg/rivet/rev/342405dbe71a branches: multiweight changeset: 5577:342405dbe71a user: Chris Pollard <cspollard at gmail.com> date: Wed Oct 26 10:38:13 2016 +0100 description: adding TupleWrapper instances for Histo2D and Profile2D diffs (41 lines): --- a/include/Rivet/Tools/RivetYODA.hh Tue Oct 25 18:57:05 2016 +0100 +++ b/include/Rivet/Tools/RivetYODA.hh Wed Oct 26 10:38:13 2016 +0100 @@ -211,6 +211,38 @@ Fills<YODA::Counter> fills_; }; +template<> +class TupleWrapper<YODA::Histo2D> : public YODA::Histo2D { +public: + typedef shared_ptr<TupleWrapper<YODA::Histo2D>> Ptr; + TupleWrapper(const YODA::Histo2D & h) : YODA::Histo2D(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::Histo2D> & fills() const { return fills_; } +private: + // x / weight pairs + Fills<YODA::Histo2D> fills_; +}; + +template<> +class TupleWrapper<YODA::Profile2D> : public YODA::Profile2D { +public: + typedef shared_ptr<TupleWrapper<YODA::Profile2D>> Ptr; + TupleWrapper(const YODA::Profile2D & h) : YODA::Profile2D(h) {} + // todo: do we need to deal with users using fractions directly? + void fill( double x, double y, double z, double weight=1.0, double fraction=1.0 ) { + fills_.insert( {{x,y,z}, weight} ); + } + void reset() { fills_.clear(); } + const Fills<YODA::Profile2D> & fills() const { return fills_; } +private: + // x / weight pairs + Fills<YODA::Profile2D> fills_; +}; + template <class T> class Wrapper : public MultiweightAOPtr { public:
More information about the Rivet-svn mailing list |