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"
22 class TIterator ;
23 class RooAbsRealLValue ;
24 class RooAbsReal ;
25 
26 class RooAbsBinning : public TNamed, public RooPrintable {
27 public:
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 
101 protected:
102 
103  ClassDef(RooAbsBinning,2) // Abstract base class for binning specification
104 };
105 
106 #endif
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooAbsBinning::numBins
Int_t numBins() const
Return number of bins.
Definition: RooAbsBinning.h:38
RooAbsBinning::highBoundFunc
virtual RooAbsReal * highBoundFunc() const
Return pointer to RooAbsReal parameterized upper bound, if any.
Definition: RooAbsBinning.h:88
RooAbsBinning::lowBoundFunc
virtual RooAbsReal * lowBoundFunc() const
Return pointer to RooAbsReal parameterized lower bound, if any.
Definition: RooAbsBinning.h:84
RooAbsBinning::highBound
virtual Double_t highBound() const =0
RooAbsBinning::binWidth
virtual Double_t binWidth(Int_t bin) const =0
RooAbsBinning::binNumber
virtual Int_t binNumber(Double_t x) const =0
RooAbsBinning::insertHook
virtual void insertHook(RooAbsRealLValue &) const
Hook interface function to execute code upon insertion into a RooAbsRealLValue.
Definition: RooAbsBinning.h:96
TNamed.h
RooAbsBinning::averageBinWidth
virtual Double_t averageBinWidth() const =0
RooAbsBinning::printValue
virtual void printValue(std::ostream &os) const
Print binning value, i.e the bin boundary positions.
Definition: RooAbsBinning.cxx:113
RooPrintable.h
x
Double_t x[n]
Definition: legend1.C:17
RooAbsBinning::setMax
virtual void setMax(Double_t xhi)
Change upper bound to xhi.
Definition: RooAbsBinning.h:56
RooAbsReal
Definition: RooAbsReal.h:61
RooPrintable
Definition: RooPrintable.h:25
RooAbsBinning::isShareable
virtual Bool_t isShareable() const
If true (default), the range definition can be shared across clones of a RooRealVar.
Definition: RooAbsBinning.h:92
RooAbsBinning::RooAbsBinning
RooAbsBinning(const RooAbsBinning &other, const char *name=0)
Definition: RooAbsBinning.h:30
bool
TIterator
Definition: TIterator.h:30
RooAbsBinning::array
virtual Double_t * array() const =0
RooAbsBinning::binCenter
virtual Double_t binCenter(Int_t bin) const =0
RooAbsBinning::Print
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooAbsBinning.h:67
RooPrintable::defaultPrintContents
virtual Int_t defaultPrintContents(Option_t *opt) const
Default choice of contents to be printed (name and value)
Definition: RooPrintable.cxx:233
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
RooAbsBinning::isUniform
virtual Bool_t isUniform() const
Definition: RooAbsBinning.h:48
RooPrintable::defaultPrintStream
static std::ostream & defaultPrintStream(std::ostream *os=0)
Return a reference to the current default stream to use in Print().
Definition: RooPrintable.cxx:272
RooAbsBinning::printTitle
virtual void printTitle(std::ostream &os) const
Print binning title.
Definition: RooAbsBinning.cxx:72
TNamed
Definition: TNamed.h:29
RooAbsBinning::binLow
virtual Double_t binLow(Int_t bin) const =0
RooAbsBinning::binHigh
virtual Double_t binHigh(Int_t bin) const =0
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooAbsBinning::printName
virtual void printName(std::ostream &os) const
Print binning name.
Definition: RooAbsBinning.cxx:62
RooAbsBinning
Definition: RooAbsBinning.h:26
RooAbsBinning::Clone
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
Definition: RooAbsBinning.h:33
RooAbsBinning::~RooAbsBinning
virtual ~RooAbsBinning()
Destructor.
Definition: RooAbsBinning.cxx:53
RooAbsBinning::removeHook
virtual void removeHook(RooAbsRealLValue &) const
Hook interface function to execute code upon removal from a RooAbsRealLValue.
Definition: RooAbsBinning.h:98
RooAbsBinning::RooAbsBinning
RooAbsBinning(const char *name=0)
Constructor.
Definition: RooAbsBinning.cxx:44
RooAbsBinning::printClassName
virtual void printClassName(std::ostream &os) const
Print binning class name.
Definition: RooAbsBinning.cxx:82
Double_t
double Double_t
Definition: RtypesCore.h:59
RooAbsBinning::setMin
virtual void setMin(Double_t xlo)
Change lower bound to xlo.
Definition: RooAbsBinning.h:52
RooAbsBinning::clone
virtual RooAbsBinning * clone(const char *name=0) const =0
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooAbsBinning::numBoundaries
virtual Int_t numBoundaries() const =0
name
char name[80]
Definition: TGX11.cxx:110
RooAbsBinning::isParameterized
virtual Bool_t isParameterized() const
Interface function.
Definition: RooAbsBinning.h:80
RooPrintable::printStream
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,...
Definition: RooPrintable.cxx:75
RooAbsBinning::setRange
virtual void setRange(Double_t xlo, Double_t xhi)=0
RooAbsBinning::rawBinNumber
virtual Int_t rawBinNumber(Double_t x) const
Definition: RooAbsBinning.h:43
RooAbsBinning::printArgs
virtual void printArgs(std::ostream &os) const
Print binning arguments (the RooAbsReal objects represening the variable bin boundaries for parameter...
Definition: RooAbsBinning.cxx:93
RooPrintable::defaultPrintStyle
virtual StyleOption defaultPrintStyle(Option_t *opt) const
Definition: RooPrintable.cxx:241
RooAbsRealLValue
Definition: RooAbsRealLValue.h:31
RooAbsBinning::lowBound
virtual Double_t lowBound() const =0
Rtypes.h
int