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