Logo ROOT  
Reference Guide
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 
22 RooHistPdf implements a probablity density function sampled from a
23 multidimensional histogram. The histogram distribution is explicitly
24 normalized by RooHistPdf and can have an arbitrary number of real or
25 discrete dimensions.
26 **/
27 
28 #include "RooFit.h"
29 #include "Riostream.h"
30 
31 #include "RooHistPdf.h"
32 #include "RooDataHist.h"
33 #include "RooMsgService.h"
34 #include "RooRealVar.h"
35 #include "RooCategory.h"
36 #include "RooWorkspace.h"
37 #include "RooGlobalFunc.h"
38 #include "RooHelpers.h"
39 
40 #include "TError.h"
41 #include "TBuffer.h"
42 
43 using namespace std;
44 
46 
47 
48 
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 /// Default constructor
52 /// coverity[UNINIT_CTOR]
53 
54 RooHistPdf::RooHistPdf() : _dataHist(0), _totVolume(0), _unitNorm(kFALSE)
55 {
56 
57 }
58 
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 /// Constructor from a RooDataHist. RooDataHist dimensions
62 /// can be either real or discrete. See RooDataHist::RooDataHist for details on the binning.
63 /// RooHistPdf neither owns or clone 'dhist' and the user must ensure the input histogram exists
64 /// for the entire life span of this PDF.
65 
66 RooHistPdf::RooHistPdf(const char *name, const char *title, const RooArgSet& vars,
67  const RooDataHist& dhist, Int_t intOrder) :
68  RooAbsPdf(name,title),
69  _pdfObsList("pdfObs","List of p.d.f. observables",this),
70  _dataHist((RooDataHist*)&dhist),
71  _codeReg(10),
72  _intOrder(intOrder),
73  _cdfBoundaries(kFALSE),
74  _totVolume(0),
75  _unitNorm(kFALSE)
76 {
77  _histObsList.addClone(vars) ;
78  _pdfObsList.add(vars) ;
79 
80  // Verify that vars and dhist.get() have identical contents
81  const RooArgSet* dvars = dhist.get() ;
82  if (vars.getSize()!=dvars->getSize()) {
83  coutE(InputArguments) << "RooHistPdf::ctor(" << GetName()
84  << ") ERROR variable list and RooDataHist must contain the same variables." << endl ;
85  assert(0) ;
86  }
87  for (const auto arg : vars) {
88  if (!dvars->find(arg->GetName())) {
89  coutE(InputArguments) << "RooHistPdf::ctor(" << GetName()
90  << ") ERROR variable list and RooDataHist must contain the same variables." << endl ;
91  assert(0) ;
92  }
93  }
94 
95 
96  // Adjust ranges of _histObsList to those of _dataHist
97  for (const auto hobs : _histObsList) {
98  // Guaranteed to succeed, since checked above in ctor
99  RooAbsArg* dhobs = dhist.get()->find(hobs->GetName()) ;
100  RooRealVar* dhreal = dynamic_cast<RooRealVar*>(dhobs) ;
101  if (dhreal){
102  ((RooRealVar*)hobs)->setRange(dhreal->getMin(),dhreal->getMax()) ;
103  }
104  }
105 
106 }
107 
108 
109 
110 
111 ////////////////////////////////////////////////////////////////////////////////
112 /// Constructor from a RooDataHist. The first list of observables are the p.d.f.
113 /// observables, which may any RooAbsReal (function or variable). The second list
114 /// are the corresponding observables in the RooDataHist which must be of type
115 /// RooRealVar or RooCategory This constructor thus allows to apply a coordinate transformation
116 /// on the histogram data to be applied.
117 
118 RooHistPdf::RooHistPdf(const char *name, const char *title, const RooArgList& pdfObs,
119  const RooArgList& histObs, const RooDataHist& dhist, Int_t intOrder) :
120  RooAbsPdf(name,title),
121  _pdfObsList("pdfObs","List of p.d.f. observables",this),
122  _dataHist((RooDataHist*)&dhist),
123  _codeReg(10),
124  _intOrder(intOrder),
125  _cdfBoundaries(kFALSE),
126  _totVolume(0),
127  _unitNorm(kFALSE)
128 {
129  _histObsList.addClone(histObs) ;
130  _pdfObsList.add(pdfObs) ;
131 
132  // Verify that vars and dhist.get() have identical contents
133  const RooArgSet* dvars = dhist.get() ;
134  if (histObs.getSize()!=dvars->getSize()) {
135  coutE(InputArguments) << "RooHistPdf::ctor(" << GetName()
136  << ") ERROR histogram variable list and RooDataHist must contain the same variables." << endl ;
137  throw(string("RooHistPdf::ctor() ERROR: histogram variable list and RooDataHist must contain the same variables")) ;
138  }
139 
140  for (const auto arg : histObs) {
141  if (!dvars->find(arg->GetName())) {
142  coutE(InputArguments) << "RooHistPdf::ctor(" << GetName()
143  << ") ERROR variable list and RooDataHist must contain the same variables." << endl ;
144  throw(string("RooHistPdf::ctor() ERROR: histogram variable list and RooDataHist must contain the same variables")) ;
145  }
146  if (!arg->isFundamental()) {
147  coutE(InputArguments) << "RooHistPdf::ctor(" << GetName()
148  << ") ERROR all elements of histogram observables set must be of type RooRealVar or RooCategory." << endl ;
149  throw(string("RooHistPdf::ctor() ERROR all elements of histogram observables set must be of type RooRealVar or RooCategory.")) ;
150  }
151  }
152 
153 
154  // Adjust ranges of _histObsList to those of _dataHist
155  for (const auto hobs : _histObsList) {
156  // Guaranteed to succeed, since checked above in ctor
157  RooAbsArg* dhobs = dhist.get()->find(hobs->GetName()) ;
158  RooRealVar* dhreal = dynamic_cast<RooRealVar*>(dhobs) ;
159  if (dhreal){
160  ((RooRealVar*)hobs)->setRange(dhreal->getMin(),dhreal->getMax()) ;
161  }
162  }
163 }
164 
165 
166 
167 ////////////////////////////////////////////////////////////////////////////////
168 /// Copy constructor
169 
170 RooHistPdf::RooHistPdf(const RooHistPdf& other, const char* name) :
171  RooAbsPdf(other,name),
172  _pdfObsList("pdfObs",this,other._pdfObsList),
173  _dataHist(other._dataHist),
174  _codeReg(other._codeReg),
175  _intOrder(other._intOrder),
176  _cdfBoundaries(other._cdfBoundaries),
177  _totVolume(other._totVolume),
178  _unitNorm(other._unitNorm)
179 {
181 
182 }
183 
184 
185 
186 
187 ////////////////////////////////////////////////////////////////////////////////
188 /// Destructor
189 
191 {
192 
193 }
194 
195 
196 
197 
198 
199 ////////////////////////////////////////////////////////////////////////////////
200 /// Return the current value: The value of the bin enclosing the current coordinates
201 /// of the observables, normalized by the histograms contents. Interpolation
202 /// is applied if the RooHistPdf is configured to do that.
203 
205 {
206  // Transfer values from
207  for (unsigned int i=0; i < _pdfObsList.size(); ++i) {
208  RooAbsArg* harg = _histObsList[i];
209  RooAbsArg* parg = _pdfObsList[i];
210 
211  if (harg != parg) {
212  parg->syncCache() ;
213  harg->copyCache(parg,kTRUE) ;
214  if (!harg->inRange(0)) {
215  return 0 ;
216  }
217  }
218  }
219 
221 
222  return std::max(ret, 0.0);
223 }
224 
225 
226 ////////////////////////////////////////////////////////////////////////////////
227 /// Return the total volume spanned by the observables of the RooHistPdf
228 
230 {
231  // Return previously calculated value, if any
232  if (_totVolume>0) {
233  return _totVolume ;
234  }
235  _totVolume = 1. ;
236 
237  for (const auto arg : _histObsList) {
238  RooRealVar* real = dynamic_cast<RooRealVar*>(arg) ;
239  if (real) {
240  _totVolume *= (real->getMax()-real->getMin()) ;
241  } else {
242  RooCategory* cat = dynamic_cast<RooCategory*>(arg) ;
243  if (cat) {
244  _totVolume *= cat->numTypes() ;
245  }
246  }
247  }
248 
249  return _totVolume ;
250 }
251 
252 namespace {
253 bool fullRange(const RooAbsArg& x, const RooAbsArg& y ,const char* range)
254 {
255  const RooAbsRealLValue *_x = dynamic_cast<const RooAbsRealLValue*>(&x);
256  const RooAbsRealLValue *_y = dynamic_cast<const RooAbsRealLValue*>(&y);
257  if (!_x || !_y) return false;
258  if (!range || !strlen(range) || !_x->hasRange(range) ||
259  _x->getBinningPtr(range)->isParameterized()) {
260  // parameterized ranges may be full range now, but that might change,
261  // so return false
262  if (range && strlen(range) && _x->getBinningPtr(range)->isParameterized())
263  return false;
264  return (_x->getMin() == _y->getMin() && _x->getMax() == _y->getMax());
265  }
266  return (_x->getMin(range) == _y->getMin() && _x->getMax(range) == _y->getMax());
267 }
268 }
269 
270 
272  RooArgSet& analVars,
273  const char* rangeName,
274  RooArgSet const& histObsList,
275  RooSetProxy const& pdfObsList,
276  Int_t intOrder) {
277  // First make list of pdf observables to histogram observables
278  // and select only those for which the integral is over the full range
279 
280  Int_t code = 0;
281  Int_t frcode = 0;
282  for (unsigned int n=0; n < pdfObsList.size() && n < histObsList.size(); ++n) {
283  const auto pa = pdfObsList[n];
284  const auto ha = histObsList[n];
285 
286  if (allVars.find(*pa)) {
287  code |= 2 << n;
288  analVars.add(*pa);
289  if (fullRange(*pa, *ha, rangeName)) {
290  frcode |= 2 << n;
291  }
292  }
293  }
294 
295  if (code == frcode) {
296  // integrate over full range of all observables - use bit 0 to indicate
297  // full range integration over all observables
298  code |= 1;
299  }
300 
301  // Disable partial analytical integrals if interpolation is used, and we
302  // integrate over sub-ranges, but leave them enabled when we integrate over
303  // the full range of one or several variables
304  if (intOrder > 1 && !(code & 1)) {
305  analVars.removeAll();
306  return 0;
307  }
308  return (code >= 2) ? code : 0;
309 }
310 
311 
313  const char* rangeName,
314  RooArgSet const& histObsList,
315  RooSetProxy const& pdfObsList,
316  RooDataHist& dataHist,
317  bool histFuncMode) {
318  // Simplest scenario, full-range integration over all dependents
319  if (((2 << histObsList.getSize()) - 1) == code) {
320  return dataHist.sum(histFuncMode);
321  }
322 
323  // Partial integration scenario, retrieve set of variables, calculate partial
324  // sum, figure out integration ranges (if needed)
325  RooArgSet intSet;
326  std::map<const RooAbsArg*, std::pair<double, double> > ranges;
327  for (unsigned int n=0; n < pdfObsList.size() && n < histObsList.size(); ++n) {
328  const auto pa = pdfObsList[n];
329  const auto ha = histObsList[n];
330 
331  if (code & (2 << n)) {
332  intSet.add(*ha);
333  }
334  if (!(code & 1)) {
335  ranges[ha] = RooHelpers::getRangeOrBinningInterval(pa, rangeName);
336  }
337  // WVE must sync hist slice list values to pdf slice list
338  // Transfer values from
339  if (ha != pa) {
340  pa->syncCache();
341  ha->copyCache(pa,kTRUE);
342  }
343  }
344 
345  Double_t ret = (code & 1) ? dataHist.sum(intSet,histObsList,true,!histFuncMode) :
346  dataHist.sum(intSet,histObsList,true,!histFuncMode, ranges);
347 
348  return ret ;
349 }
350 
351 ////////////////////////////////////////////////////////////////////////////////
352 /// Determine integration scenario. If no interpolation is used,
353 /// RooHistPdf can perform all integrals over its dependents
354 /// analytically via partial or complete summation of the input
355 /// histogram. If interpolation is used on the integral over
356 /// all histogram observables is supported
357 
358 Int_t RooHistPdf::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName) const
359 {
360  return getAnalyticalIntegral(allVars, analVars, rangeName, _histObsList, _pdfObsList, _intOrder);
361 }
362 
363 
364 ////////////////////////////////////////////////////////////////////////////////
365 /// Return integral identified by 'code'. The actual integration
366 /// is deferred to RooDataHist::sum() which implements partial
367 /// or complete summation over the histograms contents.
368 
369 Double_t RooHistPdf::analyticalIntegral(Int_t code, const char* rangeName) const
370 {
371  return analyticalIntegral(code, rangeName, _histObsList, _pdfObsList, *_dataHist, false);
372 }
373 
374 
375 ////////////////////////////////////////////////////////////////////////////////
376 /// Return sampling hint for making curves of (projections) of this function
377 /// as the recursive division strategy of RooCurve cannot deal efficiently
378 /// with the vertical lines that occur in a non-interpolated histogram
379 
380 list<Double_t>* RooHistPdf::plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const
381 {
382  // No hints are required when interpolation is used
383  if (_intOrder>0) {
384  return 0 ;
385  }
386 
387  // Check that observable is in dataset, if not no hint is generated
388  RooAbsArg* dhObs = nullptr;
389  for (unsigned int i=0; i < _pdfObsList.size(); ++i) {
390  RooAbsArg* histObs = _histObsList[i];
391  RooAbsArg* pdfObs = _pdfObsList[i];
392  if (TString(obs.GetName())==pdfObs->GetName()) {
393  dhObs = _dataHist->get()->find(histObs->GetName()) ;
394  break;
395  }
396  }
397 
398  if (!dhObs) {
399  return 0 ;
400  }
401  RooAbsLValue* lval = dynamic_cast<RooAbsLValue*>(dhObs) ;
402  if (!lval) {
403  return 0 ;
404  }
405 
406  // Retrieve position of all bin boundaries
407 
408  const RooAbsBinning* binning = lval->getBinningPtr(0) ;
409  Double_t* boundaries = binning->array() ;
410 
411  list<Double_t>* hint = new list<Double_t> ;
412 
413  // Widen range slighty
414  xlo = xlo - 0.01*(xhi-xlo) ;
415  xhi = xhi + 0.01*(xhi-xlo) ;
416 
417  Double_t delta = (xhi-xlo)*1e-8 ;
418 
419  // Construct array with pairs of points positioned epsilon to the left and
420  // right of the bin boundaries
421  for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
422  if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
423  hint->push_back(boundaries[i]-delta) ;
424  hint->push_back(boundaries[i]+delta) ;
425  }
426  }
427 
428  return hint ;
429 }
430 
431 
432 
433 ////////////////////////////////////////////////////////////////////////////////
434 /// Return sampling hint for making curves of (projections) of this function
435 /// as the recursive division strategy of RooCurve cannot deal efficiently
436 /// with the vertical lines that occur in a non-interpolated histogram
437 
438 std::list<Double_t>* RooHistPdf::binBoundaries(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const
439 {
440  // No hints are required when interpolation is used
441  if (_intOrder>0) {
442  return 0 ;
443  }
444 
445  // Check that observable is in dataset, if not no hint is generated
446  RooAbsLValue* lvarg = dynamic_cast<RooAbsLValue*>(_dataHist->get()->find(obs.GetName())) ;
447  if (!lvarg) {
448  return 0 ;
449  }
450 
451  // Retrieve position of all bin boundaries
452  const RooAbsBinning* binning = lvarg->getBinningPtr(0) ;
453  Double_t* boundaries = binning->array() ;
454 
455  list<Double_t>* hint = new list<Double_t> ;
456 
457  // Construct array with pairs of points positioned epsilon to the left and
458  // right of the bin boundaries
459  for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
460  if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
461  hint->push_back(boundaries[i]) ;
462  }
463  }
464 
465  return hint ;
466 }
467 
468 
469 
470 
471 ////////////////////////////////////////////////////////////////////////////////
472 /// Only handle case of maximum in all variables
473 
475 {
476  RooAbsCollection* common = _pdfObsList.selectCommon(vars) ;
477  if (common->getSize()==_pdfObsList.getSize()) {
478  delete common ;
479  return 1;
480  }
481  delete common ;
482  return 0 ;
483 }
484 
485 
486 ////////////////////////////////////////////////////////////////////////////////
487 
489 {
490  R__ASSERT(code==1) ;
491 
492  Double_t max(-1) ;
493  for (Int_t i=0 ; i<_dataHist->numEntries() ; i++) {
494  _dataHist->get(i) ;
495  Double_t wgt = _dataHist->weight() ;
496  if (wgt>max) max=wgt ;
497  }
498 
499  return max*1.05 ;
500 }
501 
502 
503 
504 
505 ////////////////////////////////////////////////////////////////////////////////
506 
508 {
509  if (fabs(dh1.sumEntries()-dh2.sumEntries())>1e-8) return kFALSE ;
510  if (dh1.numEntries() != dh2.numEntries()) return kFALSE ;
511  for (int i=0 ; i < dh1.numEntries() ; i++) {
512  dh1.get(i) ;
513  dh2.get(i) ;
514  if (fabs(dh1.weight()-dh2.weight())>1e-8) return kFALSE ;
515  }
516  return kTRUE ;
517 }
518 
519 
520 
521 ////////////////////////////////////////////////////////////////////////////////
522 /// Check if our datahist is already in the workspace
523 
525 {
526  std::list<RooAbsData*> allData = ws.allData() ;
527  std::list<RooAbsData*>::const_iterator iter ;
528  for (iter = allData.begin() ; iter != allData.end() ; ++iter) {
529  // If your dataset is already in this workspace nothing needs to be done
530  if (*iter == _dataHist) {
531  return kFALSE ;
532  }
533  }
534 
535  // Check if dataset with given name already exists
536  RooAbsData* wsdata = ws.embeddedData(_dataHist->GetName()) ;
537 
538  if (wsdata) {
539 
540  // Yes it exists - now check if it is identical to our internal histogram
541  if (wsdata->InheritsFrom(RooDataHist::Class())) {
542 
543  // Check if histograms are identical
544  if (areIdentical((RooDataHist&)*wsdata,*_dataHist)) {
545 
546  // Exists and is of correct type, and identical -- adjust internal pointer to WS copy
547  _dataHist = (RooDataHist*) wsdata ;
548  } else {
549 
550  // not identical, clone rename and import
551  TString uniqueName = Form("%s_%s",_dataHist->GetName(),GetName()) ;
552  Bool_t flag = ws.import(*_dataHist,RooFit::Rename(uniqueName.Data()),RooFit::Embedded()) ;
553  if (flag) {
554  coutE(ObjectHandling) << " RooHistPdf::importWorkspaceHook(" << GetName() << ") unable to import clone of underlying RooDataHist with unique name " << uniqueName << ", abort" << endl ;
555  return kTRUE ;
556  }
557  _dataHist = (RooDataHist*) ws.embeddedData(uniqueName.Data()) ;
558  }
559 
560  } else {
561 
562  // Exists and is NOT of correct type: clone rename and import
563  TString uniqueName = Form("%s_%s",_dataHist->GetName(),GetName()) ;
564  Bool_t flag = ws.import(*_dataHist,RooFit::Rename(uniqueName.Data()),RooFit::Embedded()) ;
565  if (flag) {
566  coutE(ObjectHandling) << " RooHistPdf::importWorkspaceHook(" << GetName() << ") unable to import clone of underlying RooDataHist with unique name " << uniqueName << ", abort" << endl ;
567  return kTRUE ;
568  }
569  _dataHist = (RooDataHist*) ws.embeddedData(uniqueName.Data()) ;
570 
571  }
572  return kFALSE ;
573  }
574 
575  // We need to import our datahist into the workspace
576  ws.import(*_dataHist,RooFit::Embedded()) ;
577 
578  // Redirect our internal pointer to the copy in the workspace
579  _dataHist = (RooDataHist*) ws.embeddedData(_dataHist->GetName()) ;
580  return kFALSE ;
581 }
582 
583 
584 ////////////////////////////////////////////////////////////////////////////////
585 /// Stream an object of class RooHistPdf.
586 
587 void RooHistPdf::Streamer(TBuffer &R__b)
588 {
589  if (R__b.IsReading()) {
590  R__b.ReadClassBuffer(RooHistPdf::Class(),this);
591  // WVE - interim solution - fix proxies here
592  //_proxyList.Clear() ;
593  //registerProxy(_pdfObsList) ;
594  } else {
595  R__b.WriteClassBuffer(RooHistPdf::Class(),this);
596  }
597 }
598 
RooHistPdf::analyticalIntegral
static Double_t analyticalIntegral(Int_t code, const char *rangeName, RooArgSet const &histObsList, RooSetProxy const &pdfObsList, RooDataHist &dataHist, bool histFuncMode)
Definition: RooHistPdf.cxx:312
RooHistPdf::_cdfBoundaries
Bool_t _cdfBoundaries
Definition: RooHistPdf.h:117
n
const Int_t n
Definition: legend1.C:16
RooWorkspace.h
RooHelpers.h
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:488
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
e
#define e(i)
Definition: RSha256.hxx:103
RooMsgService.h
RooHistPdf::totVolume
Double_t totVolume() const
Return the total volume spanned by the observables of the RooHistPdf.
Definition: RooHistPdf.cxx:229
RooAbsData
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:49
RooDataHist::weight
double weight(std::size_t i) const
Return weight of i-th bin.
Definition: RooDataHist.h:102
RooAbsRealLValue::getMax
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
Definition: RooAbsRealLValue.h:89
RooFit.h
RooFit::InputArguments
@ InputArguments
Definition: RooGlobalFunc.h:61
RooHistPdf::RooHistPdf
RooHistPdf()
Default constructor coverity[UNINIT_CTOR].
Definition: RooHistPdf.cxx:54
TString::Data
const char * Data() const
Definition: TString.h:369
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
Form
char * Form(const char *fmt,...)
RooSetProxy
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition: RooSetProxy.h:23
TBuffer::ReadClassBuffer
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
coutE
#define coutE(a)
Definition: RooMsgService.h:33
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooDataHist::sumEntries
Double_t sumEntries() const override
Sum the weights of all bins.
Definition: RooDataHist.cxx:1808
RooAbsLValue::getBinningPtr
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const =0
RooAbsCollection::find
RooAbsArg * find(const char *name) const
Find object with given name in list.
Definition: RooAbsCollection.cxx:810
x
Double_t x[n]
Definition: legend1.C:17
TBuffer
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
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:119
TString
Basic string class.
Definition: TString.h:136
RooRealVar::setRange
void setRange(const char *name, Double_t min, Double_t max)
Set a fit or plotting range.
Definition: RooRealVar.cxx:526
TObject::InheritsFrom
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
RooHistPdf::_histObsList
RooArgSet _histObsList
Definition: RooHistPdf.h:112
RooDataHist::sum
Double_t sum(bool correctForBinSize, bool inverseCorr=false) const
Return the sum of the weights of all bins in the histogram.
Definition: RooDataHist.cxx:1537
RooAbsCategory::numTypes
Int_t numTypes(const char *=0) const
Return number of types defined (in range named rangeName if rangeName!=0)
Definition: RooAbsCategory.h:128
bool
RooAbsRealLValue::getMin
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
Definition: RooAbsRealLValue.h:86
RooAbsBinning::array
virtual Double_t * array() const =0
RooAbsRealLValue::getBinningPtr
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const
Definition: RooAbsRealLValue.h:59
ROOT::Math::fabs
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Definition: UnaryOperators.h:131
RooFit::Rename
RooCmdArg Rename(const char *suffix)
Definition: RooGlobalFunc.cxx:356
RooDataHist
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:37
ws
void ws()
Definition: ws.C:66
RooDataHist::get
const RooArgSet * get() const override
Get bin centre of current bin.
Definition: RooDataHist.h:74
TBuffer.h
RooDataHist::weightFast
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...
Definition: RooDataHist.cxx:1083
RooHistPdf::_intOrder
Int_t _intOrder
Auxiliary class keeping tracking of analytical integration code.
Definition: RooHistPdf.h:116
Double_t
RooAbsArg::syncCache
virtual void syncCache(const RooArgSet *nset=0)=0
RooAbsCollection::addClone
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
Definition: RooAbsCollection.cxx:428
TBuffer::WriteClassBuffer
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
RooDataHist.h
RooHistPdf::getAnalyticalIntegral
static Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName, RooArgSet const &histObsList, RooSetProxy const &pdfObsList, Int_t intOrder)
Definition: RooHistPdf.cxx:271
RooAbsBinning
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
Definition: RooAbsBinning.h:26
RooAbsCollection
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
Definition: RooAbsCollection.h:33
RooAbsCollection::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Definition: RooAbsCollection.cxx:455
RooFit::Embedded
RooCmdArg Embedded(Bool_t flag=kTRUE)
Definition: RooGlobalFunc.cxx:357
RooHistPdf::_dataHist
RooDataHist * _dataHist
Definition: RooHistPdf.h:114
RooAbsCollection::size
Storage_t::size_type size() const
Definition: RooAbsCollection.h:214
RooHelpers::getRangeOrBinningInterval
std::pair< double, double > getRangeOrBinningInterval(RooAbsArg const *arg, const char *rangeName)
Get the lower and upper bound of parameter range if arg can be casted to RooAbsRealLValue.
Definition: RooHelpers.cxx:190
RooCategory.h
y
Double_t y[n]
Definition: legend1.C:17
RooFit::ObjectHandling
@ ObjectHandling
Definition: RooGlobalFunc.h:61
RooHistPdf::_pdfObsList
RooSetProxy _pdfObsList
Definition: RooHistPdf.h:113
RooHistPdf::importWorkspaceHook
Bool_t importWorkspaceHook(RooWorkspace &ws)
Check if our datahist is already in the workspace.
Definition: RooHistPdf.cxx:524
RooRealVar.h
RooHistPdf
RooHistPdf implements a probablity density function sampled from a multidimensional histogram.
Definition: RooHistPdf.h:29
RooAbsCollection::selectCommon
bool selectCommon(const RooAbsCollection &refColl, RooAbsCollection &outColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
Definition: RooAbsCollection.cxx:702
RooGlobalFunc.h
RooAbsArg::copyCache
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)=0
RooHistPdf.h
TBuffer::IsReading
Bool_t IsReading() const
Definition: TBuffer.h:86
RooWorkspace
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
RooDataHist::numEntries
Int_t numEntries() const override
Return the number of bins.
Definition: RooDataHist.cxx:1799
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:204
RooAbsRealLValue::hasRange
virtual Bool_t hasRange(const char *name) const
Check if variable has a binning with given name.
Definition: RooAbsRealLValue.h:102
R__ASSERT
#define R__ASSERT(e)
Definition: TError.h:118
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:438
RooCategory
RooCategory is an object to represent discrete states.
Definition: RooCategory.h:27
RooHistPdf::areIdentical
Bool_t areIdentical(const RooDataHist &dh1, const RooDataHist &dh2)
Definition: RooHistPdf.cxx:507
RooAbsBinning::numBoundaries
virtual Int_t numBoundaries() const =0
name
char name[80]
Definition: TGX11.cxx:110
RooAbsBinning::isParameterized
virtual Bool_t isParameterized() const
Interface function.
Definition: RooAbsBinning.h:80
RooHistPdf::_totVolume
Double_t _totVolume
Definition: RooHistPdf.h:118
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
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:380
RooAbsPdf
Definition: RooAbsPdf.h:41
RooAbsLValue
Abstract base class for objects that are lvalues, i.e.
Definition: RooAbsLValue.h:26
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
RooHistPdf::getMaxVal
virtual Int_t getMaxVal(const RooArgSet &vars) const
Only handle case of maximum in all variables.
Definition: RooHistPdf.cxx:474
Class
void Class()
Definition: Class.C:29
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
RooAbsCollection::removeAll
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
Definition: RooAbsCollection.cxx:644
Riostream.h
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
RooAbsArg::inRange
virtual Bool_t inRange(const char *) const
Definition: RooAbsArg.h:378
RooAbsCollection::getSize
Int_t getSize() const
Definition: RooAbsCollection.h:231
RooSetProxy::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Overloaded RooArgSet::add() method inserts 'var' into set and registers 'var' as server to owner with...
Definition: RooSetProxy.cxx:165
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:33
RooHistPdf::~RooHistPdf
virtual ~RooHistPdf()
Destructor.
Definition: RooHistPdf.cxx:190
int
TError.h