ROOT logo
/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 *    File: $Id: RooParamBinning.h 28285 2009-04-20 14:33:36Z wouter $
 * Authors:                                                                  *
 *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
 *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
 *                                                                           *
 * Copyright (c) 2000-2005, Regents of the University of California          *
 *                          and Stanford University. All rights reserved.    *
 *                                                                           *
 * Redistribution and use in source and binary forms,                        *
 * with or without modification, are permitted according to the terms        *
 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
 *****************************************************************************/
#ifndef ROO_PARAM_BINNING
#define ROO_PARAM_BINNING

#include "Rtypes.h"
#include "RooAbsBinning.h"
#include "RooRealVar.h"
#include "RooListProxy.h"
class TIterator ;

class RooParamBinning : public RooAbsBinning {
public:

  RooParamBinning(const char* name=0) ;
  RooParamBinning(RooAbsReal& xlo, RooAbsReal& xhi, Int_t nBins, const char* name=0) ;
  RooParamBinning(const RooParamBinning& other, const char* name=0) ;
  RooAbsBinning* clone(const char* name=0) const { return new RooParamBinning(*this,name?name:GetName()) ; }
  virtual ~RooParamBinning() ;

  virtual void setRange(Double_t xlo, Double_t xhi) ;

  virtual Int_t numBoundaries() const { return _nbins + 1 ; }
  virtual Int_t binNumber(Double_t x) const  ;

  virtual Double_t lowBound() const { return xlo()->getVal() ; }
  virtual Double_t highBound() const { return xhi()->getVal() ; }

  virtual Double_t binCenter(Int_t bin) const ;
  virtual Double_t binWidth(Int_t bin) const ;
  virtual Double_t binLow(Int_t bin) const ;
  virtual Double_t binHigh(Int_t bin) const ;

  virtual Double_t averageBinWidth() const { return _binw ; }
  virtual Double_t* array() const ;

  void printMultiline(ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const ;

  virtual void insertHook(RooAbsRealLValue&) const  ;
  virtual void removeHook(RooAbsRealLValue&) const  ;

  virtual Bool_t isShareable() const { return kFALSE ; } // parameterized binning cannot be shared across instances
  virtual Bool_t isParameterized() const { return kTRUE ; } // binning is parameterized, range will need special handling in integration
  virtual RooAbsReal* lowBoundFunc() const { return xlo() ; }
  virtual RooAbsReal* highBoundFunc() const { return xhi() ; }

protected:

  mutable Double_t* _array ; //! do not persist
  mutable RooAbsReal* _xlo ; //!
  mutable RooAbsReal* _xhi ; //!
  Int_t    _nbins ;
  Double_t _binw ;
  mutable RooListProxy* _lp ; //
  mutable RooAbsArg* _owner ; //

  RooAbsReal* xlo() const { return _lp ? ((RooAbsReal*)_lp->at(0)) : _xlo ; }
  RooAbsReal* xhi() const { return _lp ? ((RooAbsReal*)_lp->at(1)) : _xhi ; }

  ClassDef(RooParamBinning,2) // Binning specification with ranges parameterized by external RooAbsReal functions
};

#endif
 RooParamBinning.h:1
 RooParamBinning.h:2
 RooParamBinning.h:3
 RooParamBinning.h:4
 RooParamBinning.h:5
 RooParamBinning.h:6
 RooParamBinning.h:7
 RooParamBinning.h:8
 RooParamBinning.h:9
 RooParamBinning.h:10
 RooParamBinning.h:11
 RooParamBinning.h:12
 RooParamBinning.h:13
 RooParamBinning.h:14
 RooParamBinning.h:15
 RooParamBinning.h:16
 RooParamBinning.h:17
 RooParamBinning.h:18
 RooParamBinning.h:19
 RooParamBinning.h:20
 RooParamBinning.h:21
 RooParamBinning.h:22
 RooParamBinning.h:23
 RooParamBinning.h:24
 RooParamBinning.h:25
 RooParamBinning.h:26
 RooParamBinning.h:27
 RooParamBinning.h:28
 RooParamBinning.h:29
 RooParamBinning.h:30
 RooParamBinning.h:31
 RooParamBinning.h:32
 RooParamBinning.h:33
 RooParamBinning.h:34
 RooParamBinning.h:35
 RooParamBinning.h:36
 RooParamBinning.h:37
 RooParamBinning.h:38
 RooParamBinning.h:39
 RooParamBinning.h:40
 RooParamBinning.h:41
 RooParamBinning.h:42
 RooParamBinning.h:43
 RooParamBinning.h:44
 RooParamBinning.h:45
 RooParamBinning.h:46
 RooParamBinning.h:47
 RooParamBinning.h:48
 RooParamBinning.h:49
 RooParamBinning.h:50
 RooParamBinning.h:51
 RooParamBinning.h:52
 RooParamBinning.h:53
 RooParamBinning.h:54
 RooParamBinning.h:55
 RooParamBinning.h:56
 RooParamBinning.h:57
 RooParamBinning.h:58
 RooParamBinning.h:59
 RooParamBinning.h:60
 RooParamBinning.h:61
 RooParamBinning.h:62
 RooParamBinning.h:63
 RooParamBinning.h:64
 RooParamBinning.h:65
 RooParamBinning.h:66
 RooParamBinning.h:67
 RooParamBinning.h:68
 RooParamBinning.h:69
 RooParamBinning.h:70
 RooParamBinning.h:71
 RooParamBinning.h:72
 RooParamBinning.h:73
 RooParamBinning.h:74
 RooParamBinning.h:75
 RooParamBinning.h:76