Logo ROOT  
Reference Guide
RooLinTransBinning.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooLinTransBinning.h,v 1.9 2007/05/11 09:11:30 verkerke Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_LIN_TRANS_BINNING
17#define ROO_LIN_TRANS_BINNING
18
19#include "Rtypes.h"
20#include "RooAbsBinning.h"
21
23public:
24
25 RooLinTransBinning(const char* name=nullptr) : RooAbsBinning(name) { }
26 RooLinTransBinning(const RooAbsBinning& input, double slope=1.0, double offset=0.0, const char* name=nullptr);
27 RooLinTransBinning(const RooLinTransBinning&, const char* name=nullptr);
28 RooAbsBinning* clone(const char* name=nullptr) const override { return new RooLinTransBinning(*this,name) ; }
29 ~RooLinTransBinning() override ;
30
31 Int_t numBoundaries() const override { return _input->numBoundaries() ; }
32 Int_t binNumber(double x) const override { return _input->binNumber(invTrans(x)) ; }
33 double binCenter(Int_t bin) const override { return trans(_input->binCenter(binTrans(bin))) ; }
34 double binWidth(Int_t bin) const override { return _slope*_input->binWidth(binTrans(bin)) ; }
35 double binLow(Int_t bin) const override { if (_slope>0) return trans(_input->binLow(binTrans(bin))) ; else return trans(_input->binHigh(binTrans(bin))) ; }
36 double binHigh(Int_t bin) const override { if (_slope>0) return trans(_input->binHigh(binTrans(bin))) ; else return trans(_input->binLow(binTrans(bin))) ; }
37
38 void setRange(double xlo, double xhi) override ;
39 void setMin(double xlo) override { setRange(xlo,highBound()) ; }
40 void setMax(double xhi) override { setRange(lowBound(),xhi) ; }
41
42 double lowBound() const override { if (_slope>0) return trans(_input->lowBound()) ; else return trans(_input->highBound()) ; }
43 double highBound() const override { if (_slope>0) return trans(_input->highBound()) ; else return trans(_input->lowBound()) ; }
44 double averageBinWidth() const override { return _slope*_input->averageBinWidth() ; }
45
46 double* array() const override ;
47
48 void updateInput(const RooAbsBinning& input, double slope=1.0, double offset=0.0) ;
49
50protected:
51
52 inline Int_t binTrans(Int_t bin) const { if (_slope>0) return bin ; else return numBins()-bin-1 ; }
53 inline double trans(double x) const { return x*_slope + _offset ; }
54 inline double invTrans(double x) const { if (_slope==0.0) return 0.0 ; return (x-_offset)/_slope ; }
55
56 double _slope{0.}; ///< Slope of transformation
57 double _offset{0.}; ///< Offset of transformation
58 RooAbsBinning* _input{nullptr}; ///< Input binning
59 mutable double *_array{nullptr}; ///<! Array of transformed bin boundaries
60
61 ClassDefOverride(RooLinTransBinning,1) // Linear transformation of binning specification
62};
63
64#endif
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
char name[80]
Definition: TGX11.cxx:110
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
Definition: RooAbsBinning.h:25
virtual double binCenter(Int_t bin) const =0
Int_t numBins() const
Return number of bins.
Definition: RooAbsBinning.h:37
virtual double averageBinWidth() const =0
virtual double binLow(Int_t bin) const =0
virtual double highBound() const =0
virtual double lowBound() const =0
virtual double binHigh(Int_t bin) const =0
virtual Int_t numBoundaries() const =0
virtual Int_t binNumber(double x) const =0
virtual double binWidth(Int_t bin) const =0
RooLinTransBinning is a special binning implementation for RooLinearVar that transforms the binning o...
RooAbsBinning * _input
Input binning.
void setMin(double xlo) override
Change lower bound to xlo.
void updateInput(const RooAbsBinning &input, double slope=1.0, double offset=0.0)
Update the slope and offset parameters and the pointer to the input binning.
double highBound() const override
double lowBound() const override
Int_t numBoundaries() const override
double binWidth(Int_t bin) const override
void setMax(double xhi) override
Change upper bound to xhi.
Int_t binNumber(double x) const override
double binLow(Int_t bin) const override
RooAbsBinning * clone(const char *name=nullptr) const override
double trans(double x) const
~RooLinTransBinning() override
Destructor.
double averageBinWidth() const override
double * array() const override
Return array of bin boundaries.
double binCenter(Int_t bin) const override
double binHigh(Int_t bin) const override
double * _array
! Array of transformed bin boundaries
void setRange(double xlo, double xhi) override
double _offset
Offset of transformation.
RooLinTransBinning(const char *name=nullptr)
Int_t binTrans(Int_t bin) const
double invTrans(double x) const
double _slope
Slope of transformation.
Double_t x[n]
Definition: legend1.C:17