Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooHistPdf.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofit:$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
17/**
18\file RooHistPdf.cxx
19\class RooHistPdf
20\ingroup Roofitcore
21
22A probability density function sampled from a
23multidimensional histogram. The histogram distribution is explicitly
24normalized by RooHistPdf and can have an arbitrary number of real or
25discrete dimensions.
26**/
27
28#include "Riostream.h"
29
30#include "RooCategory.h"
31#include "RooCurve.h"
32#include "RooDataHist.h"
33#include "RooFitImplHelpers.h"
34#include "RooGlobalFunc.h"
35#include "RooHistPdf.h"
36#include "RooMsgService.h"
37#include "RooRealVar.h"
38#include "RooUniformBinning.h"
39#include "RooWorkspace.h"
40
41#include "TError.h"
42#include "TBuffer.h"
43
44
45
46
47////////////////////////////////////////////////////////////////////////////////
48/// Constructor from a RooDataHist. RooDataHist dimensions
49/// can be either real or discrete. See RooDataHist::RooDataHist for details on the binning.
50/// RooHistPdf neither owns or clone 'dhist' and the user must ensure the input histogram exists
51/// for the entire life span of this PDF.
52
53RooHistPdf::RooHistPdf(const char *name, const char *title, const RooArgSet& vars,
55 RooAbsPdf(name,title),
56 _pdfObsList("pdfObs","List of p.d.f. observables",this),
57 _dataHist(const_cast<RooDataHist*>(&dhist)),
58 _codeReg(10),
59 _intOrder(intOrder)
60{
62 _pdfObsList.add(vars) ;
63
64 // Verify that vars and dhist.get() have identical contents
65 const RooArgSet* dvars = dhist.get() ;
66 if (vars.size()!=dvars->size()) {
67 coutE(InputArguments) << "RooHistPdf::ctor(" << GetName()
68 << ") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
69 assert(0) ;
70 }
71 for (const auto arg : vars) {
72 if (!dvars->find(arg->GetName())) {
73 coutE(InputArguments) << "RooHistPdf::ctor(" << GetName()
74 << ") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
75 assert(0) ;
76 }
77 }
78
79
80 // Adjust ranges of _histObsList to those of _dataHist
81 for (const auto hobs : _histObsList) {
82 // Guaranteed to succeed, since checked above in constructor
83 RooAbsArg* dhobs = dhist.get()->find(hobs->GetName()) ;
84 RooRealVar* dhreal = dynamic_cast<RooRealVar*>(dhobs) ;
85 if (dhreal){
86 (static_cast<RooRealVar*>(hobs))->setRange(dhreal->getMin(),dhreal->getMax()) ;
87 }
88 }
89
90}
91
92
93
94
95////////////////////////////////////////////////////////////////////////////////
96/// Constructor from a RooDataHist. The first list of observables are the p.d.f.
97/// observables, which may any RooAbsReal (function or variable). The second list
98/// are the corresponding observables in the RooDataHist which must be of type
99/// RooRealVar or RooCategory This constructor thus allows to apply a coordinate transformation
100/// on the histogram data to be applied.
101
102RooHistPdf::RooHistPdf(const char *name, const char *title, const RooArgList& pdfObs,
104 RooAbsPdf(name,title),
105 _pdfObsList("pdfObs","List of p.d.f. observables",this),
106 _dataHist(const_cast<RooDataHist*>(&dhist)),
107 _codeReg(10),
108 _intOrder(intOrder)
109{
112
113 // Verify that vars and dhist.get() have identical contents
114 const RooArgSet* dvars = dhist.get() ;
115 if (histObs.size()!=dvars->size()) {
116 coutE(InputArguments) << "RooHistPdf::ctor(" << GetName()
117 << ") ERROR histogram variable list and RooDataHist must contain the same variables." << std::endl ;
118 throw(std::string("RooHistPdf::ctor() ERROR: histogram variable list and RooDataHist must contain the same variables")) ;
119 }
120
121 for (const auto arg : histObs) {
122 if (!dvars->find(arg->GetName())) {
123 coutE(InputArguments) << "RooHistPdf::ctor(" << GetName()
124 << ") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
125 throw(std::string("RooHistPdf::ctor() ERROR: histogram variable list and RooDataHist must contain the same variables")) ;
126 }
127 if (!arg->isFundamental()) {
128 coutE(InputArguments) << "RooHistPdf::ctor(" << GetName()
129 << ") ERROR all elements of histogram observables set must be of type RooRealVar or RooCategory." << std::endl ;
130 throw(std::string("RooHistPdf::ctor() ERROR all elements of histogram observables set must be of type RooRealVar or RooCategory.")) ;
131 }
132 }
133
134
135 // Adjust ranges of _histObsList to those of _dataHist
136 for (const auto hobs : _histObsList) {
137 // Guaranteed to succeed, since checked above in constructor
138 RooAbsArg* dhobs = dhist.get()->find(hobs->GetName()) ;
139 RooRealVar* dhreal = dynamic_cast<RooRealVar*>(dhobs) ;
140 if (dhreal){
141 (static_cast<RooRealVar*>(hobs))->setRange(dhreal->getMin(),dhreal->getMax()) ;
142 }
143 }
144}
145
146RooHistPdf::RooHistPdf(const char *name, const char *title, const RooArgSet &vars, std::unique_ptr<RooDataHist> dhist,
147 int intOrder)
148 : RooHistPdf{name, title, vars, *dhist, intOrder}
149{
150 initializeOwnedDataHist(std::move(dhist));
151}
152RooHistPdf::RooHistPdf(const char *name, const char *title, const RooArgList &pdfObs, const RooArgList &histObs,
153 std::unique_ptr<RooDataHist> dhist, int intOrder)
155{
156 initializeOwnedDataHist(std::move(dhist));
157}
158
159
160////////////////////////////////////////////////////////////////////////////////
161/// Copy constructor
162
165 _pdfObsList("pdfObs",this,other._pdfObsList),
166 _dataHist(other._dataHist),
167 _codeReg(other._codeReg),
168 _intOrder(other._intOrder),
169 _cdfBoundaries(other._cdfBoundaries),
170 _totVolume(other._totVolume),
171 _unitNorm(other._unitNorm)
172{
173 _histObsList.addClone(other._histObsList) ;
174}
175
177 if (_ownedDataHist) return _ownedDataHist.get();
178 _ownedDataHist.reset(static_cast<RooDataHist*>(_dataHist->Clone(newname)));
180 return _dataHist;
181}
182
184{
185 std::span<double> output = ctx.output();
186
187 // For interpolation and histograms of higher dimension, use base function
188 if (_pdfObsList.size() > 1) {
190 return;
191 }
192
193 auto xVals = ctx.at(_pdfObsList[0]);
195 for (auto &ret : output) {
196 ret = std::max(ret, 0.0);
197 }
198}
199
200
201////////////////////////////////////////////////////////////////////////////////
202/// Return the current value: The value of the bin enclosing the current coordinates
203/// of the observables, normalized by the histograms contents. Interpolation
204/// is applied if the RooHistPdf is configured to do that.
205
207{
208 // Transfer values from
209 for (unsigned int i=0; i < _pdfObsList.size(); ++i) {
212
213 if (harg != parg) {
214 parg->syncCache() ;
215 harg->copyCache(parg,true) ;
216 if (!harg->inRange(nullptr)) {
217 return 0 ;
218 }
219 }
220 }
221
223
224 return std::max(ret, 0.0);
225}
226
227////////////////////////////////////////////////////////////////////////////////
228/// Return the total volume spanned by the observables of the RooHistPdf
229
231{
232 // Return previously calculated value, if any
233 if (_totVolume>0) {
234 return _totVolume ;
235 }
236 _totVolume = 1. ;
237
238 for (const auto arg : _histObsList) {
239 RooRealVar* real = dynamic_cast<RooRealVar*>(arg) ;
240 if (real) {
241 _totVolume *= (real->getMax()-real->getMin()) ;
242 } else {
243 RooCategory* cat = dynamic_cast<RooCategory*>(arg) ;
244 if (cat) {
245 _totVolume *= cat->numTypes() ;
246 }
247 }
248 }
249
250 return _totVolume ;
251}
252
253namespace {
254
255bool fullRange(const RooAbsArg& x, const RooAbsArg& y ,const char* range)
256{
257 const RooAbsRealLValue *_x = dynamic_cast<const RooAbsRealLValue*>(&x);
258 const RooAbsRealLValue *_y = dynamic_cast<const RooAbsRealLValue*>(&y);
259 if (!_x || !_y) return false;
260 if (!range || !strlen(range) || !_x->hasRange(range) ||
261 _x->getBinningPtr(range)->isParameterized()) {
262 // parameterized ranges may be full range now, but that might change,
263 // so return false
264 if (range && strlen(range) && _x->getBinningPtr(range)->isParameterized())
265 return false;
266 return (_x->getMin() == _y->getMin() && _x->getMax() == _y->getMax());
267 }
268 return (_x->getMin(range) == _y->getMin() && _x->getMax(range) == _y->getMax());
269}
270
271bool okayForAnalytical(RooAbsArg const& obs, RooArgSet const& allVars)
272{
273 auto lobs = dynamic_cast<RooAbsRealLValue const*>(&obs);
274 if(lobs == nullptr) return false;
275
276 bool isOkayForAnalyticalInt = false;
277
278 for(RooAbsArg *var : allVars) {
279 if(obs.dependsOn(*var)) {
280 if(!lobs->isJacobianOK(*var)) return false;
282 }
283 }
284
286}
287
288} // namespace
289
290
293 const char* rangeName,
294 RooArgSet const& histObsList,
295 RooArgSet const& pdfObsList,
297{
298 // First make list of pdf observables to histogram observables
299 // and select only those for which the integral is over the full range
300
301 Int_t code = 0;
302 Int_t frcode = 0;
303 bool directSubRange = false;
304 for (unsigned int n=0; n < pdfObsList.size() && n < histObsList.size(); ++n) {
305 const auto pa = pdfObsList[n];
306 const auto ha = histObsList[n];
307
308 if (okayForAnalytical(*pa, allVars)) {
309 code |= 2 << n;
310 analVars.add(*pa);
311 if (fullRange(*pa, *ha, rangeName)) {
312 frcode |= 2 << n;
313 } else if (pa->isFundamental()) {
314 // Sub-range integral over the histogram observable itself (no transform).
315 directSubRange = true;
316 }
317 }
318 }
319
320 if (code == frcode) {
321 // integrate over full range of all observables - use bit 0 to indicate
322 // full range integration over all observables
323 code |= 1;
324 }
325
326 // the full range. For interpolated histograms (intOrder > 0), fall back to
327 // numerical integration over a direct sub-range of the histogram observable.
328 // A derived (non-fundamental) observable, such as a linear transform used to
329 // renormalize the components of a RooMomentMorphFuncND, keeps the analytical
330 // path it relies on.
331 if (intOrder > 0 && directSubRange) {
332 analVars.removeAll();
333 return 0;
334 }
335 return (code >= 2) ? code : 0;
336}
337
338
340 const char* rangeName,
341 RooArgSet const& histObsList,
342 RooArgSet const& pdfObsList,
343 RooDataHist& dataHist,
344 bool histFuncMode) {
345 // Simplest scenario, full-range integration over all dependents
346 if (((2 << histObsList.size()) - 1) == code) {
347 return dataHist.sum(histFuncMode);
348 }
349
350 // Partial integration scenario, retrieve set of variables, calculate partial
351 // sum, figure out integration ranges (if needed)
353 std::map<const RooAbsArg*, std::pair<double, double> > ranges;
354 for (unsigned int n=0; n < pdfObsList.size() && n < histObsList.size(); ++n) {
355 const auto pa = pdfObsList[n];
356 const auto ha = histObsList[n];
357
358 if (code & (2 << n)) {
359 intSet.add(*ha);
360 }
361 if (!(code & 1)) {
363 }
364 // WVE must sync hist slice list values to pdf slice list
365 // Transfer values from
366 if (ha != pa) {
367 pa->syncCache();
368 ha->copyCache(pa,true);
369 }
370 }
371
372 double ret = (code & 1) ? dataHist.sum(intSet,histObsList,true,!histFuncMode) :
374
375 return ret ;
376}
377
378////////////////////////////////////////////////////////////////////////////////
379/// Determine integration scenario. If no interpolation is used,
380/// RooHistPdf can perform all integrals over its dependents
381/// analytically via partial or complete summation of the input
382/// histogram. If interpolation is used on the integral over
383/// all histogram observables is supported
384
389
390
391////////////////////////////////////////////////////////////////////////////////
392/// Return integral identified by 'code'. The actual integration
393/// is deferred to RooDataHist::sum() which implements partial
394/// or complete summation over the histograms contents.
395
396double RooHistPdf::analyticalIntegral(Int_t code, const char* rangeName) const
397{
399}
400
401
403{
404 bool isOkayForAnalyticalInt = false;
405
406 for (RooAbsArg * obs : pdfObsList) {
407 if(obs->dependsOn(dep)) {
408 // If the observable doesn't depend linearly on the integration
409 // variable we will not do analytical integration.
410 auto lvalue = dynamic_cast<RooAbsRealLValue const*>(obs);
411 if(!(lvalue && lvalue->isJacobianOK(dep))) return false;
413 }
414 }
415
417}
418
419
424
425
426////////////////////////////////////////////////////////////////////////////////
427/// Return sampling hint for making curves of (projections) of this function
428/// as the recursive division strategy of RooCurve cannot deal efficiently
429/// with the vertical lines that occur in a non-interpolated histogram
430
431std::list<double>* RooHistPdf::plotSamplingHint(RooAbsRealLValue& obs, double xlo, double xhi) const
432{
434}
435
436
437std::list<double>* RooHistPdf::plotSamplingHint(RooDataHist const& dataHist,
438 RooArgSet const& pdfObsList,
439 RooArgSet const& histObsList,
440 int intOrder,
441 RooAbsRealLValue& obs,
442 double xlo,
443 double xhi)
444{
445 // No hints are required when interpolation is used
446 if (intOrder>0) {
447 return nullptr;
448 }
449
450 // Check that observable is in dataset, if not no hint is generated
451 RooAbsArg* dhObs = nullptr;
452 for (unsigned int i=0; i < pdfObsList.size(); ++i) {
455 if (std::string(obs.GetName())==pdfObs->GetName()) {
456 dhObs = dataHist.get()->find(histObs->GetName()) ;
457 break;
458 }
459 }
460
461 if (!dhObs) {
462 return nullptr;
463 }
464 RooAbsLValue* lval = dynamic_cast<RooAbsLValue*>(dhObs) ;
465 if (!lval) {
466 return nullptr;
467 }
468
469 // Retrieve position of all bin boundaries
470
471 const RooAbsBinning* binning = lval->getBinningPtr(nullptr);
472 std::span<const double> boundaries{binning->array(), static_cast<std::size_t>(binning->numBoundaries())};
473
474 // Use the helper function from RooCurve to make sure to get sampling hints
475 // that work with the RooFitPlotting.
476 return RooCurve::plotSamplingHintForBinBoundaries(boundaries, xlo, xhi);
477}
478
479
480////////////////////////////////////////////////////////////////////////////////
481/// Return sampling hint for making curves of (projections) of this function
482/// as the recursive division strategy of RooCurve cannot deal efficiently
483/// with the vertical lines that occur in a non-interpolated histogram
484
485std::list<double>* RooHistPdf::binBoundaries(RooAbsRealLValue& obs, double xlo, double xhi) const
486{
487 // No hints are required when interpolation is used
488 if (_intOrder>0) {
489 return nullptr;
490 }
491
492 // Check that observable is in dataset, if not no hint is generated
493 RooAbsLValue* lvarg = dynamic_cast<RooAbsLValue*>(_dataHist->get()->find(obs.GetName())) ;
494 if (!lvarg) {
495 return nullptr ;
496 }
497
498 // Retrieve position of all bin boundaries
499 const RooAbsBinning* binning = lvarg->getBinningPtr(nullptr);
500 double* boundaries = binning->array() ;
501
502 auto hint = new std::list<double> ;
503
504 // Construct array with pairs of points positioned epsilon to the left and
505 // right of the bin boundaries
506 for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
507 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
508 hint->push_back(boundaries[i]) ;
509 }
510 }
511
512 return hint ;
513}
514
515
516
517
518////////////////////////////////////////////////////////////////////////////////
519/// Only handle case of maximum in all variables
520
522{
523 std::unique_ptr<RooAbsCollection> common{_pdfObsList.selectCommon(vars)};
524 if (common->size()==_pdfObsList.size()) {
525 return 1;
526 }
527 return 0 ;
528}
529
530
531////////////////////////////////////////////////////////////////////////////////
532
533double RooHistPdf::maxVal(Int_t code) const
534{
535 R__ASSERT(code==1) ;
536
537 double max(-1) ;
538 for (Int_t i=0 ; i<_dataHist->numEntries() ; i++) {
539 double wgt = _dataHist->weight(i) ;
540 if (wgt>max) max=wgt ;
541 }
542
543 return max*1.05 ;
544}
545
546
547
548
549////////////////////////////////////////////////////////////////////////////////
550
552{
553 if (std::abs(dh1.sumEntries()-dh2.sumEntries())>1e-8) return false ;
554 if (dh1.numEntries() != dh2.numEntries()) return false ;
555 for (int i=0 ; i < dh1.numEntries() ; i++) {
556 if (std::abs(dh1.weight(i)-dh2.weight(i))>1e-8) return false ;
557 }
558 return true ;
559}
560
561
562
563////////////////////////////////////////////////////////////////////////////////
564/// Check if our datahist is already in the workspace
565
567{
568 for(auto const& data : ws.allData()) {
569 // If your dataset is already in this workspace nothing needs to be done
570 if (data == _dataHist) {
571 return false ;
572 }
573 }
574
575 // Check if dataset with given name already exists
577
578 // Yes it exists - now check if it is identical to our internal histogram
579 if (wsdata->InheritsFrom(RooDataHist::Class())) {
580
581 // Check if histograms are identical
582 if (areIdentical(static_cast<RooDataHist&>(*wsdata),*_dataHist)) {
583
584 // Exists and is of correct type, and identical -- adjust internal pointer to WS copy
585 _dataHist = static_cast<RooDataHist*>(wsdata) ;
586 } else {
587
588 // not identical, clone rename and import
589 auto uniqueName = std::string(_dataHist->GetName()) + "_" + GetName();
591 if (flag) {
592 coutE(ObjectHandling) << " RooHistPdf::importWorkspaceHook(" << GetName() << ") unable to import clone of underlying RooDataHist with unique name " << uniqueName << ", abort" << std::endl ;
593 return true ;
594 }
595 _dataHist = static_cast<RooDataHist*>(ws.embeddedData(uniqueName)) ;
596 }
597
598 } else {
599
600 // Exists and is NOT of correct type: clone rename and import
601 auto uniqueName = std::string(_dataHist->GetName()) + "_" + GetName();
603 if (flag) {
604 coutE(ObjectHandling) << " RooHistPdf::importWorkspaceHook(" << GetName() << ") unable to import clone of underlying RooDataHist with unique name " << uniqueName << ", abort" << std::endl ;
605 return true ;
606 }
607 _dataHist = static_cast<RooDataHist*>(ws.embeddedData(uniqueName));
608
609 }
610 return false ;
611 }
612
613 // We need to import our datahist into the workspace
615
616 // Redirect our internal pointer to the copy in the workspace
617 _dataHist = static_cast<RooDataHist*>(ws.embeddedData(_dataHist->GetName())) ;
618 return false ;
619}
620
621
622////////////////////////////////////////////////////////////////////////////////
623/// Stream an object of class RooHistPdf.
624
626{
627 if (R__b.IsReading()) {
628 R__b.ReadClassBuffer(RooHistPdf::Class(),this);
629 // WVE - interim solution - fix proxies here
630 //_proxyList.Clear() ;
631 //registerProxy(_pdfObsList) ;
632 } else {
633 R__b.WriteClassBuffer(RooHistPdf::Class(),this);
634 }
635}
#define e(i)
Definition RSha256.hxx:103
#define coutE(a)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
char name[80]
Definition TGX11.cxx:145
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:76
bool dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=nullptr, bool valueOnly=false) const
Test whether we depend on (ie, are served by) any object in the specified collection.
friend void RooRefArray::Streamer(TBuffer &)
Abstract base class for RooRealVar binning definitions.
virtual Int_t numBoundaries() const =0
virtual double * array() const =0
Int_t numTypes(const char *=nullptr) const
Return number of types defined (in range named rangeName if rangeName!=nullptr)
Storage_t::size_type size() const
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:56
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Abstract base class for objects that are lvalues, i.e.
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:32
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
const RooAbsBinning * getBinningPtr(const char *rangeName) const override
bool hasRange(const char *name) const override
Check if variable has a binning with given name.
virtual void doEval(RooFit::EvalContext &) const
Base function for computing multiple values of a RooAbsReal.
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:24
RooArgSet * selectCommon(const RooAbsCollection &refColl) const
Use RooAbsCollection::selecCommon(), but return as RooArgSet.
Definition RooArgSet.h:154
Object to represent discrete states.
Definition RooCategory.h:28
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
static std::list< double > * plotSamplingHintForBinBoundaries(std::span< const double > boundaries, double xlo, double xhi)
Returns sampling hints for a histogram with given boundaries.
Definition RooCurve.cxx:897
Container class to hold N-dimensional binned data.
Definition RooDataHist.h:40
double sum(bool correctForBinSize, bool inverseCorr=false) const
Return the sum of the weights of all bins in the histogram.
void weights(double *output, std::span< double const > xVals, int intOrder, bool correctForBinSize, bool cdfBoundaries)
A vectorized version of RooDataHist::weight() for one dimensional histograms with up to one dimension...
static TClass * Class()
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
Definition RooDataHist.h:61
double weight(std::size_t i) const
Return weight of i-th bin.
double weightFast(const RooArgSet &bin, int intOrder, bool correctForBinSize, bool cdfBoundaries)
A faster version of RooDataHist::weight that assumes the passed arguments are aligned with the histog...
const RooArgSet * get() const override
Get bin centre of current bin.
Definition RooDataHist.h:82
std::span< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
std::span< double > output()
A probability density function sampled from a multidimensional histogram.
Definition RooHistPdf.h:30
RooArgSet _histObsList
List of observables defining dimensions of histogram.
Definition RooHistPdf.h:110
Int_t _intOrder
Interpolation order.
Definition RooHistPdf.h:115
bool forceAnalyticalInt(const RooAbsArg &dep) const override
bool areIdentical(const RooDataHist &dh1, const RooDataHist &dh2)
RooDataHist * _dataHist
Unowned pointer to underlying histogram.
Definition RooHistPdf.h:112
bool _cdfBoundaries
Use boundary conditions for CDFs.
Definition RooHistPdf.h:116
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...
double totVolume() const
Return the total volume spanned by the observables of the RooHistPdf.
void initializeOwnedDataHist(std::unique_ptr< RooDataHist > &&dataHist)
Definition RooHistPdf.h:148
bool importWorkspaceHook(RooWorkspace &ws) override
Check if our datahist is already in the workspace.
static TClass * Class()
RooSetProxy _pdfObsList
List of observables mapped onto histogram observables.
Definition RooHistPdf.h:111
double maxVal(Int_t code) const override
Return maximum value for set of observables identified by code assigned in getMaxVal.
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Return integral identified by 'code'.
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...
RooDataHist & dataHist()
Definition RooHistPdf.h:42
Int_t getMaxVal(const RooArgSet &vars) const override
Only handle case of maximum in all variables.
double _totVolume
! Total volume of space (product of ranges of observables)
Definition RooHistPdf.h:117
RooDataHist * cloneAndOwnDataHist(const char *newname="")
Replaces underlying RooDataHist with a clone, which is now owned, and returns the clone.
std::unique_ptr< RooDataHist > _ownedDataHist
! Owned pointer to underlying histogram
Definition RooHistPdf.h:113
void doEval(RooFit::EvalContext &) const override
Base function for computing multiple values of a RooAbsReal.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Determine integration scenario.
double evaluate() const override
Return the current value: The value of the bin enclosing the current coordinates of the observables,...
bool _unitNorm
Assume contents is unit normalized (for use as pdf cache)
Definition RooHistPdf.h:118
Variable that can be changed from the outside.
Definition RooRealVar.h:37
void setRange(const char *name, double min, double max, bool shared=true)
Set a fit or plotting range.
Persistable container for RooFit projects.
RooAbsData * embeddedData(RooStringView name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
std::list< RooAbsData * > allData() const
Return list of all dataset in the workspace.
bool import(const RooAbsArg &arg, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={})
Import a RooAbsArg object, e.g.
Buffer base class used for serializing objects.
Definition TBuffer.h:43
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
RooCmdArg Rename(const char *suffix)
RooCmdArg Embedded(bool flag=true)
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
std::pair< double, double > getRangeOrBinningInterval(RooAbsArg const *arg, const char *rangeName)
static void output()