Logo ROOT  
Reference Guide
RooAbsBinning.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAbsBinning.h,v 1.13 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_ABS_BINNING
17#define ROO_ABS_BINNING
18
19#include "Rtypes.h"
20#include "RooPrintable.h"
21#include "TNamed.h"
22class TIterator ;
23class RooAbsRealLValue ;
24class RooAbsReal ;
25
26class RooAbsBinning : public TNamed, public RooPrintable {
27public:
28
29 RooAbsBinning(const char* name=0) ;
30 RooAbsBinning(const RooAbsBinning& other, const char* name=0) : TNamed(name,name), RooPrintable(other) {
31 // Copy constructor
32 }
33 TObject* Clone(const char* newname=0) const override { return clone(newname) ; }
34 virtual RooAbsBinning* clone(const char* name=0) const = 0 ;
35 ~RooAbsBinning() override ;
36
37 /// Return number of bins.
38 Int_t numBins() const {
39 return numBoundaries()-1 ;
40 }
41 virtual Int_t numBoundaries() const = 0 ;
42 virtual Int_t binNumber(double x) const = 0 ;
43 virtual Int_t rawBinNumber(double x) const { return binNumber(x) ; }
44 virtual double binCenter(Int_t bin) const = 0 ;
45 virtual double binWidth(Int_t bin) const = 0 ;
46 virtual double binLow(Int_t bin) const = 0 ;
47 virtual double binHigh(Int_t bin) const = 0 ;
48 virtual bool isUniform() const { return false ; }
49
50 virtual void setRange(double xlo, double xhi) = 0 ;
51 /// Change lower bound to xlo.
52 virtual void setMin(double xlo) {
53 setRange(xlo,highBound()) ;
54 }
55 /// Change upper bound to xhi.
56 virtual void setMax(double xhi) {
57 setRange(lowBound(),xhi) ;
58 }
59
60 virtual double lowBound() const = 0 ;
61 virtual double highBound() const = 0 ;
62 virtual double averageBinWidth() const = 0 ;
63
64
65 virtual double* array() const = 0 ;
66
67 inline void Print(Option_t *options= 0) const override {
68 // Printing interface
70 }
71
72 void printName(std::ostream& os) const override ;
73 void printTitle(std::ostream& os) const override ;
74 void printClassName(std::ostream& os) const override ;
75 void printArgs(std::ostream& os) const override ;
76 void printValue(std::ostream& os) const override ;
77
78 /// Interface function. If true, min/max of binning is parameterized by external RooAbsReals.
79 /// Default to `false`, unless overridden by a sub class.
80 virtual bool isParameterized() const {
81 return false ;
82 }
83 /// Return pointer to RooAbsReal parameterized lower bound, if any.
84 virtual RooAbsReal* lowBoundFunc() const {
85 return 0 ;
86 }
87 /// Return pointer to RooAbsReal parameterized upper bound, if any.
88 virtual RooAbsReal* highBoundFunc() const {
89 return 0 ;
90 }
91 /// If true (default), the range definition can be shared across clones of a RooRealVar.
92 virtual bool isShareable() const {
93 return true ;
94 }
95 /// Hook interface function to execute code upon insertion into a RooAbsRealLValue.
96 virtual void insertHook(RooAbsRealLValue&) const { }
97 /// Hook interface function to execute code upon removal from a RooAbsRealLValue.
98 virtual void removeHook(RooAbsRealLValue&) const { }
99
100
101protected:
102
103 ClassDefOverride(RooAbsBinning,2) // Abstract base class for binning specification
104};
105
106#endif
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
char name[80]
Definition: TGX11.cxx:110
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
Definition: RooAbsBinning.h:26
void printTitle(std::ostream &os) const override
Print binning title.
virtual void removeHook(RooAbsRealLValue &) const
Hook interface function to execute code upon removal from a RooAbsRealLValue.
Definition: RooAbsBinning.h:98
virtual RooAbsBinning * clone(const char *name=0) const =0
virtual double binCenter(Int_t bin) const =0
~RooAbsBinning() override
Destructor.
Int_t numBins() const
Return number of bins.
Definition: RooAbsBinning.h:38
void Print(Option_t *options=0) const override
Print TNamed name and title.
Definition: RooAbsBinning.h:67
virtual bool isShareable() const
If true (default), the range definition can be shared across clones of a RooRealVar.
Definition: RooAbsBinning.h:92
RooAbsBinning(const RooAbsBinning &other, const char *name=0)
Definition: RooAbsBinning.h:30
virtual double averageBinWidth() const =0
virtual void insertHook(RooAbsRealLValue &) const
Hook interface function to execute code upon insertion into a RooAbsRealLValue.
Definition: RooAbsBinning.h:96
virtual bool isParameterized() const
Interface function.
Definition: RooAbsBinning.h:80
virtual double binLow(Int_t bin) const =0
virtual bool isUniform() const
Definition: RooAbsBinning.h:48
virtual Int_t rawBinNumber(double x) const
Definition: RooAbsBinning.h:43
virtual double highBound() const =0
virtual void setRange(double xlo, double xhi)=0
virtual void setMin(double xlo)
Change lower bound to xlo.
Definition: RooAbsBinning.h:52
virtual double lowBound() const =0
virtual RooAbsReal * highBoundFunc() const
Return pointer to RooAbsReal parameterized upper bound, if any.
Definition: RooAbsBinning.h:88
virtual double binHigh(Int_t bin) const =0
virtual Int_t numBoundaries() const =0
void printArgs(std::ostream &os) const override
Print binning arguments (the RooAbsReal objects represening the variable bin boundaries for parameter...
TObject * Clone(const char *newname=0) const override
Make a clone of an object using the Streamer facility.
Definition: RooAbsBinning.h:33
virtual double * array() const =0
RooAbsBinning(const char *name=0)
Constructor.
virtual Int_t binNumber(double x) const =0
virtual RooAbsReal * lowBoundFunc() const
Return pointer to RooAbsReal parameterized lower bound, if any.
Definition: RooAbsBinning.h:84
void printClassName(std::ostream &os) const override
Print binning class name.
void printName(std::ostream &os) const override
Print binning name.
virtual double binWidth(Int_t bin) const =0
void printValue(std::ostream &os) const override
Print binning value, i.e the bin boundary positions.
virtual void setMax(double xhi)
Change upper bound to xhi.
Definition: RooAbsBinning.h:56
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:64
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
Definition: RooPrintable.h:25
virtual StyleOption defaultPrintStyle(Option_t *opt) const
virtual Int_t defaultPrintContents(Option_t *opt) const
Default choice of contents to be printed (name and value)
static std::ostream & defaultPrintStream(std::ostream *os=0)
Return a reference to the current default stream to use in Print().
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
Iterator abstract base class.
Definition: TIterator.h:30
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Mother of all ROOT objects.
Definition: TObject.h:37
Double_t x[n]
Definition: legend1.C:17