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)
106 addParamSet( paramSet );
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)
141 addParamSet( paramSet );
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();
163 numBins *= varNumBins;
164 }
165
166 return numBins;
167}
168
169
170////////////////////////////////////////////////////////////////////////////////
171
173 RooAbsReal(other, name),
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
232void ParamHistFunc::setConstant( bool constant ) {
233 for( int i=0; i < numBins(); ++i) {
234 setParamConst(i, constant);
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
252 Int_t TH1BinNumber = 0;
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
293 RooArgList paramSet;
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 RooRealVar* varx = static_cast<RooRealVar*>(vars.at(0));
328 RooRealVar* vary = static_cast<RooRealVar*>(vars.at(1));
329
330 // For each bin, create a RooRealVar
331 for( Int_t j = 0; j < vary->numBins(); ++j) {
332 for( Int_t i = 0; i < varx->numBins(); ++i) {
333
334 // Ordering is important:
335 // To match TH1, list goes over x bins
336 // first, then y
337
338 std::stringstream VarNameStream;
339 VarNameStream << Prefix << "_bin_" << i << "_" << j;
340 std::string VarName = VarNameStream.str();
341
342 RooRealVar gamma( VarName.c_str(), VarName.c_str(), 1.0 );
343 // "Hard-Code" a minimum of 0.0
344 gamma.setMin( 0.0 );
345 gamma.setConstant( false );
346
347 w.import( gamma, RooFit::RecycleConflictNodes() );
348
349 paramSet.add(*w.arg(VarName));
350 }
351 }
352 }
353
354 else if( numVars == 3 ) {
355
356 RooRealVar* varx = static_cast<RooRealVar*>(vars.at(0));
357 RooRealVar* vary = static_cast<RooRealVar*>(vars.at(1));
358 RooRealVar* varz = static_cast<RooRealVar*>(vars.at(2));
359
360 // For each bin, create a RooRealVar
361 for( Int_t k = 0; k < varz->numBins(); ++k) {
362 for( Int_t j = 0; j < vary->numBins(); ++j) {
363 for( Int_t i = 0; i < varx->numBins(); ++i) {
364
365 // Ordering is important:
366 // To match TH1, list goes over x bins
367 // first, then y, then z
368
369 std::stringstream VarNameStream;
370 VarNameStream << Prefix << "_bin_" << i << "_" << j << "_" << k;
371 std::string VarName = VarNameStream.str();
372
373 RooRealVar gamma( VarName.c_str(), VarName.c_str(), 1.0 );
374 // "Hard-Code" a minimum of 0.0
375 gamma.setMin( 0.0 );
376 gamma.setConstant( false );
377
378 w.import( gamma, RooFit::RecycleConflictNodes() );
379
380 paramSet.add(*w.arg(VarName));
381 }
382 }
383 }
384 }
385
386 else {
387 std::cout << " Error: ParamHistFunc doesn't support dimensions > 3D " << std::endl;
388 }
389
390 return paramSet;
391
392}
393
394
395////////////////////////////////////////////////////////////////////////////////
396/// Create the list of RooRealVar parameters which scale the
397/// height of histogram bins.
398/// The list `vars` represents the observables (corresponding to histogram bins)
399/// that these newly created parameters will
400/// be mapped to. *I.e.*, we create one parameter
401/// per observable in `vars` and per bin in each observable.
402///
403/// The new parameters are initialised to 1 with an uncertainty of +/- 1.,
404/// their range is set to the function arguments.
405///
406/// Store the parameters in a list using:
407/// ```
408/// _paramSet.add( createParamSet() );
409/// ```
410/// This list is stored in the "TH1" index order.
412 const RooArgList& vars,
413 double gamma_min, double gamma_max) {
414
415
416
417 RooArgList params = ParamHistFunc::createParamSet( w, Prefix, vars );
418
419 for (auto comp : params) {
420 // If the gamma is subject to a preprocess function, it is a RooAbsReal and
421 // we don't need to set the range.
422 if(auto var = dynamic_cast<RooRealVar*>(comp)) {
423 var->setMin( gamma_min );
424 var->setMax( gamma_max );
425 }
426 }
427
428 return params;
429
430}
431
432
433////////////////////////////////////////////////////////////////////////////////
434/// Create the list of RooRealVar
435/// parameters which represent the
436/// height of the histogram bins.
437/// Store them in a list
438RooArgList ParamHistFunc::createParamSet(const std::string& Prefix, Int_t numBins,
439 double gamma_min, double gamma_max) {
440
441 // Get the number of bins
442 // in the nominal histogram
443
444 RooArgList paramSet;
445
446 if( gamma_max <= gamma_min ) {
447
448 std::cout << "Warning: gamma_min <= gamma_max: Using default values (0, 10)" << std::endl;
449
450 gamma_min = 0.0;
451 gamma_max = 10.0;
452
453 }
454
455 double gamma_nominal = 1.0;
456
457 if( gamma_nominal < gamma_min ) {
458 gamma_nominal = gamma_min;
459 }
460
461 if( gamma_nominal > gamma_max ) {
462 gamma_nominal = gamma_max;
463 }
464
465 // For each bin, create a RooRealVar
466 for( Int_t i = 0; i < numBins; ++i) {
467
468 std::stringstream VarNameStream;
469 VarNameStream << Prefix << "_bin_" << i;
470 std::string VarName = VarNameStream.str();
471
472 auto gamma = std::make_unique<RooRealVar>(VarName.c_str(), VarName.c_str(),
473 gamma_nominal, gamma_min, gamma_max);
474 gamma->setConstant( false );
475 paramSet.addOwned(std::move(gamma));
476
477 }
478
479 return paramSet;
480
481}
482
483
485 int numVars = vars.size();
486
487 if (numVars > 3 || numVars < 1) {
488 std::cout << "ParamHistFunc() - Only works for 1-3 variables (1d-3d)" << std::endl;
489 throw -1;
490 }
491
492 int numBinsX = numVars >= 1 ? static_cast<RooRealVar const&>(*vars[0]).numBins() : 1;
493 int numBinsY = numVars >= 2 ? static_cast<RooRealVar const&>(*vars[1]).numBins() : 1;
494 int numBinsZ = numVars >= 3 ? static_cast<RooRealVar const&>(*vars[2]).numBins() : 1;
495
496 return {numBinsX, numBinsY, numBinsZ};
497}
498
499
500////////////////////////////////////////////////////////////////////////////////
501/// Get the index of the gamma parameter associated with the current bin.
502/// e.g. `RooRealVar& currentParam = getParameter( getCurrentBin() );`
504 // We promise that our coordinates and the data hist coordinates have same layout.
505 return _dataSet.getIndex(_dataVars, /*fast=*/true);
506}
507
508
509////////////////////////////////////////////////////////////////////////////////
510
512 // return 0 for success
513 // return 1 for failure
514
515 // Check that the supplied list has
516 // the right number of arguments:
517
518 Int_t numVarBins = GetNumBins(_dataVars);
519 Int_t numElements = params.size();
520
521 if( numVarBins != numElements ) {
522 std::cout << "ParamHistFunc::addParamSet - ERROR - "
523 << "Supplied list of parameters " << params.GetName()
524 << " has " << numElements << " elements but the ParamHistFunc"
525 << GetName() << " has " << numVarBins << " bins."
526 << std::endl;
527 return 1;
528
529 }
530
531 // Check that the elements
532 // are actually RooAbsreal's
533 // If so, add them to the
534 // list of params
535
537
538 return 0;
539}
540
541
542////////////////////////////////////////////////////////////////////////////////
543/// Find the bin corresponding to the current value of the observable, and evaluate
544/// the associated parameter.
546{
547 return getParameter().getVal();
548}
549
550////////////////////////////////////////////////////////////////////////////////
551/// Find all bins corresponding to the values of the observables in `ctx`,
552// and evaluate the associated parameters.
553/// \param[in,out] ctx Input/output data for evaluating the ParamHistFunc.
555{
556 std::span<double> output = ctx.output();
557 std::size_t size = output.size();
558
559 auto const& n = _numBinsPerDim;
560 // check if _numBins needs to be filled
561 if(n.x == 0) {
563 }
564
565 // Different from the evaluate() funnction that first retrieves the indices
566 // corresponding to the RooDataHist and then transforms them, we can use the
567 // right bin multiplicators to begin with.
568 std::array<int, 3> idxMult{{1, n.x, n.xy}};
569
570 // As a working buffer for the bin indices, we use the tail of the output
571 // buffer. We can't use the same starting pointer, otherwise we would
572 // overwrite the later bin indices as we fill the output.
573 auto indexBuffer = reinterpret_cast<int*>(output.data() + size) - size;
574 std::fill(indexBuffer, indexBuffer + size, 0); // output buffer for bin indices needs to be zero-initialized
575
576 // Use the vectorized RooAbsBinning::binNumbers() to update the total bin
577 // index for each dimension, using the `coef` parameter to multiply with the
578 // right index multiplication factor for each dimension.
579 for (std::size_t iVar = 0; iVar < _dataVars.size(); ++iVar) {
580 _dataSet.getBinnings()[iVar]->binNumbers(ctx.at(&_dataVars[iVar]).data(), indexBuffer, size, idxMult[iVar]);
581 }
582
583 // Finally, look up the parameters and get their values to fill the output buffer
584 for (std::size_t i = 0; i < size; ++i) {
585 output[i] = static_cast<RooAbsReal const&>(_paramSet[indexBuffer[i]]).getVal();
586 }
587}
588
589////////////////////////////////////////////////////////////////////////////////
590/// Advertise that all integrals can be handled internally.
591
593 const RooArgSet* normSet,
594 const char* /*rangeName*/) const
595{
596 // Handle trivial no-integration scenario
597 if (allVars.empty()) return 0 ;
598 if (_forceNumInt) return 0 ;
599
600
601 // Select subset of allVars that are actual dependents
602 analVars.add(allVars) ;
603
604 // Check if this configuration was created before
605 Int_t sterileIdx(-1) ;
606 CacheElem* cache = static_cast<CacheElem*>(_normIntMgr.getObj(normSet,&analVars,&sterileIdx,(const char*)nullptr)) ;
607 if (cache) {
608 return _normIntMgr.lastIndex()+1 ;
609 }
610
611 // Create new cache element
612 cache = new CacheElem ;
613
614 // Store cache element
615 Int_t code = _normIntMgr.setObj(normSet,&analVars,cache,nullptr) ;
616
617 return code+1 ;
618
619}
620
621
622////////////////////////////////////////////////////////////////////////////////
623/// Implement analytical integrations by doing appropriate weighting from component integrals
624/// functions to integrators of components
625
626double ParamHistFunc::analyticalIntegralWN(Int_t /*code*/, const RooArgSet* /*normSet2*/,
627 const char* /*rangeName*/) const
628{
629 double value(0) ;
630
631 // Simply loop over bins,
632 // get the height, and
633 // multiply by the bind width
634 auto binVolumes = _dataSet.binVolumes(0, _dataSet.numEntries());
635
636 for (unsigned int i=0; i < _paramSet.size(); ++i) {
637 const auto& param = static_cast<const RooAbsReal&>(_paramSet[i]);
638
639 // Get the gamma's value
640 const double paramVal = param.getVal();
641
642 // Finally, get the subtotal
643 value += paramVal * binVolumes[i];
644 }
645
646 return value;
647
648}
649
650
651
652////////////////////////////////////////////////////////////////////////////////
653/// Return sampling hint for making curves of (projections) of this function
654/// as the recursive division strategy of RooCurve cannot deal efficiently
655/// with the vertical lines that occur in a non-interpolated histogram
656
657std::list<double>* ParamHistFunc::plotSamplingHint(RooAbsRealLValue& obs, double xlo,
658 double xhi) const
659{
660 // copied and edited from RooHistFunc
661 RooAbsLValue* lvarg = &obs;
662
663 // Retrieve position of all bin boundaries
664 const RooAbsBinning* binning = lvarg->getBinningPtr(nullptr);
665 double* boundaries = binning->array() ;
666
667 std::list<double>* hint = new std::list<double> ;
668
669 // Widen range slightly
670 xlo = xlo - 0.01*(xhi-xlo) ;
671 xhi = xhi + 0.01*(xhi-xlo) ;
672
673 double delta = (xhi-xlo)*1e-8 ;
674
675 // Construct array with pairs of points positioned epsilon to the left and
676 // right of the bin boundaries
677 for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
678 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
679 hint->push_back(boundaries[i]-delta) ;
680 hint->push_back(boundaries[i]+delta) ;
681 }
682 }
683 return hint ;
684}
685
686
687////////////////////////////////////////////////////////////////////////////////
688/// Return sampling hint for making curves of (projections) of this function
689/// as the recursive division strategy of RooCurve cannot deal efficiently
690/// with the vertical lines that occur in a non-interpolated histogram
691
692std::list<double> *ParamHistFunc::binBoundaries(RooAbsRealLValue &obs, double xlo, double xhi) const
693{
694 // copied and edited from RooHistFunc
695 RooAbsLValue *lvarg = &obs;
696
697 // look for variable in the DataHist, and if found, return the binning
698 std::string varName = dynamic_cast<TObject *>(lvarg)->GetName();
699 RooArgSet const &vars = *_dataSet.get(); // guaranteed to be in the same order as the binnings vector
700 auto &binnings = _dataSet.getBinnings();
701 for (size_t i = 0; i < vars.size(); i++) {
702 if (varName == vars[i]->GetName()) {
703 // found the variable, return its binning
704 double *boundaries = binnings.at(i)->array();
705 std::list<double> *hint = new std::list<double>;
706 for (int j = 0; j < binnings.at(i)->numBoundaries(); j++) {
707 if (boundaries[j] >= xlo && boundaries[j] <= xhi) {
708 hint->push_back(boundaries[j]);
709 }
710 }
711 return hint;
712 }
713 }
714 // variable not found, return null
715 return nullptr;
716}
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define oocoutE(o, a)
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:142
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.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
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 bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
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.
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const =0
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Int_t numBins(const char *rangeName=nullptr) const override
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:545
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:126
virtual Int_t GetNbinsY() const
Definition TH1.h:572
virtual Int_t GetNbinsZ() const
Definition TH1.h:573
virtual Int_t GetNbinsX() const
Definition TH1.h:571
Bool_t IsBinUnderflow(Int_t bin, Int_t axis=0) const
Return true if the bin is underflow.
Definition TH1.cxx:5392
Bool_t IsBinOverflow(Int_t bin, Int_t axis=0) const
Return true if the bin is overflow.
Definition TH1.cxx:5360
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:5239
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Mother of all ROOT objects.
Definition TObject.h:42
RooCmdArg RecycleConflictNodes(bool flag=true)
const Int_t n
Definition legend1.C:16