Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
30 Int_t numBoundaries() const override { return _input->numBoundaries() ; }
31 void binNumbers(double const * x, int * bins, std::size_t n, int coef) const override;
32 double binCenter(Int_t bin) const override { return trans(_input->binCenter(binTrans(bin))) ; }
33 double binWidth(Int_t bin) const override { return _slope*_input->binWidth(binTrans(bin)) ; }
34 double binLow(Int_t bin) const override { if (_slope>0) return trans(_input->binLow(binTrans(bin))) ; else return trans(_input->binHigh(binTrans(bin))) ; }
35 double binHigh(Int_t bin) const override { if (_slope>0) return trans(_input->binHigh(binTrans(bin))) ; else return trans(_input->binLow(binTrans(bin))) ; }
36
37 void setRange(double xlo, double xhi) override ;
38 void setMin(double xlo) override { setRange(xlo,highBound()) ; }
39 void setMax(double xhi) override { setRange(lowBound(),xhi) ; }
40
41 double lowBound() const override { if (_slope>0) return trans(_input->lowBound()) ; else return trans(_input->highBound()) ; }
42 double highBound() const override { if (_slope>0) return trans(_input->highBound()) ; else return trans(_input->lowBound()) ; }
43 double averageBinWidth() const override { return _slope*_input->averageBinWidth() ; }
44
45 double* array() const override ;
46
47 void updateInput(const RooAbsBinning& input, double slope=1.0, double offset=0.0) ;
48
49protected:
50
51 inline Int_t binTrans(Int_t bin) const { if (_slope>0) return bin ; else return numBins()-bin-1 ; }
52 inline double trans(double x) const { return x*_slope + _offset ; }
53 inline double invTrans(double x) const { if (_slope==0.0) return 0.0 ; return (x-_offset)/_slope ; }
54
55 double _slope{0.}; ///< Slope of transformation
56 double _offset{0.}; ///< Offset of transformation
57 RooAbsBinning* _input{nullptr}; ///< Input binning
58 mutable std::vector<double> _array; ///<! Array of transformed bin boundaries
59
60 ClassDefOverride(RooLinTransBinning,1) // Linear transformation of binning specification
61};
62
63#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
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
Abstract base class for RooRealVar binning definitions.
virtual double binCenter(Int_t bin) const =0
Int_t numBins() const
Return number of bins.
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 double binWidth(Int_t bin) const =0
Special binning implementation for RooLinearVar that transforms the binning of the RooLinearVar input...
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.
std::vector< double > _array
! Array of transformed bin boundaries
double binLow(Int_t bin) const override
RooAbsBinning * clone(const char *name=nullptr) const override
double trans(double x) const
double averageBinWidth() const override
void binNumbers(double const *x, int *bins, std::size_t n, int coef) const override
Compute the bin indices for multiple values of x.
double * array() const override
Return array of bin boundaries.
double binCenter(Int_t bin) const override
double binHigh(Int_t bin) const override
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
const Int_t n
Definition legend1.C:16