Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ParamHistFunc.cxx
Go to the documentation of this file.
1// @(#)root/roostats:$Id: cranmer $
2// Author: Kyle Cranmer, George Lewis
3/*************************************************************************
4 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11////////////////////////////////////////////////////////////////////////////////
12
13/** \class ParamHistFunc
14 * \ingroup HistFactory
15 * A class which maps the current values of a RooRealVar
16 * (or a set of RooRealVars) to one of a number of RooAbsReal
17 * (nominally RooRealVar):
18 *
19 * `ParamHistFunc: {val1, val2, ...} -> {gamma (RooRealVar)}`
20 *
21 * The intended interpretation is that each parameter in the
22 * range represent the height of a bin over the domain
23 * space.
24 *
25 * The 'createParamSet' is an easy way to create these
26 * parameters from a set of observables. They are
27 * stored using the "TH1" ordering convention (as compared
28 * to the RooDataHist convention, which is used internally
29 * and one must map between the two).
30 *
31 * All indices include '0':<br>
32 * \f$ \gamma_{i,j} \f$ = `paramSet[ size(i)*j + i ]`
33 *
34 * ie assuming the dimensions are 5*5:<br>
35 * \f$ \gamma_{2,1} \f$ = `paramSet[ 5*1 + 2 ] = paramSet[7]`
36 */
37
38
40
41#include "RooConstVar.h"
42#include "RooBinning.h"
43#include "RooErrorHandler.h"
44#include "RooArgSet.h"
45#include "RooMsgService.h"
46#include "RooRealVar.h"
47#include "RooArgList.h"
48#include "RooWorkspace.h"
49
50#include "TH1.h"
51
52#include <array>
53#include <sstream>
54#include <stdexcept>
55#include <iostream>
56
57
58
59////////////////////////////////////////////////////////////////////////////////
60
62 : _normIntMgr(this)
63{
64 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
65}
66
67
68////////////////////////////////////////////////////////////////////////////////
69/// Create a function which returns binewise-values
70/// This class contains N RooAbsReals's, one for each
71/// bin from the given RooRealVar.
72///
73/// The value of the function in the ith bin is
74/// given by:
75///
76/// F(i) = gamma_i * nominal(i)
77///
78/// Where the nominal values are simply fixed
79/// numbers (default = 1.0 for all i)
80ParamHistFunc::ParamHistFunc(const char* name, const char* title,
81 const RooArgList& vars, const RooArgList& paramSet) :
82 RooAbsReal(name, title),
83 _normIntMgr(this),
84 _dataVars("!dataVars","data Vars", this),
85 _paramSet("!paramSet","bin parameters", this),
86 _dataSet( (std::string(name)+"_dataSet").c_str(), "", vars)
87{
88
89 // Create the dataset that stores the binning info:
90
91 // _dataSet = RooDataSet("
92
93 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
94
95 // Set the binning
96 // //_binning = var.getBinning().clone() ;
97
98 // Create the set of parameters
99 // controlling the height of each bin
100
101 // Get the number of bins
102 _numBins = GetNumBins( vars );
103
104 // Add the parameters (with checking)
107}
108
109
110////////////////////////////////////////////////////////////////////////////////
111/// Create a function which returns bin-wise values.
112/// This class allows to multiply bin contents of histograms
113/// with the values of a set of RooAbsReal.
114///
115/// The value of the function in the ith bin is
116/// given by:
117/// \f[
118/// F(i) = \gamma_{i} * \mathrm{nominal}(i)
119/// \f]
120///
121/// Where the nominal values are taken from the histogram,
122/// and the \f$ \gamma_{i} \f$ can be set from the outside.
123ParamHistFunc::ParamHistFunc(const char* name, const char* title,
124 const RooArgList& vars, const RooArgList& paramSet,
125 const TH1* Hist ) :
126 RooAbsReal(name, title),
127 _normIntMgr(this),
128 // _dataVar("!dataVar","data Var", this, (RooRealVar&) var),
129 _dataVars("!dataVars","data Vars", this),
130 _paramSet("!paramSet","bin parameters", this),
131 _dataSet( (std::string(name)+"_dataSet").c_str(), "", vars, Hist)
132{
133
134 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
135
136 // Get the number of bins
137 _numBins = GetNumBins( vars );
138
139 // Add the parameters (with checking)
142}
143
144
146
147 // A helper method to get the number of bins
148
149 if( vars.empty() ) return 0;
150
151 Int_t numBins = 1;
152
153 for (auto comp : vars) {
154 if (!dynamic_cast<RooRealVar*>(comp)) {
155 auto errorMsg = std::string("ParamHistFunc::GetNumBins") + vars.GetName() + ") ERROR: component "
156 + comp->GetName() + " in vars list is not of type RooRealVar";
157 oocoutE(nullptr, InputArguments) << errorMsg << std::endl;
158 throw std::runtime_error(errorMsg);
159 }
160 auto var = static_cast<RooRealVar*>(comp);
161
162 Int_t varNumBins = var->numBins();
164 }
165
166 return numBins;
167}
168
169
170////////////////////////////////////////////////////////////////////////////////
171
174 _normIntMgr(other._normIntMgr, this),
175 _dataVars("!dataVars", this, other._dataVars ),
176 _paramSet("!paramSet", this, other._paramSet),
177 _numBins( other._numBins ),
178 _dataSet( other._dataSet )
179{
180 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
181
182 // Copy constructor
183 // Member _ownedList is intentionally not copy-constructed -- ownership is not transferred
184}
185
186
187////////////////////////////////////////////////////////////////////////////////
188/// Get the parameter associated with the index.
189/// The index follows RooDataHist indexing conventions.
190/// It uses the binMap to convert the RooDataSet style index
191/// into the TH1 style index (which is how they are stored
192/// internally in the '_paramSet' vector).
194
195 auto const& n = _numBinsPerDim;
196
197 // check if _numBins needs to be filled
198 if(n.x == 0) {
200 }
201
202 // Unravel the index to 3D coordinates. We can't use the index directly,
203 // because in the parameter set the dimensions are ordered in reverse order
204 // compared to the RooDataHist (for historical reasons).
205 const int i = index / n.yz;
206 const int tmp = index % n.yz;
207 const int j = tmp / n.z;
208 const int k = tmp % n.z;
209
210 const int idx = i + j * n.x + k * n.xy;
211 if (idx >= _numBins) {
212 throw std::runtime_error("invalid index");
213 }
214 return static_cast<RooAbsReal &>(_paramSet[idx]);
215}
216
217
218////////////////////////////////////////////////////////////////////////////////
219
224
225
227 RooAbsReal& var = getParameter( index );
228 var.setAttribute( "Constant", varConst );
229}
230
231
233 for( int i=0; i < numBins(); ++i) {
235 }
236}
237
238
239////////////////////////////////////////////////////////////////////////////////
240
242 int num_hist_bins = shape->GetNbinsX()*shape->GetNbinsY()*shape->GetNbinsZ();
243
244 if( num_hist_bins != numBins() ) {
245 std::cout << "Error - ParamHistFunc: cannot set Shape of ParamHistFunc: " << GetName()
246 << " using histogram: " << shape->GetName()
247 << ". Bins don't match" << std::endl;
248 throw std::runtime_error("setShape");
249 }
250
251
253 for( Int_t i = 0; i < numBins(); ++i) {
254
255 TH1BinNumber++;
256
257 while( shape->IsBinUnderflow(TH1BinNumber) || shape->IsBinOverflow(TH1BinNumber) ){
258 TH1BinNumber++;
259 }
260
261 RooRealVar* param = dynamic_cast<RooRealVar*>(&_paramSet[i]);
262 if(!param) {
263 std::cout << "Error - ParamHisFunc: cannot set Shape of ParamHistFunc: " << GetName()
264 << " - param is not RooRealVar" << std::endl;
265 throw std::runtime_error("setShape");
266 }
267 param->setVal( shape->GetBinContent(TH1BinNumber) );
268 }
269
270}
271
272
273////////////////////////////////////////////////////////////////////////////////
274/// Create the list of RooRealVar
275/// parameters which represent the
276/// height of the histogram bins.
277/// The list 'vars' represents the
278/// observables (corresponding to histogram bins)
279/// that these newly created parameters will
280/// be mapped to. (ie, we create one parameter
281/// per observable in vars and per bin in each observable)
282
283/// Store them in a list using:
284/// _paramSet.add( createParamSet() );
285/// This list is stored in the "TH1" index order
287 const RooArgList& vars) {
288
289
290 // Get the number of bins
291 // in the nominal histogram
292
294
295 Int_t numVars = vars.size();
296 Int_t numBins = GetNumBins( vars );
297
298 if( numVars == 0 ) {
299 std::cout << "Warning - ParamHistFunc::createParamSet() :"
300 << " No Variables provided. Not making constraint terms."
301 << std::endl;
302 return paramSet;
303 }
304
305 else if( numVars == 1 ) {
306
307 // For each bin, create a RooRealVar
308 for( Int_t i = 0; i < numBins; ++i) {
309
310 std::stringstream VarNameStream;
311 VarNameStream << Prefix << "_bin_" << i;
312 std::string VarName = VarNameStream.str();
313
314 RooRealVar gamma( VarName.c_str(), VarName.c_str(), 1.0 );
315 // "Hard-Code" a minimum of 0.0
316 gamma.setMin( 0.0 );
317 gamma.setConstant( false );
318
319 w.import( gamma, RooFit::RecycleConflictNodes() );
320
321 paramSet.add(*w.arg(VarName));
322 }
323 }
324
325 else if( numVars == 2 ) {
326
327 // Create a vector of indices
328 // all starting at 0
329 std::vector< Int_t > Indices(numVars, 0);
330
331 RooRealVar* varx = static_cast<RooRealVar*>(vars.at(0));
332 RooRealVar* vary = static_cast<RooRealVar*>(vars.at(1));
333
334 // For each bin, create a RooRealVar
335 for( Int_t j = 0; j < vary->numBins(); ++j) {
336 for( Int_t i = 0; i < varx->numBins(); ++i) {
337
338 // Ordering is important:
339 // To match TH1, list goes over x bins
340 // first, then y
341
342 std::stringstream VarNameStream;
343 VarNameStream << Prefix << "_bin_" << i << "_" << j;
344 std::string VarName = VarNameStream.str();
345
346 RooRealVar gamma( VarName.c_str(), VarName.c_str(), 1.0 );
347 // "Hard-Code" a minimum of 0.0
348 gamma.setMin( 0.0 );
349 gamma.setConstant( false );
350
351 w.import( gamma, RooFit::RecycleConflictNodes() );
352
353 paramSet.add(*w.arg(VarName));
354 }
355 }
356 }
357
358 else if( numVars == 3 ) {
359
360 // Create a vector of indices
361 // all starting at 0
362 std::vector< Int_t > Indices(numVars, 0);
363
364 RooRealVar* varx = static_cast<RooRealVar*>(vars.at(0));
365 RooRealVar* vary = static_cast<RooRealVar*>(vars.at(1));
366 RooRealVar* varz = static_cast<RooRealVar*>(vars.at(2));
367
368 // For each bin, create a RooRealVar
369 for( Int_t k = 0; k < varz->numBins(); ++k) {
370 for( Int_t j = 0; j < vary->numBins(); ++j) {
371 for( Int_t i = 0; i < varx->numBins(); ++i) {
372
373 // Ordering is important:
374 // To match TH1, list goes over x bins
375 // first, then y, then z
376
377 std::stringstream VarNameStream;
378 VarNameStream << Prefix << "_bin_" << i << "_" << j << "_" << k;
379 std::string VarName = VarNameStream.str();
380
381 RooRealVar gamma( VarName.c_str(), VarName.c_str(), 1.0 );
382 // "Hard-Code" a minimum of 0.0
383 gamma.setMin( 0.0 );
384 gamma.setConstant( false );
385
386 w.import( gamma, RooFit::RecycleConflictNodes() );
387
388 paramSet.add(*w.arg(VarName));
389 }
390 }
391 }
392 }
393
394 else {
395 std::cout << " Error: ParamHistFunc doesn't support dimensions > 3D " << std::endl;
396 }
397
398 return paramSet;
399
400}
401
402
403////////////////////////////////////////////////////////////////////////////////
404/// Create the list of RooRealVar parameters which scale the
405/// height of histogram bins.
406/// The list `vars` represents the observables (corresponding to histogram bins)
407/// that these newly created parameters will
408/// be mapped to. *I.e.*, we create one parameter
409/// per observable in `vars` and per bin in each observable.
410///
411/// The new parameters are initialised to 1 with an uncertainty of +/- 1.,
412/// their range is set to the function arguments.
413///
414/// Store the parameters in a list using:
415/// ```
416/// _paramSet.add( createParamSet() );
417/// ```
418/// This list is stored in the "TH1" index order.
420 const RooArgList& vars,
421 double gamma_min, double gamma_max) {
422
423
424
426
427 for (auto comp : params) {
428 // If the gamma is subject to a preprocess function, it is a RooAbsReal and
429 // we don't need to set the range.
430 if(auto var = dynamic_cast<RooRealVar*>(comp)) {
431 var->setMin( gamma_min );
432 var->setMax( gamma_max );
433 }
434 }
435
436 return params;
437
438}
439
440
441////////////////////////////////////////////////////////////////////////////////
442/// Create the list of RooRealVar
443/// parameters which represent the
444/// height of the histogram bins.
445/// Store them in a list
447 double gamma_min, double gamma_max) {
448
449 // Get the number of bins
450 // in the nominal histogram
451
453
454 if( gamma_max <= gamma_min ) {
455
456 std::cout << "Warning: gamma_min <= gamma_max: Using default values (0, 10)" << std::endl;
457
458 gamma_min = 0.0;
459 gamma_max = 10.0;
460
461 }
462
463 double gamma_nominal = 1.0;
464
465 if( gamma_nominal < gamma_min ) {
467 }
468
469 if( gamma_nominal > gamma_max ) {
471 }
472
473 // For each bin, create a RooRealVar
474 for( Int_t i = 0; i < numBins; ++i) {
475
476 std::stringstream VarNameStream;
477 VarNameStream << Prefix << "_bin_" << i;
478 std::string VarName = VarNameStream.str();
479
480 auto gamma = std::make_unique<RooRealVar>(VarName.c_str(), VarName.c_str(),
482 gamma->setConstant( false );
483 paramSet.addOwned(std::move(gamma));
484
485 }
486
487 return paramSet;
488
489}
490
491
493 int numVars = vars.size();
494
495 if (numVars > 3 || numVars < 1) {
496 std::cout << "ParamHistFunc() - Only works for 1-3 variables (1d-3d)" << std::endl;
497 throw -1;
498 }
499
500 int numBinsX = numVars >= 1 ? static_cast<RooRealVar const&>(*vars[0]).numBins() : 1;
501 int numBinsY = numVars >= 2 ? static_cast<RooRealVar const&>(*vars[1]).numBins() : 1;
502 int numBinsZ = numVars >= 3 ? static_cast<RooRealVar const&>(*vars[2]).numBins() : 1;
503
504 return {numBinsX, numBinsY, numBinsZ};
505}
506
507
508////////////////////////////////////////////////////////////////////////////////
509/// Get the index of the gamma parameter associated with the current bin.
510/// e.g. `RooRealVar& currentParam = getParameter( getCurrentBin() );`
512 // We promise that our coordinates and the data hist coordinates have same layout.
513 return _dataSet.getIndex(_dataVars, /*fast=*/true);
514}
515
516
517////////////////////////////////////////////////////////////////////////////////
518
520 // return 0 for success
521 // return 1 for failure
522
523 // Check that the supplied list has
524 // the right number of arguments:
525
527 Int_t numElements = params.size();
528
529 if( numVarBins != numElements ) {
530 std::cout << "ParamHistFunc::addParamSet - ERROR - "
531 << "Supplied list of parameters " << params.GetName()
532 << " has " << numElements << " elements but the ParamHistFunc"
533 << GetName() << " has " << numVarBins << " bins."
534 << std::endl;
535 return 1;
536
537 }
538
539 // Check that the elements
540 // are actually RooAbsreal's
541 // If so, add them to the
542 // list of params
543
545
546 return 0;
547}
548
549
550////////////////////////////////////////////////////////////////////////////////
551/// Find the bin corresponding to the current value of the observable, and evaluate
552/// the associated parameter.
554{
555 return getParameter().getVal();
556}
557
558////////////////////////////////////////////////////////////////////////////////
559/// Find all bins corresponding to the values of the observables in `ctx`,
560// and evaluate the associated parameters.
561/// \param[in,out] ctx Input/output data for evaluating the ParamHistFunc.
563{
564 std::span<double> output = ctx.output();
565 std::size_t size = output.size();
566
567 auto const& n = _numBinsPerDim;
568 // check if _numBins needs to be filled
569 if(n.x == 0) {
571 }
572
573 // Different from the evaluate() funnction that first retrieves the indices
574 // corresponding to the RooDataHist and then transforms them, we can use the
575 // right bin multiplicators to begin with.
576 std::array<int, 3> idxMult{{1, n.x, n.xy}};
577
578 // As a working buffer for the bin indices, we use the tail of the output
579 // buffer. We can't use the same starting pointer, otherwise we would
580 // overwrite the later bin indices as we fill the output.
581 auto indexBuffer = reinterpret_cast<int*>(output.data() + size) - size;
582 std::fill(indexBuffer, indexBuffer + size, 0); // output buffer for bin indices needs to be zero-initialized
583
584 // Use the vectorized RooAbsBinning::binNumbers() to update the total bin
585 // index for each dimension, using the `coef` parameter to multiply with the
586 // right index multiplication factor for each dimension.
587 for (std::size_t iVar = 0; iVar < _dataVars.size(); ++iVar) {
588 _dataSet.getBinnings()[iVar]->binNumbers(ctx.at(&_dataVars[iVar]).data(), indexBuffer, size, idxMult[iVar]);
589 }
590
591 // Finally, look up the parameters and get their values to fill the output buffer
592 for (std::size_t i = 0; i < size; ++i) {
593 output[i] = static_cast<RooAbsReal const&>(_paramSet[indexBuffer[i]]).getVal();
594 }
595}
596
597////////////////////////////////////////////////////////////////////////////////
598/// Advertise that all integrals can be handled internally.
599
601 const RooArgSet* normSet,
602 const char* /*rangeName*/) const
603{
604 // Handle trivial no-integration scenario
605 if (allVars.empty()) return 0 ;
606 if (_forceNumInt) return 0 ;
607
608
609 // Select subset of allVars that are actual dependents
610 analVars.add(allVars) ;
611
612 // Check if this configuration was created before
613 Int_t sterileIdx(-1) ;
614 CacheElem* cache = static_cast<CacheElem*>(_normIntMgr.getObj(normSet,&analVars,&sterileIdx,(const char*)nullptr)) ;
615 if (cache) {
616 return _normIntMgr.lastIndex()+1 ;
617 }
618
619 // Create new cache element
620 cache = new CacheElem ;
621
622 // Store cache element
623 Int_t code = _normIntMgr.setObj(normSet,&analVars,cache,nullptr) ;
624
625 return code+1 ;
626
627}
628
629
630////////////////////////////////////////////////////////////////////////////////
631/// Implement analytical integrations by doing appropriate weighting from component integrals
632/// functions to integrators of components
633
634double ParamHistFunc::analyticalIntegralWN(Int_t /*code*/, const RooArgSet* /*normSet2*/,
635 const char* /*rangeName*/) const
636{
637 double value(0) ;
638
639 // Simply loop over bins,
640 // get the height, and
641 // multiply by the bind width
642 auto binVolumes = _dataSet.binVolumes(0, _dataSet.numEntries());
643
644 for (unsigned int i=0; i < _paramSet.size(); ++i) {
645 const auto& param = static_cast<const RooAbsReal&>(_paramSet[i]);
646
647 // Get the gamma's value
648 const double paramVal = param.getVal();
649
650 // Finally, get the subtotal
651 value += paramVal * binVolumes[i];
652 }
653
654 return value;
655
656}
657
658
659
660////////////////////////////////////////////////////////////////////////////////
661/// Return sampling hint for making curves of (projections) of this function
662/// as the recursive division strategy of RooCurve cannot deal efficiently
663/// with the vertical lines that occur in a non-interpolated histogram
664
665std::list<double>* ParamHistFunc::plotSamplingHint(RooAbsRealLValue& obs, double xlo,
666 double xhi) const
667{
668 // copied and edited from RooHistFunc
669 RooAbsLValue* lvarg = &obs;
670
671 // Retrieve position of all bin boundaries
672 const RooAbsBinning* binning = lvarg->getBinningPtr(nullptr);
673 double* boundaries = binning->array() ;
674
675 std::list<double>* hint = new std::list<double> ;
676
677 // Widen range slightly
678 xlo = xlo - 0.01*(xhi-xlo) ;
679 xhi = xhi + 0.01*(xhi-xlo) ;
680
681 double delta = (xhi-xlo)*1e-8 ;
682
683 // Construct array with pairs of points positioned epsilon to the left and
684 // right of the bin boundaries
685 for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
686 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
687 hint->push_back(boundaries[i]-delta) ;
688 hint->push_back(boundaries[i]+delta) ;
689 }
690 }
691 return hint ;
692}
693
694
695////////////////////////////////////////////////////////////////////////////////
696/// Return sampling hint for making curves of (projections) of this function
697/// as the recursive division strategy of RooCurve cannot deal efficiently
698/// with the vertical lines that occur in a non-interpolated histogram
699
700std::list<double> *ParamHistFunc::binBoundaries(RooAbsRealLValue &obs, double xlo, double xhi) const
701{
702 // copied and edited from RooHistFunc
703 RooAbsLValue *lvarg = &obs;
704
705 // look for variable in the DataHist, and if found, return the binning
706 std::string varName = dynamic_cast<TObject *>(lvarg)->GetName();
707 RooArgSet const &vars = *_dataSet.get(); // guaranteed to be in the same order as the binnings vector
708 auto &binnings = _dataSet.getBinnings();
709 for (size_t i = 0; i < vars.size(); i++) {
710 if (varName == vars[i]->GetName()) {
711 // found the variable, return its binning
712 double *boundaries = binnings.at(i)->array();
713 std::list<double> *hint = new std::list<double>;
714 for (int j = 0; j < binnings.at(i)->numBoundaries(); j++) {
715 if (boundaries[j] >= xlo && boundaries[j] <= xhi) {
716 hint->push_back(boundaries[j]);
717 }
718 }
719 return hint;
720 }
721 }
722 // variable not found, return null
723 return nullptr;
724}
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define oocoutE(o, a)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
A class which maps the current values of a RooRealVar (or a set of RooRealVars) to one of a number of...
static NumBins getNumBinsPerDim(RooArgSet const &vars)
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...
RooDataHist _dataSet
static Int_t GetNumBins(const RooArgSet &vars)
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Implement analytical integrations by doing appropriate weighting from component integrals functions t...
void setConstant(bool constant)
Int_t getCurrentBin() const
Get the index of the gamma parameter associated with the current bin.
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Advertise that all integrals can be handled internally.
RooObjCacheManager _normIntMgr
! The integration cache manager
Int_t numBins() const
double evaluate() const override
Find the bin corresponding to the current value of the observable, and evaluate the associated parame...
void doEval(RooFit::EvalContext &) const override
Find all bins corresponding to the values of the observables in ctx,.
RooAbsReal & getParameter() const
Int_t addParamSet(const RooArgList &params)
NumBins _numBinsPerDim
static RooArgList createParamSet(RooWorkspace &w, const std::string &, const RooArgList &Vars)
Create the list of RooRealVar parameters which represent the height of the histogram bins.
void setParamConst(Int_t, bool=true)
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...
RooListProxy _paramSet
interpolation parameters
void setShape(TH1 *shape)
RooListProxy _dataVars
The RooRealVars.
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
Abstract base class for RooRealVar binning definitions.
virtual Int_t numBoundaries() const =0
virtual double * array() const =0
const char * GetName() const override
Returns name of object.
Storage_t::size_type size() const
bool addTyped(const RooAbsCollection &list, bool silent=false)
Adds elements of a given RooAbsCollection to the container if they match the specified type.
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 base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:63
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:107
bool _forceNumInt
Force numerical integration if flag set.
Definition RooAbsReal.h:542
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Definition RooArgList.h:110
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr)
Setter function without integration set.
Int_t lastIndex() const
Return index of slot used in last get or set operation.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr)
Getter function without integration set.
std::vector< std::unique_ptr< const RooAbsBinning > > const & getBinnings() const
Int_t getIndex(const RooAbsCollection &coord, bool fast=false) const
Calculate bin number of the given coordinates.
void removeSelfFromDir()
std::span< const double > binVolumes(std::size_t first, std::size_t len) const
Retrieve all bin volumes. Bins are indexed according to getIndex().
Definition RooDataHist.h:95
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()
Variable that can be changed from the outside.
Definition RooRealVar.h:37
void setVal(double value) override
Set value of variable to 'value'.
Persistable container for RooFit projects.
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:108
virtual Int_t GetNbinsY() const
Definition TH1.h:542
virtual Int_t GetNbinsZ() const
Definition TH1.h:543
virtual Int_t GetNbinsX() const
Definition TH1.h:541
Bool_t IsBinUnderflow(Int_t bin, Int_t axis=0) const
Return true if the bin is underflow.
Definition TH1.cxx:5217
Bool_t IsBinOverflow(Int_t bin, Int_t axis=0) const
Return true if the bin is overflow.
Definition TH1.cxx:5185
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:5064
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Mother of all ROOT objects.
Definition TObject.h:41
RooCmdArg RecycleConflictNodes(bool flag=true)
const Int_t n
Definition legend1.C:16
static int Prefix[4096]
Definition gifdecode.c:12
static void output()