Warning, file /include/root/RooLinTransBinning.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROO_LIN_TRANS_BINNING
0017 #define ROO_LIN_TRANS_BINNING
0018
0019 #include "Rtypes.h"
0020 #include "RooAbsBinning.h"
0021
0022 class RooLinTransBinning : public RooAbsBinning {
0023 public:
0024
0025 RooLinTransBinning(const char* name=nullptr) : RooAbsBinning(name) { }
0026 RooLinTransBinning(const RooAbsBinning& input, double slope=1.0, double offset=0.0, const char* name=nullptr);
0027 RooLinTransBinning(const RooLinTransBinning&, const char* name=nullptr);
0028 RooAbsBinning* clone(const char* name=nullptr) const override { return new RooLinTransBinning(*this,name) ; }
0029
0030 Int_t numBoundaries() const override { return _input->numBoundaries() ; }
0031 void binNumbers(double const * x, int * bins, std::size_t n, int coef) const override;
0032 double binCenter(Int_t bin) const override { return trans(_input->binCenter(binTrans(bin))) ; }
0033 double binWidth(Int_t bin) const override { return _slope*_input->binWidth(binTrans(bin)) ; }
0034 double binLow(Int_t bin) const override { if (_slope>0) return trans(_input->binLow(binTrans(bin))) ; else return trans(_input->binHigh(binTrans(bin))) ; }
0035 double binHigh(Int_t bin) const override { if (_slope>0) return trans(_input->binHigh(binTrans(bin))) ; else return trans(_input->binLow(binTrans(bin))) ; }
0036
0037 void setRange(double xlo, double xhi) override ;
0038 void setMin(double xlo) override { setRange(xlo,highBound()) ; }
0039 void setMax(double xhi) override { setRange(lowBound(),xhi) ; }
0040
0041 double lowBound() const override { if (_slope>0) return trans(_input->lowBound()) ; else return trans(_input->highBound()) ; }
0042 double highBound() const override { if (_slope>0) return trans(_input->highBound()) ; else return trans(_input->lowBound()) ; }
0043 double averageBinWidth() const override { return _slope*_input->averageBinWidth() ; }
0044
0045 double* array() const override ;
0046
0047 void updateInput(const RooAbsBinning& input, double slope=1.0, double offset=0.0) ;
0048
0049 protected:
0050
0051 inline Int_t binTrans(Int_t bin) const { if (_slope>0) return bin ; else return numBins()-bin-1 ; }
0052 inline double trans(double x) const { return x*_slope + _offset ; }
0053 inline double invTrans(double x) const { if (_slope==0.0) return 0.0 ; return (x-_offset)/_slope ; }
0054
0055 double _slope{0.};
0056 double _offset{0.};
0057 RooAbsBinning* _input{nullptr};
0058 mutable std::vector<double> _array;
0059
0060 ClassDefOverride(RooLinTransBinning,1)
0061 };
0062
0063 #endif