yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis  1.9.4
Binned.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // This file is part of YODA -- Yet more Objects for Data Analysis
4 // Copyright (C) 2008-2020 The YODA collaboration (see AUTHORS for details)
5 //
6 #ifndef YODA_Binned_h
7 #define YODA_Binned_h
8 
9 #include "YODA/AnalysisObject.h"
10 #include "YODA/Exceptions.h"
11 
12 namespace YODA {
13 
14 
16  class Binned {
17  public:
18 
20 
21 
23  virtual ~Binned() = default;
24 
25 
27 
28 
30  virtual void reset() = 0;
31 
32  // /// Fill histo bin @a i with the given weight, optionally as a fractional fill
33  // virtual void fillBin(size_t i, double weight=1.0, double fraction=1.0) = 0;
34 
35 
38  // /// Merge every group of n bins, starting from the LHS
39  // void rebinBy(unsigned int n, size_t begin=0, size_t end=UINT_MAX) {
40  // _axis.rebinBy(n, begin, end);
41  // }
42  // /// Overloaded alias for rebinBy
43  // void rebin(unsigned int n, size_t begin=0, size_t end=UINT_MAX) {
44  // rebinBy(n, begin, end);
45  // }
46 
47  // /// Rebin to the given list of bin edges
48  // void rebinTo(const std::vector<double>& newedges) {
49  // _axis.rebinTo(newedges);
50  // }
51  // /// Overloaded alias for rebinTo
52  // void rebin(const std::vector<double>& newedges) {
53  // rebinTo(newedges);
54  // }
55 
56 
59 
61  virtual size_t numBins() const = 0;
62 
66  // bool sameBinning(const Binned& bd) {
67  // return _axis == h1._axis;
68  // }
69 
71 
72 
75 
76  // /// Add a new bin specifying its lower and upper bound
77  // void addBin(double from, double to) { _axis.addBin(from, to); }
78 
79  // /// Add new bins by specifying a vector of edges
80  // void addBins(std::vector<double> edges) { _axis.addBins(edges); }
81 
82  // // /// Add new bins specifying a beginning and end of each of them
83  // // void addBins(std::vector<std::pair<double,double> > edges) {
84  // // _axis.addBins(edges);
85  // // }
86 
87  // /// Add a new bin, perhaps already populated: CAREFUL!
88  // void addBin(const HistoBin1D& b) { _axis.addBin(b); }
89 
90  // /// @brief Bins addition operator
91  // ///
92  // /// Add multiple bins without resetting
93  // void addBins(const Bins& bins) {
94  // _axis.addBins(bins);
95  // }
96 
98  virtual void rmBin(size_t index) = 0;
99 
103  // virtual void rmBins(size_t index) = 0;
104 
106  void eraseBin(size_t index) { rmBin(index); }
107 
109 
110  };
111 
112 
113 }
114 
115 #endif
void eraseBin(size_t index)
Definition: Binned.h:106
A base class for all binned objects.
Definition: Binned.h:16
virtual void rmBin(size_t index)=0
Remove a bin.
virtual void reset()=0
Reset.
virtual size_t numBins() const =0
Number of bins (not counting under/overflow)
virtual ~Binned()=default
Virtual destructor for inheritance.