Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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  Int_t numBins() const {
38  // Return number of bins
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  virtual void setMin(Double_t xlo) {
52  // Change lower bound to xlo
53  setRange(xlo,highBound()) ;
54  }
55  virtual void setMax(Double_t xhi) {
56  // Change upper bound to 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
69  printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
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 
79  virtual Bool_t isParameterized() const {
80  // Interface function. If true, min/max of binning is parameterized by external RooAbsReals
81  return kFALSE ;
82  }
83  virtual RooAbsReal* lowBoundFunc() const {
84  // Return pointer to RooAbsReal parameterized lower bound, if any
85  return 0 ;
86  }
87  virtual RooAbsReal* highBoundFunc() const {
88  // Return pointer to RooAbsReal parameterized upper bound, if any
89  return 0 ;
90  }
91  virtual Bool_t isShareable() const {
92  // If true (default) range definition can be shared across clones of a RooRealVar
93  return kTRUE ;
94  }
95  virtual void insertHook(RooAbsRealLValue&) const {
96  // Hook interface function to execute code upon insertion into a RooAbsRealLValue
97  } ;
98  virtual void removeHook(RooAbsRealLValue&) const {
99  // Hook interface functionto execute code upon removal from a RooAbsRealLValue
100  } ;
101 
102 protected:
103 
104  ClassDef(RooAbsBinning,2) // Abstract base class for binning specification
105 };
106 
107 #endif