Logo ROOT  
Reference Guide
RooHistFunc.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 RooHistFunc.cxx
19\class RooHistFunc
20\ingroup Roofitcore
21
22RooHistFunc implements a real-valued function sampled from a
23multidimensional histogram. The histogram can have an arbitrary number of real or
24discrete dimensions and may have negative values.
25**/
26
27#include "RooHistFunc.h"
28#include "RooDataHist.h"
29#include "RooMsgService.h"
30#include "RooRealVar.h"
31#include "RooCategory.h"
32#include "RooWorkspace.h"
33#include "RooHistPdf.h"
34#include "RooHelpers.h"
35
36#include "TError.h"
37#include "TBuffer.h"
38
39#include <stdexcept>
40
41
43
44
45////////////////////////////////////////////////////////////////////////////////
46/// Constructor from a RooDataHist. The variable listed in 'vars' control the dimensionality of the
47/// function. Any additional dimensions present in 'dhist' will be projected out. RooDataHist dimensions
48/// can be either real or discrete. See RooDataHist::RooDataHist for details on the binning.
49/// RooHistFunc neither owns or clone 'dhist' and the user must ensure the input histogram exists
50/// for the entire life span of this function.
51
52RooHistFunc::RooHistFunc(const char *name, const char *title, const RooArgSet& vars,
53 const RooDataHist& dhist, Int_t intOrder) :
54 RooAbsReal(name,title),
55 _depList("depList","List of dependents",this),
56 _dataHist((RooDataHist*)&dhist),
57 _codeReg(10),
58 _intOrder(intOrder),
59 _cdfBoundaries(false)
60{
62 _depList.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) << "RooHistFunc::ctor(" << GetName()
68 << ") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
69 throw std::invalid_argument("RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
70 }
71
72 for (const auto arg : vars) {
73 if (!dvars->find(arg->GetName())) {
74 coutE(InputArguments) << "RooHistFunc::ctor(" << GetName()
75 << ") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
76 throw std::invalid_argument("RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
77 }
78 }
79
81}
82
83
84
85////////////////////////////////////////////////////////////////////////////////
86/// Constructor from a RooDataHist. The variable listed in 'vars' control the dimensionality of the
87/// function. Any additional dimensions present in 'dhist' will be projected out. RooDataHist dimensions
88/// can be either real or discrete. See RooDataHist::RooDataHist for details on the binning.
89/// RooHistFunc neither owns or clone 'dhist' and the user must ensure the input histogram exists
90/// for the entire life span of this function.
91
92RooHistFunc::RooHistFunc(const char *name, const char *title, const RooArgList& funcObs, const RooArgList& histObs,
93 const RooDataHist& dhist, Int_t intOrder) :
94 RooAbsReal(name,title),
95 _depList("depList","List of dependents",this),
96 _dataHist((RooDataHist*)&dhist),
97 _codeReg(10),
98 _intOrder(intOrder),
99 _cdfBoundaries(false)
100{
101 _histObsList.addClone(histObs) ;
102 _depList.add(funcObs) ;
103
104 // Verify that vars and dhist.get() have identical contents
105 const RooArgSet* dvars = dhist.get() ;
106 if (histObs.size()!=dvars->size()) {
107 coutE(InputArguments) << "RooHistFunc::ctor(" << GetName()
108 << ") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
109 throw std::invalid_argument("RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
110 }
111
112 for (const auto arg : histObs) {
113 if (!dvars->find(arg->GetName())) {
114 coutE(InputArguments) << "RooHistFunc::ctor(" << GetName()
115 << ") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
116 throw std::invalid_argument("RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
117 }
118 }
119
121}
122
123
124RooHistFunc::RooHistFunc(const char *name, const char *title, const RooArgSet& vars,
125 std::unique_ptr<RooDataHist> dhist, int intOrder)
126 : RooHistFunc{name, title, vars, *dhist, intOrder}
127{
128 _ownedDataHist = std::move(dhist);
129}
130
131
132RooHistFunc::RooHistFunc(const char *name, const char *title, const RooArgList& pdfObs, const RooArgList& histObs,
133 std::unique_ptr<RooDataHist> dhist, int intOrder)
134 : RooHistFunc{name, title, pdfObs, histObs, *dhist, intOrder}
135{
136 _ownedDataHist = std::move(dhist);
137}
138
139
140////////////////////////////////////////////////////////////////////////////////
141/// Copy constructor
142
143RooHistFunc::RooHistFunc(const RooHistFunc& other, const char* name) :
144 RooAbsReal(other,name),
145 _depList("depList",this,other._depList),
146 _dataHist(other._dataHist),
147 _codeReg(other._codeReg),
148 _intOrder(other._intOrder),
149 _cdfBoundaries(other._cdfBoundaries),
150 _totVolume(other._totVolume),
151 _unitNorm(other._unitNorm)
152{
154
156}
157
158
159
160////////////////////////////////////////////////////////////////////////////////
161
163{
165}
166
167
168
169
170////////////////////////////////////////////////////////////////////////////////
171/// Return the current value: The value of the bin enclosing the current coordinates
172/// of the dependents, normalized by the histograms contents. Interpolation
173/// is applied if the RooHistFunc is configured to do that
174
176{
177 // Transfer values from
178 if (!_depList.empty()) {
179 for (auto i = 0u; i < _histObsList.size(); ++i) {
180 const auto harg = _histObsList[i];
181 const auto parg = _depList[i];
182
183 if (harg != parg) {
184 parg->syncCache() ;
185 harg->copyCache(parg,true) ;
186 if (!harg->inRange(0)) {
187 return 0 ;
188 }
189 }
190 }
191 }
192
194 return ret ;
195}
196
197
198void RooHistFunc::computeBatch(cudaStream_t*, double* output, size_t size, RooFit::Detail::DataMap const& dataMap) const {
199 if (_depList.size() == 1) {
200 auto xVals = dataMap.at(_depList[0]);
202 return;
203 }
204
205 std::vector<RooSpan<const double>> inputValues;
206 for (const auto& obs : _depList) {
207 auto realObs = dynamic_cast<const RooAbsReal*>(obs);
208 if (realObs) {
209 auto inputs = dataMap.at(realObs);
210 inputValues.push_back(std::move(inputs));
211 } else {
212 inputValues.emplace_back();
213 }
214 }
215
216 for (std::size_t i = 0; i < size; ++i) {
217 bool skip = false;
218
219 for (auto j = 0u; j < _histObsList.size(); ++j) {
220 const auto histObs = _histObsList[j];
221
222 if (i < inputValues[j].size()) {
223 histObs->setCachedValue(inputValues[j][i], false);
224 if (!histObs->inRange(nullptr)) {
225 skip = true;
226 break;
227 }
228 }
229 }
230
232 }
233}
234
235
236////////////////////////////////////////////////////////////////////////////////
237/// Only handle case of maximum in all variables
238
240{
241 RooAbsCollection* common = _depList.selectCommon(vars) ;
242 if (common->size()==_depList.size()) {
243 delete common ;
244 return 1;
245 }
246 delete common ;
247 return 0 ;
248}
249
250////////////////////////////////////////////////////////////////////////////////
251
252double RooHistFunc::maxVal(Int_t code) const
253{
254 R__ASSERT(code==1) ;
255
256 double max(-1) ;
257 for (Int_t i=0 ; i<_dataHist->numEntries() ; i++) {
258 _dataHist->get(i) ;
259 double wgt = _dataHist->weight() ;
260 if (wgt>max) max=wgt ;
261 }
262
263 return max*1.05 ;
264}
265
266////////////////////////////////////////////////////////////////////////////////
267/// Return the total volume spanned by the observables of the RooDataHist
268
270{
271 // Return previously calculated value, if any
272 if (_totVolume>0) {
273 return _totVolume ;
274 }
275 _totVolume = 1. ;
276 for (const auto arg : _depList) {
277 RooRealVar* real = dynamic_cast<RooRealVar*>(arg) ;
278 if (real) {
279 _totVolume *= (real->getMax()-real->getMin()) ;
280 } else {
281 RooCategory* cat = dynamic_cast<RooCategory*>(arg) ;
282 if (cat) {
283 _totVolume *= cat->numTypes() ;
284 }
285 }
286 }
287
288 return _totVolume ;
289}
290
291
292////////////////////////////////////////////////////////////////////////////////
293/// Determine integration scenario. If no interpolation is used,
294/// RooHistFunc can perform all integrals over its dependents
295/// analytically via partial or complete summation of the input
296/// histogram. If interpolation is used, only the integral
297/// over all RooHistPdf observables is implemented.
298
299Int_t RooHistFunc::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName) const
300{
301 return RooHistPdf::getAnalyticalIntegral(allVars, analVars, rangeName, _histObsList, _depList, _intOrder);
302}
303
304
305////////////////////////////////////////////////////////////////////////////////
306/// Return integral identified by 'code'. The actual integration
307/// is deferred to RooDataHist::sum() which implements partial
308/// or complete summation over the histograms contents
309
310double RooHistFunc::analyticalIntegral(Int_t code, const char* rangeName) const
311{
312 return RooHistPdf::analyticalIntegral(code, rangeName, _histObsList, _depList, *_dataHist, true);
313}
314
315
316////////////////////////////////////////////////////////////////////////////////
317/// Return sampling hint for making curves of (projections) of this function
318/// as the recursive division strategy of RooCurve cannot deal efficiently
319/// with the vertical lines that occur in a non-interpolated histogram
320
321std::list<double>* RooHistFunc::plotSamplingHint(RooAbsRealLValue& obs, double xlo, double xhi) const
322{
323 // No hints are required when interpolation is used
324 if (_intOrder>1) {
325 return 0 ;
326 }
327
328
329 // Find histogram observable corresponding to pdf observable
330 RooAbsArg* hobs = nullptr;
331 for (auto i = 0u; i < _histObsList.size(); ++i) {
332 const auto harg = _histObsList[i];
333 const auto parg = _depList[i];
334 if (std::string(parg->GetName())==obs.GetName()) {
335 hobs=harg ;
336 }
337 }
338 if (!hobs) {
339 return 0 ;
340 }
341
342 // Check that observable is in dataset, if not no hint is generated
343 RooAbsLValue* lvarg = dynamic_cast<RooAbsLValue*>(_dataHist->get()->find(hobs->GetName())) ;
344 if (!lvarg) {
345 return 0 ;
346 }
347
348 // Retrieve position of all bin boundaries
349 const RooAbsBinning* binning = lvarg->getBinningPtr(0) ;
350 double* boundaries = binning->array() ;
351
352 auto hint = new std::list<double> ;
353
354 // Widen range slighty
355 xlo = xlo - 0.01*(xhi-xlo) ;
356 xhi = xhi + 0.01*(xhi-xlo) ;
357
358 double delta = (xhi-xlo)*1e-8 ;
359
360 // Construct array with pairs of points positioned epsilon to the left and
361 // right of the bin boundaries
362 for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
363 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
364 hint->push_back(boundaries[i]-delta) ;
365 hint->push_back(boundaries[i]+delta) ;
366 }
367 }
368
369 return hint ;
370}
371
372
373////////////////////////////////////////////////////////////////////////////////
374/// Return sampling hint for making curves of (projections) of this function
375/// as the recursive division strategy of RooCurve cannot deal efficiently
376/// with the vertical lines that occur in a non-interpolated histogram
377
378std::list<double>* RooHistFunc::binBoundaries(RooAbsRealLValue& obs, double xlo, double xhi) const
379{
380 // No hints are required when interpolation is used
381 if (_intOrder>1) {
382 return 0 ;
383 }
384
385 // Find histogram observable corresponding to pdf observable
386 RooAbsArg* hobs(0) ;
387 for (auto i = 0u; i < _histObsList.size(); ++i) {
388 const auto harg = _histObsList[i];
389 const auto parg = _depList[i];
390 if (std::string(parg->GetName())==obs.GetName()) {
391 hobs=harg ;
392 }
393 }
394
395 // cout << "RooHistFunc::bb(" << GetName() << ") histObs = " << _histObsList << std::endl ;
396 // cout << "RooHistFunc::bb(" << GetName() << ") pdfObs = " << _depList << std::endl ;
397
398 RooAbsRealLValue* transform = nullptr;
399 if (!hobs) {
400
401 // Considering alternate: input observable is histogram observable and pdf observable is transformation in terms of it
402 RooAbsArg* pobs = nullptr;
403 for (auto i = 0u; i < _histObsList.size(); ++i) {
404 const auto harg = _histObsList[i];
405 const auto parg = _depList[i];
406 if (std::string(harg->GetName())==obs.GetName()) {
407 pobs=parg ;
408 hobs=harg ;
409 }
410 }
411
412 // Not found, or check that matching pdf observable is an l-value dependent on histogram observable fails
413 if (!hobs || !(pobs->dependsOn(obs) && dynamic_cast<RooAbsRealLValue*>(pobs))) {
414 std::cout << "RooHistFunc::binBoundaries(" << GetName() << ") obs = " << obs.GetName() << " hobs is not found, returning null" << std::endl ;
415 return 0 ;
416 }
417
418 // Now we are in business - we are in a situation where the pdf observable LV(x), mapping to a histogram observable x
419 // We can return bin boundaries by mapping the histogram boundaties through the inverse of the LV(x) transformation
420 transform = dynamic_cast<RooAbsRealLValue*>(pobs) ;
421 }
422
423
424 // cout << "hobs = " << hobs->GetName() << std::endl ;
425 // cout << "transform = " << (transform?transform->GetName():"<none>") << std::endl ;
426
427 // Check that observable is in dataset, if not no hint is generated
428 RooAbsArg* xtmp = _dataHist->get()->find(hobs->GetName()) ;
429 if (!xtmp) {
430 std::cout << "RooHistFunc::binBoundaries(" << GetName() << ") hobs = " << hobs->GetName() << " is not found in dataset?" << std::endl ;
431 _dataHist->get()->Print("v") ;
432 return 0 ;
433 }
434 RooAbsLValue* lvarg = dynamic_cast<RooAbsLValue*>(_dataHist->get()->find(hobs->GetName())) ;
435 if (!lvarg) {
436 std::cout << "RooHistFunc::binBoundaries(" << GetName() << ") hobs = " << hobs->GetName() << " but is not an LV, returning null" << std::endl ;
437 return 0 ;
438 }
439
440 // Retrieve position of all bin boundaries
441 const RooAbsBinning* binning = lvarg->getBinningPtr(0) ;
442 double* boundaries = binning->array() ;
443
444 auto hint = new std::list<double> ;
445
446 double delta = (xhi-xlo)*1e-8 ;
447
448 // Construct array with pairs of points positioned epsilon to the left and
449 // right of the bin boundaries
450 for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
451 if (boundaries[i]>xlo-delta && boundaries[i]<xhi+delta) {
452
453 double boundary = boundaries[i] ;
454 if (transform) {
455 transform->setVal(boundary) ;
456 //cout << "transform bound " << boundary << " using " << transform->GetName() << " result " << obs.getVal() << std::endl ;
457 hint->push_back(obs.getVal()) ;
458 } else {
459 hint->push_back(boundary) ;
460 }
461 }
462 }
463
464 return hint ;
465}
466
467
468
469////////////////////////////////////////////////////////////////////////////////
470/// Check if our datahist is already in the workspace.
471/// In case of error, return true.
473{
474 // Check if dataset with given name already exists
475 RooAbsData* wsdata = ws.embeddedData(_dataHist->GetName()) ;
476
477 if (wsdata) {
478 // If our data is exactly the same, we are done:
479 if (static_cast<RooDataHist*>(wsdata) == _dataHist)
480 return false;
481
482 // Yes it exists - now check if it is identical to our internal histogram
483 if (wsdata->InheritsFrom(RooDataHist::Class())) {
484
485 // Check if histograms are identical
486 if (areIdentical((RooDataHist&)*wsdata,*_dataHist)) {
487
488 // Exists and is of correct type, and identical -- adjust internal pointer to WS copy
489 _dataHist = (RooDataHist*) wsdata ;
490 } else {
491
492 // not identical, clone rename and import
493 auto uniqueName = std::string(_dataHist->GetName()) + "_" + GetName();
494 bool flag = ws.import(*_dataHist,RooFit::Rename(uniqueName.c_str()),RooFit::Embedded()) ;
495 if (flag) {
496 coutE(ObjectHandling) << " RooHistPdf::importWorkspaceHook(" << GetName() << ") unable to import clone of underlying RooDataHist with unique name " << uniqueName << ", abort" << std::endl ;
497 return true ;
498 }
499 _dataHist = (RooDataHist*) ws.embeddedData(uniqueName.c_str()) ;
500 }
501
502 } else {
503
504 // Exists and is NOT of correct type: clone rename and import
505 auto uniqueName = std::string(_dataHist->GetName()) + "_" + GetName();
506 bool flag = ws.import(*_dataHist,RooFit::Rename(uniqueName.c_str()),RooFit::Embedded()) ;
507 if (flag) {
508 coutE(ObjectHandling) << " RooHistPdf::importWorkspaceHook(" << GetName() << ") unable to import clone of underlying RooDataHist with unique name " << uniqueName << ", abort" << std::endl ;
509 return true ;
510 }
511 _dataHist = static_cast<RooDataHist*>(ws.embeddedData(uniqueName.c_str()));
512
513 }
514 return false ;
515 }
516
517 // We need to import our datahist into the workspace
519
520 // Redirect our internal pointer to the copy in the workspace
522 return false ;
523}
524
525
526////////////////////////////////////////////////////////////////////////////////
527
529{
530 if (fabs(dh1.sumEntries()-dh2.sumEntries())>1e-8) return false ;
531 if (dh1.numEntries() != dh2.numEntries()) return false ;
532 for (int i=0 ; i < dh1.numEntries() ; i++) {
533 dh1.get(i) ;
534 dh2.get(i) ;
535 if (fabs(dh1.weight()-dh2.weight())>1e-8) return false ;
536 }
538 if (getColonSeparatedNameString(*dh1.get()) != getColonSeparatedNameString(*dh2.get())) return false ;
539 return true ;
540}
541
542
543
544////////////////////////////////////////////////////////////////////////////////
545/// Stream an object of class RooHistFunc.
546
548{
549 if (R__b.IsReading()) {
551 // WVE - interim solution - fix proxies here
552 _proxyList.Clear() ;
554 } else {
556 }
557}
558
559
560////////////////////////////////////////////////////////////////////////////////
561/// Schema evolution: if histObsList wasn't filled from persistence (v1)
562/// then fill it here. Can't be done in regular schema evolution in LinkDef
563/// as _depList content is not guaranteed to be initialized there
564
566{
567 RooAbsReal::ioStreamerPass2(); // call the baseclass method
568
569 if (_histObsList.empty()) {
571 }
572}
573
574
575////////////////////////////////////////////////////////////////////////////////
576/// Compute bin number corresponding to current coordinates.
577/// \return If a bin is not in the current range of the observables, return -1.
579 if (!_depList.empty()) {
580 for (auto i = 0u; i < _histObsList.size(); ++i) {
581 const auto harg = _histObsList[i];
582 const auto parg = _depList[i];
583
584 if (harg != parg) {
585 parg->syncCache() ;
586 harg->copyCache(parg,true) ;
587 if (!harg->inRange(nullptr)) {
588 return -1;
589 }
590 }
591 }
592 }
593
594 return _dataHist->getIndex(_histObsList, true);
595}
596
597
598////////////////////////////////////////////////////////////////////////////////
599/// Compute bin numbers corresponding to all coordinates in `evalData`.
600/// \return Vector of bin numbers. If a bin is not in the current range of the observables, return -1.
601std::vector<Int_t> RooHistFunc::getBins(RooFit::Detail::DataMap const& dataMap) const {
602 std::vector<RooSpan<const double>> depData;
603 for (const auto dep : _depList) {
604 auto real = dynamic_cast<const RooAbsReal*>(dep);
605 if (real) {
606 depData.push_back(dataMap.at(real));
607 } else {
608 depData.emplace_back(nullptr, 0);
609 }
610 }
611
612 const auto batchSize = std::max_element(depData.begin(), depData.end(),
613 [](const RooSpan<const double>& a, const RooSpan<const double>& b){ return a.size() < b.size(); })->size();
614 std::vector<Int_t> results;
615
616 for (std::size_t evt = 0; evt < batchSize; ++evt) {
617 if (!_depList.empty()) {
618 for (auto i = 0u; i < _histObsList.size(); ++i) {
619 const auto harg = _histObsList[i];
620
621 if (evt < depData[i].size())
622 harg->setCachedValue(depData[i][evt], false);
623
624 if (!harg->inRange(nullptr)) {
625 results.push_back(-1);
626 continue;
627 }
628 }
629 }
630
631 results.push_back(_dataHist->getIndex(_histObsList, true));
632 }
633
634 return results;
635}
#define e(i)
Definition: RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define coutE(a)
Definition: RooMsgService.h:37
#define TRACE_DESTROY
Definition: RooTrace.h:24
#define TRACE_CREATE
Definition: RooTrace.h:23
#define ClassImp(name)
Definition: Rtypes.h:375
#define R__ASSERT(e)
Definition: TError.h:118
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
char name[80]
Definition: TGX11.cxx:110
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:71
RooRefArray _proxyList
Definition: RooAbsArg.h:635
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.
Definition: RooAbsArg.cxx:805
void registerProxy(RooArgProxy &proxy)
Register an RooArgProxy in the proxy list.
Definition: RooAbsArg.cxx:1233
virtual void ioStreamerPass2()
Method called by workspace container to finalize schema evolution issues that cannot be handled in a ...
Definition: RooAbsArg.cxx:2365
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
Definition: RooAbsBinning.h:25
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)
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
bool empty() const
Storage_t::size_type size() const
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
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...
RooAbsArg * find(const char *name) const
Find object with given name in list.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:62
Abstract base class for objects that are lvalues, i.e.
Definition: RooAbsLValue.h:26
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const =0
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
virtual void setVal(double value)=0
Set the current value of the object. Needs to be overridden by implementations.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:62
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition: RooAbsReal.h:91
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:56
RooCategory is an 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...
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:45
static TClass * Class()
Int_t getIndex(const RooAbsCollection &coord, bool fast=false) const
Calculate bin number of the given coordinates.
void weights(double *output, RooSpan< double const > xVals, int intOrder, bool correctForBinSize, bool cdfBoundaries)
A vectorized version of RooDataHist::weight() for one dimensional histograms with up to one dimension...
double weight(std::size_t i) const
Return weight of i-th bin.
Definition: RooDataHist.h:111
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...
Int_t numEntries() const override
Return the number of bins.
const RooArgSet * get() const override
Get bin centre of current bin.
Definition: RooDataHist.h:82
double sumEntries() const override
Sum the weights of all bins.
auto & at(RooAbsArg const *arg, RooAbsArg const *=nullptr)
Definition: DataMap.h:88
RooHistFunc implements a real-valued function sampled from a multidimensional histogram.
Definition: RooHistFunc.h:31
bool _cdfBoundaries
Use boundary conditions for CDFs.
Definition: RooHistFunc.h:113
RooDataHist * _dataHist
Unowned pointer to underlying histogram.
Definition: RooHistFunc.h:109
double _totVolume
! Total volume of space (product of ranges of observables)
Definition: RooHistFunc.h:114
std::vector< Int_t > getBins(RooFit::Detail::DataMap const &dataMap) const
Compute bin numbers corresponding to all coordinates in evalData.
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Return integral identified by 'code'.
~RooHistFunc() override
void computeBatch(cudaStream_t *, double *output, size_t size, RooFit::Detail::DataMap const &) const override
Base function for computing multiple values of a RooAbsReal.
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...
std::unique_ptr< RooDataHist > _ownedDataHist
! Owned pointer to underlying histogram
Definition: RooHistFunc.h:110
void ioStreamerPass2() override
Schema evolution: if histObsList wasn't filled from persistence (v1) then fill it here.
double evaluate() const override
Return the current value: The value of the bin enclosing the current coordinates of the dependents,...
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...
void Streamer(TBuffer &) override
Stream an object of class RooHistFunc.
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.
bool importWorkspaceHook(RooWorkspace &ws) override
Check if our datahist is already in the workspace.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Determine integration scenario.
Int_t _intOrder
Interpolation order.
Definition: RooHistFunc.h:112
static TClass * Class()
RooSetProxy _depList
List of observables mapped onto histogram observables.
Definition: RooHistFunc.h:108
RooArgSet _histObsList
List of observables defining dimensions of histogram.
Definition: RooHistFunc.h:107
static double analyticalIntegral(Int_t code, const char *rangeName, RooArgSet const &histObsList, RooSetProxy const &pdfObsList, RooDataHist &dataHist, bool histFuncMode)
Definition: RooHistPdf.cxx:317
static Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName, RooArgSet const &histObsList, RooSetProxy const &pdfObsList, Int_t intOrder)
Definition: RooHistPdf.cxx:276
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:40
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
RooAbsData * embeddedData(RooStringView name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
bool import(const RooAbsArg &arg, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Import a RooAbsArg object, e.g.
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
Bool_t IsReading() const
Definition: TBuffer.h:86
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
void Clear(Option_t *option="") override
Remove all objects from the array.
Definition: TObjArray.cxx:321
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:519
RooCmdArg Rename(const char *suffix)
RooCmdArg Embedded(bool flag=true)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
@ InputArguments
Definition: RooGlobalFunc.h:62
@ ObjectHandling
Definition: RooGlobalFunc.h:62
std::string getColonSeparatedNameString(RooArgSet const &argSet)
Create a string with all sorted names of RooArgSet elements separated by colons.
Definition: RooHelpers.cxx:282
TArc a
Definition: textangle.C:12
static void output()