Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 virtual TObject* Clone(const char* newname=0) const { return clone(newname) ; }
34 virtual RooAbsBinning* clone(const char* name=0) const = 0 ;
35 virtual ~RooAbsBinning() ;
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_t x) const = 0 ;
43 virtual Int_t rawBinNumber(Double_t x) const { return binNumber(x) ; }
44 virtual Double_t binCenter(Int_t bin) const = 0 ;
45 virtual Double_t binWidth(Int_t bin) const = 0 ;
46 virtual Double_t binLow(Int_t bin) const = 0 ;
47 virtual Double_t binHigh(Int_t bin) const = 0 ;
48 virtual Bool_t isUniform() const { return kFALSE ; }
49
50 virtual void setRange(Double_t xlo, Double_t xhi) = 0 ;
51 /// Change lower bound to xlo.
52 virtual void setMin(Double_t xlo) {
53 setRange(xlo,highBound()) ;
54 }
55 /// Change upper bound to xhi.
56 virtual void setMax(Double_t xhi) {
57 setRange(lowBound(),xhi) ;
58 }
59
60 virtual Double_t lowBound() const = 0 ;
61 virtual Double_t highBound() const = 0 ;
62 virtual Double_t averageBinWidth() const = 0 ;
63
64
65 virtual Double_t* array() const = 0 ;
66
67 inline virtual void Print(Option_t *options= 0) const {
68 // Printing interface
70 }
71
72 virtual void printName(std::ostream& os) const ;
73 virtual void printTitle(std::ostream& os) const ;
74 virtual void printClassName(std::ostream& os) const ;
75 virtual void printArgs(std::ostream& os) const ;
76 virtual void printValue(std::ostream& os) const ;
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_t isParameterized() const {
81 return kFALSE ;
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_t isShareable() const {
93 return kTRUE ;
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 ClassDef(RooAbsBinning,2) // Abstract base class for binning specification
104};
105
106#endif
const Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
virtual void removeHook(RooAbsRealLValue &) const
Hook interface function to execute code upon removal from a RooAbsRealLValue.
virtual RooAbsBinning * clone(const char *name=0) const =0
virtual Double_t binLow(Int_t bin) const =0
virtual Double_t * array() const =0
Int_t numBins() const
Return number of bins.
virtual Bool_t isShareable() const
If true (default), the range definition can be shared across clones of a RooRealVar.
RooAbsBinning(const RooAbsBinning &other, const char *name=0)
virtual Bool_t isUniform() const
virtual Int_t rawBinNumber(Double_t x) const
virtual void printName(std::ostream &os) const
Print binning name.
virtual ~RooAbsBinning()
Destructor.
virtual void insertHook(RooAbsRealLValue &) const
Hook interface function to execute code upon insertion into a RooAbsRealLValue.
virtual Bool_t isParameterized() const
Interface function.
virtual void printClassName(std::ostream &os) const
Print binning class name.
virtual Double_t binHigh(Int_t bin) const =0
virtual Double_t highBound() const =0
virtual void printArgs(std::ostream &os) const
Print binning arguments (the RooAbsReal objects represening the variable bin boundaries for parameter...
virtual void setMin(Double_t xlo)
Change lower bound to xlo.
virtual void printValue(std::ostream &os) const
Print binning value, i.e the bin boundary positions.
virtual Double_t binCenter(Int_t bin) const =0
virtual RooAbsReal * highBoundFunc() const
Return pointer to RooAbsReal parameterized upper bound, if any.
virtual Int_t numBoundaries() const =0
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
virtual Int_t binNumber(Double_t x) const =0
virtual Double_t lowBound() const =0
virtual void setMax(Double_t xhi)
Change upper bound to xhi.
virtual void printTitle(std::ostream &os) const
Print binning title.
virtual void setRange(Double_t xlo, Double_t xhi)=0
virtual RooAbsReal * lowBoundFunc() const
Return pointer to RooAbsReal parameterized lower bound, if any.
virtual Double_t averageBinWidth() const =0
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
virtual Double_t binWidth(Int_t bin) const =0
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.
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:41
Double_t x[n]
Definition legend1.C:17