Logo ROOT   6.10/09
Reference Guide
RooHistPdf.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id$
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_HIST_PDF
17 #define ROO_HIST_PDF
18 
19 #include "RooAbsPdf.h"
20 #include "RooRealProxy.h"
21 #include "RooSetProxy.h"
22 #include "RooAICRegistry.h"
23 
24 class RooRealVar;
25 class RooAbsReal;
26 class RooDataHist ;
27 
28 class RooHistPdf : public RooAbsPdf {
29 public:
30  RooHistPdf() ;
31  RooHistPdf(const char *name, const char *title, const RooArgSet& vars, const RooDataHist& dhist, Int_t intOrder=0);
32  RooHistPdf(const char *name, const char *title, const RooArgList& pdfObs, const RooArgList& histObs, const RooDataHist& dhist, Int_t intOrder=0);
33  RooHistPdf(const RooHistPdf& other, const char* name=0);
34  virtual TObject* clone(const char* newname) const { return new RooHistPdf(*this,newname); }
35  virtual ~RooHistPdf() ;
36 
38  // Return RooDataHist that is represented
39  return *_dataHist ;
40  }
41  const RooDataHist& dataHist() const {
42  // Return RooDataHist that is represented
43  return *_dataHist ;
44  }
45 
47  // Set histogram interpolation order
48  _intOrder = order ;
49  }
51  // Return histogram interpolation order
52  return _intOrder ;
53  }
54 
55  Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=0) const ;
56  Double_t analyticalIntegral(Int_t code, const char* rangeName=0) const ;
57 
58  void setCdfBoundaries(Bool_t flag) {
59  // Set use of special boundary conditions for c.d.f.s
60  _cdfBoundaries = flag ;
61  }
63  // If true, special boundary conditions for c.d.f.s are used
64  return _cdfBoundaries ;
65  }
66 
67  void setUnitNorm(Bool_t flag) {
68  // Declare contents to have unit normalization
69  _unitNorm = flag ;
70  }
71  Bool_t haveUnitNorm() const {
72  // Return true if contents is declared to be unit normalized
73  return _unitNorm ;
74  }
75 
76  virtual Bool_t selfNormalized() const { return _unitNorm ; }
77 
78  virtual Int_t getMaxVal(const RooArgSet& vars) const ;
79  virtual Double_t maxVal(Int_t code) const ;
80 
81  virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const ;
82  virtual std::list<Double_t>* binBoundaries(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const ;
83  virtual Bool_t isBinnedDistribution(const RooArgSet&) const { return _intOrder==0 ; }
84 
85 
86 protected:
87 
88  Bool_t areIdentical(const RooDataHist& dh1, const RooDataHist& dh2) ;
89 
91 
92  Double_t evaluate() const;
93  Double_t totalVolume() const ;
94  friend class RooAbsCachedPdf ;
95  Double_t totVolume() const ;
96 
97  RooArgSet _histObsList ; // List of observables defining dimensions of histogram
98  RooSetProxy _pdfObsList ; // List of observables mapped onto histogram observables
99  RooDataHist* _dataHist ; // Unowned pointer to underlying histogram
102  mutable RooAICRegistry _codeReg ; //! Auxiliary class keeping tracking of analytical integration code
103  Int_t _intOrder ; // Interpolation order
104  Bool_t _cdfBoundaries ; // Use boundary conditions for CDFs.
105  mutable Double_t _totVolume ; //! Total volume of space (product of ranges of observables)
106  Bool_t _unitNorm ; // Assume contents is unit normalized (for use as pdf cache)
107 
108  ClassDef(RooHistPdf,4) // Histogram based PDF
109 };
110 
111 #endif
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Return sampling hint for making curves of (projections) of this function as the recursive division st...
Definition: RooHistPdf.cxx:404
Double_t evaluate() const
Return the current value: The value of the bin enclosing the current coordinates of the observables...
Definition: RooHistPdf.cxx:220
void setInterpolationOrder(Int_t order)
Definition: RooHistPdf.h:46
RooDataHist & dataHist()
Definition: RooHistPdf.h:37
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual ~RooHistPdf()
Destructor.
Definition: RooHistPdf.cxx:205
Iterator abstract base class.
Definition: TIterator.h:30
Double_t totalVolume() const
RooDataSet is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:40
#define ClassDef(name, id)
Definition: Rtypes.h:297
TIterator * _pdfObsIter
Definition: RooHistPdf.h:101
virtual TObject * clone(const char *newname) const
Definition: RooHistPdf.h:34
RooDataHist * _dataHist
Definition: RooHistPdf.h:99
Bool_t getCdfBoundaries() const
Definition: RooHistPdf.h:62
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
RooHistPdf implements a probablity density function sampled from a multidimensional histogram...
Definition: RooHistPdf.h:28
RooHistPdf()
Default constructor coverity[UNINIT_CTOR].
Definition: RooHistPdf.cxx:52
Double_t totVolume() const
Return the total volume spanned by the observables of the RooHistPdf.
Definition: RooHistPdf.cxx:251
Bool_t _unitNorm
Total volume of space (product of ranges of observables)
Definition: RooHistPdf.h:106
Double_t _totVolume
Definition: RooHistPdf.h:105
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Return integral identified by &#39;code&#39;.
Definition: RooHistPdf.cxx:341
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Return sampling hint for making curves of (projections) of this function as the recursive division st...
Definition: RooHistPdf.cxx:462
Bool_t areIdentical(const RooDataHist &dh1, const RooDataHist &dh2)
Definition: RooHistPdf.cxx:531
virtual Bool_t selfNormalized() const
Definition: RooHistPdf.h:76
Bool_t _cdfBoundaries
Definition: RooHistPdf.h:104
Int_t _intOrder
Auxiliary class keeping tracking of analytical integration code.
Definition: RooHistPdf.h:103
RooAICRegistry is a utility class for operator p.d.f classes that keeps track of analytical integrati...
RooAbsCachedPdf is the abstract base class for p.d.f.s that need or want to cache their evaluate() ou...
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Definition: RooHistPdf.h:83
RooAICRegistry _codeReg
Definition: RooHistPdf.h:102
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
const RooDataHist & dataHist() const
Definition: RooHistPdf.h:41
Bool_t haveUnitNorm() const
Definition: RooHistPdf.h:71
virtual Int_t getMaxVal(const RooArgSet &vars) const
Only handle case of maximum in all variables.
Definition: RooHistPdf.cxx:498
Mother of all ROOT objects.
Definition: TObject.h:37
Bool_t importWorkspaceHook(RooWorkspace &ws)
Check if our datahist is already in the workspace.
Definition: RooHistPdf.cxx:548
void setUnitNorm(Bool_t flag)
Definition: RooHistPdf.h:67
RooSetProxy _pdfObsList
Definition: RooHistPdf.h:98
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
void setCdfBoundaries(Bool_t flag)
Definition: RooHistPdf.h:58
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition: RooSetProxy.h:24
RooArgSet _histObsList
Definition: RooHistPdf.h:97
Int_t getInterpolationOrder() const
Definition: RooHistPdf.h:50
virtual Double_t maxVal(Int_t code) const
Return maximum value for set of observables identified by code assigned in getMaxVal.
Definition: RooHistPdf.cxx:512
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Determine integration scenario.
Definition: RooHistPdf.cxx:301
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:42
TIterator * _histObsIter
Definition: RooHistPdf.h:100