Logo ROOT  
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 #include <list>
24 
25 class RooRealVar;
26 class RooAbsReal;
27 class RooDataHist ;
28 
29 class RooHistPdf : public RooAbsPdf {
30 public:
31  RooHistPdf() ;
32  RooHistPdf(const char *name, const char *title, const RooArgSet& vars, const RooDataHist& dhist, Int_t intOrder=0);
33  RooHistPdf(const char *name, const char *title, const RooArgList& pdfObs, const RooArgList& histObs, const RooDataHist& dhist, Int_t intOrder=0);
34  RooHistPdf(const RooHistPdf& other, const char* name=0);
35  virtual TObject* clone(const char* newname) const { return new RooHistPdf(*this,newname); }
36  virtual ~RooHistPdf() ;
37 
39  // Return RooDataHist that is represented
40  return *_dataHist ;
41  }
42  const RooDataHist& dataHist() const {
43  // Return RooDataHist that is represented
44  return *_dataHist ;
45  }
46 
48  // Set histogram interpolation order
49  _intOrder = order ;
50  }
52  // Return histogram interpolation order
53  return _intOrder ;
54  }
55 
56  Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=0) const ;
57  Double_t analyticalIntegral(Int_t code, const char* rangeName=0) const ;
58 
59  void setCdfBoundaries(Bool_t flag) {
60  // Set use of special boundary conditions for c.d.f.s
61  _cdfBoundaries = flag ;
62  }
64  // If true, special boundary conditions for c.d.f.s are used
65  return _cdfBoundaries ;
66  }
67 
68  void setUnitNorm(Bool_t flag) {
69  // Declare contents to have unit normalization
70  _unitNorm = flag ;
71  }
72  Bool_t haveUnitNorm() const {
73  // Return true if contents is declared to be unit normalized
74  return _unitNorm ;
75  }
76 
77  virtual Bool_t selfNormalized() const { return _unitNorm ; }
78 
79  virtual Int_t getMaxVal(const RooArgSet& vars) const ;
80  virtual Double_t maxVal(Int_t code) const ;
81 
82  virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const ;
83  virtual std::list<Double_t>* binBoundaries(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const ;
84  virtual Bool_t isBinnedDistribution(const RooArgSet&) const { return _intOrder==0 ; }
85 
86 
87 protected:
88 
89  Bool_t areIdentical(const RooDataHist& dh1, const RooDataHist& dh2) ;
90 
92 
93  Double_t evaluate() const;
95  friend class RooAbsCachedPdf ;
96  Double_t totVolume() const ;
97 
98  RooArgSet _histObsList ; // List of observables defining dimensions of histogram
99  RooSetProxy _pdfObsList ; // List of observables mapped onto histogram observables
100  RooDataHist* _dataHist ; // Unowned pointer to underlying histogram
101  mutable RooAICRegistry _codeReg ; //! Auxiliary class keeping tracking of analytical integration code
102  Int_t _intOrder ; // Interpolation order
103  Bool_t _cdfBoundaries ; // Use boundary conditions for CDFs.
104  mutable Double_t _totVolume ; //! Total volume of space (product of ranges of observables)
105  Bool_t _unitNorm ; // Assume contents is unit normalized (for use as pdf cache)
106 
107  ClassDef(RooHistPdf,4) // Histogram based PDF
108 };
109 
110 #endif
RooHistPdf::selfNormalized
virtual Bool_t selfNormalized() const
Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
Definition: RooHistPdf.h:77
RooHistPdf::_cdfBoundaries
Bool_t _cdfBoundaries
Definition: RooHistPdf.h:103
RooHistPdf::maxVal
virtual Double_t maxVal(Int_t code) const
Return maximum value for set of observables identified by code assigned in getMaxVal.
Definition: RooHistPdf.cxx:497
RooHistPdf::isBinnedDistribution
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
Definition: RooHistPdf.h:84
RooHistPdf::_codeReg
RooAICRegistry _codeReg
Definition: RooHistPdf.h:101
RooHistPdf::getCdfBoundaries
Bool_t getCdfBoundaries() const
Definition: RooHistPdf.h:63
RooHistPdf::totVolume
Double_t totVolume() const
Return the total volume spanned by the observables of the RooHistPdf.
Definition: RooHistPdf.cxx:236
RooHistPdf::getAnalyticalIntegral
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Determine integration scenario.
Definition: RooHistPdf.cxx:285
RooHistPdf::clone
virtual TObject * clone(const char *newname) const
Definition: RooHistPdf.h:35
RooHistPdf::RooHistPdf
RooHistPdf()
Default constructor coverity[UNINIT_CTOR].
Definition: RooHistPdf.cxx:53
RooAICRegistry
RooAICRegistry is a utility class for operator p.d.f classes that keeps track of analytical integrati...
Definition: RooAICRegistry.h:26
RooSetProxy
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition: RooSetProxy.h:23
RooHistPdf::haveUnitNorm
Bool_t haveUnitNorm() const
Definition: RooHistPdf.h:72
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooHistPdf::analyticalIntegral
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Return integral identified by 'code'.
Definition: RooHistPdf.cxx:326
RooHistPdf::setCdfBoundaries
void setCdfBoundaries(Bool_t flag)
Definition: RooHistPdf.h:59
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooSetProxy.h
RooHistPdf::dataHist
RooDataHist & dataHist()
Definition: RooHistPdf.h:38
RooHistPdf::_unitNorm
Bool_t _unitNorm
Total volume of space (product of ranges of observables)
Definition: RooHistPdf.h:105
RooHistPdf::_histObsList
RooArgSet _histObsList
Definition: RooHistPdf.h:98
bool
RooDataHist
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:39
ws
void ws()
Definition: ws.C:66
RooHistPdf::dataHist
const RooDataHist & dataHist() const
Definition: RooHistPdf.h:42
RooAICRegistry.h
RooHistPdf::_intOrder
Int_t _intOrder
Auxiliary class keeping tracking of analytical integration code.
Definition: RooHistPdf.h:102
RooAbsPdf.h
RooHistPdf::getInterpolationOrder
Int_t getInterpolationOrder() const
Definition: RooHistPdf.h:51
RooRealProxy.h
RooHistPdf::totalVolume
Double_t totalVolume() const
RooHistPdf::_dataHist
RooDataHist * _dataHist
Definition: RooHistPdf.h:100
RooHistPdf::_pdfObsList
RooSetProxy _pdfObsList
Definition: RooHistPdf.h:99
RooHistPdf::importWorkspaceHook
Bool_t importWorkspaceHook(RooWorkspace &ws)
Check if our datahist is already in the workspace.
Definition: RooHistPdf.cxx:533
RooHistPdf
RooHistPdf implements a probablity density function sampled from a multidimensional histogram.
Definition: RooHistPdf.h:29
RooAbsCachedPdf
RooAbsCachedPdf is the abstract base class for p.d.f.s that need or want to cache their evaluate() ou...
Definition: RooAbsCachedPdf.h:25
RooWorkspace
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
RooHistPdf::evaluate
Double_t evaluate() const
Return the current value: The value of the bin enclosing the current coordinates of the observables,...
Definition: RooHistPdf.cxx:203
Double_t
double Double_t
Definition: RtypesCore.h:59
RooHistPdf::binBoundaries
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:447
RooHistPdf::setInterpolationOrder
void setInterpolationOrder(Int_t order)
Definition: RooHistPdf.h:47
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooHistPdf::areIdentical
Bool_t areIdentical(const RooDataHist &dh1, const RooDataHist &dh2)
Definition: RooHistPdf.cxx:516
name
char name[80]
Definition: TGX11.cxx:110
RooHistPdf::_totVolume
Double_t _totVolume
Definition: RooHistPdf.h:104
RooHistPdf::plotSamplingHint
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:389
RooAbsPdf
Definition: RooAbsPdf.h:43
RooHistPdf::getMaxVal
virtual Int_t getMaxVal(const RooArgSet &vars) const
Only handle case of maximum in all variables.
Definition: RooHistPdf.cxx:483
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:37
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
RooHistPdf::setUnitNorm
void setUnitNorm(Bool_t flag)
Definition: RooHistPdf.h:68
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
RooHistPdf::~RooHistPdf
virtual ~RooHistPdf()
Destructor.
Definition: RooHistPdf.cxx:189
int