Logo ROOT  
Reference Guide
RooHistFunc.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_FUNC
17#define ROO_HIST_FUNC
18
19#include "RooAbsReal.h"
20#include "RooRealProxy.h"
21#include "RooSetProxy.h"
22#include "RooAICRegistry.h"
23#include "RooTrace.h"
24#include <list>
25
26class RooRealVar;
27class RooAbsReal;
28class RooDataHist ;
29
30class RooHistFunc : public RooAbsReal {
31public:
32 RooHistFunc() ;
33 RooHistFunc(const char *name, const char *title, const RooArgSet& vars, const RooDataHist& dhist, Int_t intOrder=0);
34 RooHistFunc(const char *name, const char *title, const RooArgList& funcObs, const RooArgList& histObs, const RooDataHist& dhist, Int_t intOrder=0);
35 RooHistFunc(const RooHistFunc& other, const char* name=0);
36 TObject* clone(const char* newname) const override { return new RooHistFunc(*this,newname); }
37 ~RooHistFunc() override ;
38
39 /// Return RooDataHist that is represented.
41 return *_dataHist ;
42 }
43
44 /// Return RooDataHist that is represented.
45 const RooDataHist& dataHist() const {
46 return *_dataHist ;
47 }
48
49 /// Get total bin volume spanned by this hist function.
50 /// In 1-d, this is e.g. the range spanned on the x-axis.
51 double totVolume() const;
52
53 /// Set histogram interpolation order.
55
56 _intOrder = order ;
57 }
58
59 /// Return histogram interpolation order.
61
62 return _intOrder ;
63 }
64
65 Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=0) const override ;
66 double analyticalIntegral(Int_t code, const char* rangeName=0) const override ;
67
68 /// Set use of special boundary conditions for c.d.f.s
69 void setCdfBoundaries(bool flag) {
70 _cdfBoundaries = flag ;
71 }
72
73 /// If true, special boundary conditions for c.d.f.s are used
74 bool getCdfBoundaries() const {
75
76 return _cdfBoundaries ;
77 }
78
79 Int_t getMaxVal(const RooArgSet& vars) const override;
80 double maxVal(Int_t code) const override;
81
82 std::list<double>* binBoundaries(RooAbsRealLValue& /*obs*/, double /*xlo*/, double /*xhi*/) const override ;
83 std::list<double>* plotSamplingHint(RooAbsRealLValue& obs, double xlo, double xhi) const override ;
84 bool isBinnedDistribution(const RooArgSet&) const override { return _intOrder==0 ; }
85 RooArgSet const& getHistObsList() const { return _histObsList; }
86
87
88 Int_t getBin() const;
89 std::vector<Int_t> getBins(RooFit::Detail::DataMap const& dataMap) const;
90
91protected:
92
93 bool importWorkspaceHook(RooWorkspace& ws) override ;
94 bool areIdentical(const RooDataHist& dh1, const RooDataHist& dh2) ;
95
96 double evaluate() const override;
97 void computeBatch(cudaStream_t*, double* output, size_t size, RooFit::Detail::DataMap const&) const override;
98 friend class RooAbsCachedReal ;
99
100 void ioStreamerPass2() override ;
101
102 RooArgSet _histObsList ; ///< List of observables defining dimensions of histogram
103 RooSetProxy _depList ; ///< List of observables mapped onto histogram observables
104 RooDataHist* _dataHist ; ///< Unowned pointer to underlying histogram
105 mutable RooAICRegistry _codeReg ; ///<! Auxiliary class keeping tracking of analytical integration code
106 Int_t _intOrder ; ///< Interpolation order
107 bool _cdfBoundaries ; ///< Use boundary conditions for CDFs.
108 mutable double _totVolume ; ///<! Total volume of space (product of ranges of observables)
109 bool _unitNorm ; ///<! Assume contents is unit normalized (for use as pdf cache)
110
111 ClassDefOverride(RooHistFunc,2) // Histogram based function
112};
113
114#endif
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
char name[80]
Definition: TGX11.cxx:110
RooAICRegistry is a utility class for operator p.d.f classes that keeps track of analytical integrati...
RooAbsCachedReal is the abstract base class for functions that need or want to cache their evaluate()...
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:64
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:45
RooHistFunc implements a real-valued function sampled from a multidimensional histogram.
Definition: RooHistFunc.h:30
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Return sampling hint for making curves of (projections) of this function as the recursive division st...
Int_t getInterpolationOrder() const
Return histogram interpolation order.
Definition: RooHistFunc.h:60
bool _cdfBoundaries
Use boundary conditions for CDFs.
Definition: RooHistFunc.h:107
RooDataHist * _dataHist
Unowned pointer to underlying histogram.
Definition: RooHistFunc.h:104
double _totVolume
! Total volume of space (product of ranges of observables)
Definition: RooHistFunc.h:108
void setCdfBoundaries(bool flag)
Set use of special boundary conditions for c.d.f.s.
Definition: RooHistFunc.h:69
void setInterpolationOrder(Int_t order)
Set histogram interpolation order.
Definition: RooHistFunc.h:54
std::vector< Int_t > getBins(RooFit::Detail::DataMap const &dataMap) const
Compute bin numbers corresponding to all coordinates in evalData.
RooHistFunc()
Default constructor.
Definition: RooHistFunc.cxx:52
~RooHistFunc() override
RooAICRegistry _codeReg
! Auxiliary class keeping tracking of analytical integration code
Definition: RooHistFunc.h:105
void computeBatch(cudaStream_t *, double *output, size_t size, RooFit::Detail::DataMap const &) const override
Base function for computing multiple values of a RooAbsReal.
bool _unitNorm
! Assume contents is unit normalized (for use as pdf cache)
Definition: RooHistFunc.h:109
std::list< double > * binBoundaries(RooAbsRealLValue &, double, double) const override
Return sampling hint for making curves of (projections) of this function as the recursive division st...
void ioStreamerPass2() override
Schema evolution: if histObsList wasn't filled from persistence (v1) then fill it here.
double analyticalIntegral(Int_t code, const char *rangeName=0) const override
Return integral identified by 'code'.
double evaluate() const override
Return the current value: The value of the bin enclosing the current coordinates of the dependents,...
bool getCdfBoundaries() const
If true, special boundary conditions for c.d.f.s are used.
Definition: RooHistFunc.h:74
Int_t getMaxVal(const RooArgSet &vars) const override
Only handle case of maximum in all variables.
double totVolume() const
Get total bin volume spanned by this hist function.
Int_t getBin() const
Compute bin number corresponding to current coordinates.
bool areIdentical(const RooDataHist &dh1, const RooDataHist &dh2)
double maxVal(Int_t code) const override
Return maximum value for set of observables identified by code assigned in getMaxVal.
const RooDataHist & dataHist() const
Return RooDataHist that is represented.
Definition: RooHistFunc.h:45
bool importWorkspaceHook(RooWorkspace &ws) override
Check if our datahist is already in the workspace.
RooArgSet const & getHistObsList() const
Definition: RooHistFunc.h:85
bool isBinnedDistribution(const RooArgSet &) const override
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
Definition: RooHistFunc.h:84
RooDataHist & dataHist()
Return RooDataHist that is represented.
Definition: RooHistFunc.h:40
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const override
Determine integration scenario.
Int_t _intOrder
Interpolation order.
Definition: RooHistFunc.h:106
RooSetProxy _depList
List of observables mapped onto histogram observables.
Definition: RooHistFunc.h:103
RooArgSet _histObsList
List of observables defining dimensions of histogram.
Definition: RooHistFunc.h:102
TObject * clone(const char *newname) const override
Definition: RooHistFunc.h:36
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:40
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
Mother of all ROOT objects.
Definition: TObject.h:37
std::map< DataKey, RooSpan< const double > > DataMap
Definition: DataMap.h:59
static void output()
void ws()
Definition: ws.C:66