File indexing completed on 2025-01-18 10:11:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROO_BINNING
0017 #define ROO_BINNING
0018
0019 #include "Rtypes.h"
0020 #include "RooAbsBinning.h"
0021 #include "RooNumber.h"
0022 #include <vector>
0023 class RooAbsPdf;
0024 class RooRealVar;
0025
0026
0027 class RooBinning : public RooAbsBinning {
0028 public:
0029
0030 RooBinning(double xlo = -RooNumber::infinity(), double xhi = RooNumber::infinity(), const char* name = nullptr);
0031 RooBinning(Int_t nBins, double xlo, double xhi, const char* name = nullptr);
0032 RooBinning(Int_t nBins, const double* boundaries, const char* name = nullptr);
0033 RooBinning(const RooBinning& other, const char* name = nullptr);
0034 RooAbsBinning* clone(const char* name = nullptr) const override { return new RooBinning(*this,name?name:GetName()); }
0035 ~RooBinning() override;
0036
0037
0038 Int_t numBoundaries() const override {
0039 return _nbins+1;
0040 }
0041 void binNumbers(double const * x, int * bins, std::size_t n, int coef) const override;
0042 virtual double nearestBoundary(double x) const;
0043
0044 void setRange(double xlo, double xhi) override;
0045
0046
0047 double lowBound() const override {
0048 return _xlo;
0049 }
0050
0051
0052 double highBound() const override {
0053 return _xhi;
0054 }
0055
0056
0057 double averageBinWidth() const override {
0058 return (highBound() - lowBound()) / numBins();
0059 }
0060 double* array() const override;
0061
0062 double binCenter(Int_t bin) const override;
0063 double binWidth(Int_t bin) const override;
0064 double binLow(Int_t bin) const override;
0065 double binHigh(Int_t bin) const override;
0066
0067 bool addBoundary(double boundary);
0068 void addBoundaryPair(double boundary, double mirrorPoint = 0);
0069 void addUniform(Int_t nBins, double xlo, double xhi);
0070 bool removeBoundary(double boundary);
0071
0072 protected:
0073
0074 bool binEdges(Int_t bin, double& xlo, double& xhi) const;
0075 void updateBinCount();
0076
0077 double _xlo = 0.0;
0078 double _xhi = 0.0;
0079 bool _ownBoundLo = true;
0080 bool _ownBoundHi = true;
0081 Int_t _nbins;
0082
0083 std::vector<double> _boundaries;
0084 mutable double* _array = nullptr;
0085 mutable Int_t _blo = 0.0;
0086
0087 ClassDefOverride(RooBinning,3)
0088 };
0089
0090 #endif