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#include "RunContext.h"
50
51#include "TH1.h"
52
53#include <sstream>
54#include <stdexcept>
55#include <iostream>
56
58
59
60////////////////////////////////////////////////////////////////////////////////
61
63 : _normIntMgr(this), _numBins(0)
64{
65 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
66}
67
68
69////////////////////////////////////////////////////////////////////////////////
70/// Create a function which returns binewise-values
71/// This class contains N RooAbsReals's, one for each
72/// bin from the given RooRealVar.
73///
74/// The value of the function in the ith bin is
75/// given by:
76///
77/// F(i) = gamma_i * nominal(i)
78///
79/// Where the nominal values are simply fixed
80/// numbers (default = 1.0 for all i)
81ParamHistFunc::ParamHistFunc(const char* name, const char* title,
82 const RooArgList& vars, const RooArgList& paramSet) :
83 RooAbsReal(name, title),
84 _normIntMgr(this),
85 _dataVars("!dataVars","data Vars", this),
86 _paramSet("!paramSet","bin parameters", this),
87 _numBins(0),
88 _dataSet( (std::string(name)+"_dataSet").c_str(), "", vars)
89{
90
91 // Create the dataset that stores the binning info:
92
93 // _dataSet = RooDataSet("
94
95 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
96
97 // Set the binning
98 // //_binning = var.getBinning().clone() ;
99
100 // Create the set of parameters
101 // controlling the height of each bin
102
103 // Get the number of bins
104 _numBins = GetNumBins( vars );
105
106 // Add the parameters (with checking)
107 addVarSet( vars );
108 addParamSet( paramSet );
109}
110
111
112////////////////////////////////////////////////////////////////////////////////
113/// Create a function which returns bin-wise values.
114/// This class allows to multiply bin contents of histograms
115/// with the values of a set of RooAbsReal.
116///
117/// The value of the function in the ith bin is
118/// given by:
119/// \f[
120/// F(i) = \gamma_{i} * \mathrm{nominal}(i)
121/// \f]
122///
123/// Where the nominal values are taken from the histogram,
124/// and the \f$ \gamma_{i} \f$ can be set from the outside.
125ParamHistFunc::ParamHistFunc(const char* name, const char* title,
126 const RooArgList& vars, const RooArgList& paramSet,
127 const TH1* Hist ) :
128 RooAbsReal(name, title),
129 _normIntMgr(this),
130 // _dataVar("!dataVar","data Var", this, (RooRealVar&) var),
131 _dataVars("!dataVars","data Vars", this),
132 _paramSet("!paramSet","bin parameters", this),
133 _numBins(0),
134 _dataSet( (std::string(name)+"_dataSet").c_str(), "", vars, Hist)
135{
136
137 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
138
139 // Get the number of bins
140 _numBins = GetNumBins( vars );
141
142 // Add the parameters (with checking)
143 addVarSet( vars );
144 addParamSet( paramSet );
145}
146
147
149
150 // A helper method to get the number of bins
151
152 if( vars.getSize() == 0 ) return 0;
153
154 Int_t numBins = 1;
155
156 for (auto comp : vars) {
157 if (!dynamic_cast<RooRealVar*>(comp)) {
158 auto errorMsg = std::string("ParamHistFunc::GetNumBins") + vars.GetName() + ") ERROR: component "
159 + comp->GetName() + " in vars list is not of type RooRealVar";
160 oocoutE(static_cast<TObject*>(nullptr), InputArguments) << errorMsg << std::endl;
161 throw std::runtime_error(errorMsg);
162 }
163 auto var = static_cast<RooRealVar*>(comp);
164
165 Int_t varNumBins = var->numBins();
166 numBins *= varNumBins;
167 }
168
169 return numBins;
170}
171
172
173////////////////////////////////////////////////////////////////////////////////
174
176 RooAbsReal(other, name),
177 _normIntMgr(other._normIntMgr, this),
178 _dataVars("!dataVars", this, other._dataVars ),
179 _paramSet("!paramSet", this, other._paramSet),
180 _numBins( other._numBins ),
181 _dataSet( other._dataSet )
182{
183 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
184
185 // Copy constructor
186 // Member _ownedList is intentionally not copy-constructed -- ownership is not transferred
187}
188
189
190////////////////////////////////////////////////////////////////////////////////
191
193{
194 ;
195}
196
197
198////////////////////////////////////////////////////////////////////////////////
199/// Get the parameter associated with the index.
200/// The index follows RooDataHist indexing conventions.
201/// It uses the binMap to convert the RooDataSet style index
202/// into the TH1 style index (which is how they are stored
203/// internally in the '_paramSet' vector).
205
206 auto const& n = _numBinsPerDim;
207
208 // check if _numBins needs to be filled
209 if(n.x == 0) {
211 }
212
213 // Unravel the index to 3D coordinates. We can't use the index directly,
214 // because in the parameter set the dimensions are ordered in reverse order
215 // compared to the RooDataHist (for historical reasons).
216 const int i = index / n.yz;
217 const int tmp = index % n.yz;
218 const int j = tmp / n.z;
219 const int k = tmp % n.z;
220
221 return static_cast<RooAbsReal&>(_paramSet[i + j * n.x + k * n.xy]);
222}
223
224
225////////////////////////////////////////////////////////////////////////////////
226
228 Int_t index = getCurrentBin();
229 return getParameter( index );
230}
231
232
234 RooAbsReal& var = getParameter( index );
235 var.setAttribute( "Constant", varConst );
236}
237
238
239void ParamHistFunc::setConstant( bool constant ) {
240 for( int i=0; i < numBins(); ++i) {
241 setParamConst(i, constant);
242 }
243}
244
245
246////////////////////////////////////////////////////////////////////////////////
247
249 int num_hist_bins = shape->GetNbinsX()*shape->GetNbinsY()*shape->GetNbinsZ();
250
251 if( num_hist_bins != numBins() ) {
252 std::cout << "Error - ParamHistFunc: cannot set Shape of ParamHistFunc: " << GetName()
253 << " using histogram: " << shape->GetName()
254 << ". Bins don't match" << std::endl;
255 throw std::runtime_error("setShape");
256 }
257
258
259 Int_t TH1BinNumber = 0;
260 for( Int_t i = 0; i < numBins(); ++i) {
261
262 TH1BinNumber++;
263
264 while( shape->IsBinUnderflow(TH1BinNumber) || shape->IsBinOverflow(TH1BinNumber) ){
265 TH1BinNumber++;
266 }
267
268 RooRealVar* param = dynamic_cast<RooRealVar*>(&_paramSet[i]);
269 if(!param) {
270 std::cout << "Error - ParamHisFunc: cannot set Shape of ParamHistFunc: " << GetName()
271 << " - param is not RooRealVar" << std::endl;
272 throw std::runtime_error("setShape");
273 }
274 param->setVal( shape->GetBinContent(TH1BinNumber) );
275 }
276
277}
278
279
280////////////////////////////////////////////////////////////////////////////////
281/// Create the list of RooRealVar
282/// parameters which represent the
283/// height of the histogram bins.
284/// The list 'vars' represents the
285/// observables (corresponding to histogram bins)
286/// that these newly created parameters will
287/// be mapped to. (ie, we create one parameter
288/// per observable in vars and per bin in each observable)
289
290/// Store them in a list using:
291/// _paramSet.add( createParamSet() );
292/// This list is stored in the "TH1" index order
294 const RooArgList& vars) {
295
296
297 // Get the number of bins
298 // in the nominal histogram
299
300 RooArgList paramSet;
301
302 Int_t numVars = vars.getSize();
303 Int_t numBins = GetNumBins( vars );
304
305 if( numVars == 0 ) {
306 std::cout << "Warning - ParamHistFunc::createParamSet() :"
307 << " No Variables provided. Not making constraint terms."
308 << std::endl;
309 return paramSet;
310 }
311
312 else if( numVars == 1 ) {
313
314 // For each bin, create a RooRealVar
315 for( Int_t i = 0; i < numBins; ++i) {
316
317 std::stringstream VarNameStream;
318 VarNameStream << Prefix << "_bin_" << i;
319 std::string VarName = VarNameStream.str();
320
321 RooRealVar gamma( VarName.c_str(), VarName.c_str(), 1.0 );
322 // "Hard-Code" a minimum of 0.0
323 gamma.setMin( 0.0 );
324 gamma.setConstant( false );
325
327 RooRealVar* gamma_wspace = (RooRealVar*) w.var( VarName.c_str() );
328
329 paramSet.add( *gamma_wspace );
330
331 }
332 }
333
334 else if( numVars == 2 ) {
335
336 // Create a vector of indices
337 // all starting at 0
338 std::vector< Int_t > Indices(numVars, 0);
339
340 RooRealVar* varx = (RooRealVar*) vars.at(0);
341 RooRealVar* vary = (RooRealVar*) vars.at(1);
342
343 // For each bin, create a RooRealVar
344 for( Int_t j = 0; j < vary->numBins(); ++j) {
345 for( Int_t i = 0; i < varx->numBins(); ++i) {
346
347 // Ordering is important:
348 // To match TH1, list goes over x bins
349 // first, then y
350
351 std::stringstream VarNameStream;
352 VarNameStream << Prefix << "_bin_" << i << "_" << j;
353 std::string VarName = VarNameStream.str();
354
355 RooRealVar gamma( VarName.c_str(), VarName.c_str(), 1.0 );
356 // "Hard-Code" a minimum of 0.0
357 gamma.setMin( 0.0 );
358 gamma.setConstant( false );
359
361 RooRealVar* gamma_wspace = (RooRealVar*) w.var( VarName.c_str() );
362
363 paramSet.add( *gamma_wspace );
364
365 }
366 }
367 }
368
369 else if( numVars == 3 ) {
370
371 // Create a vector of indices
372 // all starting at 0
373 std::vector< Int_t > Indices(numVars, 0);
374
375 RooRealVar* varx = (RooRealVar*) vars.at(0);
376 RooRealVar* vary = (RooRealVar*) vars.at(1);
377 RooRealVar* varz = (RooRealVar*) vars.at(2);
378
379 // For each bin, create a RooRealVar
380 for( Int_t k = 0; k < varz->numBins(); ++k) {
381 for( Int_t j = 0; j < vary->numBins(); ++j) {
382 for( Int_t i = 0; i < varx->numBins(); ++i) {
383
384 // Ordering is important:
385 // To match TH1, list goes over x bins
386 // first, then y, then z
387
388 std::stringstream VarNameStream;
389 VarNameStream << Prefix << "_bin_" << i << "_" << j << "_" << k;
390 std::string VarName = VarNameStream.str();
391
392 RooRealVar gamma( VarName.c_str(), VarName.c_str(), 1.0 );
393 // "Hard-Code" a minimum of 0.0
394 gamma.setMin( 0.0 );
395 gamma.setConstant( false );
396
398 RooRealVar* gamma_wspace = (RooRealVar*) w.var( VarName.c_str() );
399
400 paramSet.add( *gamma_wspace );
401
402 }
403 }
404 }
405 }
406
407 else {
408 std::cout << " Error: ParamHistFunc doesn't support dimensions > 3D " << std::endl;
409 }
410
411 return paramSet;
412
413}
414
415
416////////////////////////////////////////////////////////////////////////////////
417/// Create the list of RooRealVar parameters which scale the
418/// height of histogram bins.
419/// The list `vars` represents the observables (corresponding to histogram bins)
420/// that these newly created parameters will
421/// be mapped to. *I.e.*, we create one parameter
422/// per observable in `vars` and per bin in each observable.
423///
424/// The new parameters are initialised to 1 with an uncertainty of +/- 1.,
425/// their range is set to the function arguments.
426///
427/// Store the parameters in a list using:
428/// ```
429/// _paramSet.add( createParamSet() );
430/// ```
431/// This list is stored in the "TH1" index order.
433 const RooArgList& vars,
434 Double_t gamma_min, Double_t gamma_max) {
435
436
437
439
440 for (auto comp : params) {
441 auto var = static_cast<RooRealVar*>(comp);
442
443 var->setMin( gamma_min );
444 var->setMax( gamma_max );
445 }
446
447 return params;
448
449}
450
451
452////////////////////////////////////////////////////////////////////////////////
453/// Create the list of RooRealVar
454/// parameters which represent the
455/// height of the histogram bins.
456/// Store them in a list
458 Double_t gamma_min, Double_t gamma_max) {
459
460 // Get the number of bins
461 // in the nominal histogram
462
463 RooArgList paramSet;
464
465 if( gamma_max <= gamma_min ) {
466
467 std::cout << "Warning: gamma_min <= gamma_max: Using default values (0, 10)" << std::endl;
468
469 gamma_min = 0.0;
470 gamma_max = 10.0;
471
472 }
473
474 Double_t gamma_nominal = 1.0;
475
476 if( gamma_nominal < gamma_min ) {
477 gamma_nominal = gamma_min;
478 }
479
480 if( gamma_nominal > gamma_max ) {
481 gamma_nominal = gamma_max;
482 }
483
484 // For each bin, create a RooRealVar
485 for( Int_t i = 0; i < numBins; ++i) {
486
487 std::stringstream VarNameStream;
488 VarNameStream << Prefix << "_bin_" << i;
489 std::string VarName = VarNameStream.str();
490
491 RooRealVar* gamma = new RooRealVar( VarName.c_str(), VarName.c_str(),
492 gamma_nominal, gamma_min, gamma_max );
493 gamma->setConstant( false );
494 paramSet.add( *gamma );
495
496 }
497
498 return paramSet;
499
500}
501
502
504 int numVars = vars.size();
505
506 if (numVars > 3 || numVars < 1) {
507 std::cout << "ParamHistFunc() - Only works for 1-3 variables (1d-3d)" << std::endl;
508 throw -1;
509 }
510
511 int numBinsX = numVars >= 1 ? static_cast<RooRealVar const&>(*vars[0]).numBins() : 1;
512 int numBinsY = numVars >= 2 ? static_cast<RooRealVar const&>(*vars[1]).numBins() : 1;
513 int numBinsZ = numVars >= 3 ? static_cast<RooRealVar const&>(*vars[2]).numBins() : 1;
514
515 return {numBinsX, numBinsY, numBinsZ};
516}
517
518
519////////////////////////////////////////////////////////////////////////////////
520/// Get the index of the gamma parameter associated with the current bin.
521/// e.g. `RooRealVar& currentParam = getParameter( getCurrentBin() );`
523 // We promise that our coordinates and the data hist coordinates have same layout.
524 return _dataSet.getIndex(_dataVars, /*fast=*/true);
525}
526
527
528////////////////////////////////////////////////////////////////////////////////
529/// return 0 for success
530/// return 1 for failure
531/// Check that the elements
532/// are actually RooRealVar's
533/// If so, add them to the
534/// list of vars
536 for(auto const& comp : vars) {
537 if (!dynamic_cast<RooRealVar*>(comp)) {
538 auto errorMsg = std::string("ParamHistFunc::(") + GetName() + ") ERROR: component "
539 + comp->GetName() + " in variables list is not of type RooRealVar";
540 coutE(InputArguments) << errorMsg << std::endl;
541 throw std::runtime_error(errorMsg);
542 }
543 _dataVars.add( *comp );
544 }
545 return 0;
546}
547
548
549////////////////////////////////////////////////////////////////////////////////
550
552 // return 0 for success
553 // return 1 for failure
554
555 // Check that the supplied list has
556 // the right number of arguments:
557
558 Int_t numVarBins = GetNumBins(_dataVars);
559 Int_t numElements = params.getSize();
560
561 if( numVarBins != numElements ) {
562 std::cout << "ParamHistFunc::addParamSet - ERROR - "
563 << "Supplied list of parameters " << params.GetName()
564 << " has " << numElements << " elements but the ParamHistFunc"
565 << GetName() << " has " << numVarBins << " bins."
566 << std::endl;
567 return 1;
568
569 }
570
571 // Check that the elements
572 // are actually RooAbsreal's
573 // If so, add them to the
574 // list of params
575
576 for (const auto comp : params) {
577 if (!dynamic_cast<const RooAbsReal*>(comp)) {
578 auto errorMsg = std::string("ParamHistFunc::(") + GetName() + ") ERROR: component "
579 + comp->GetName() + " in parameter list is not of type RooAbsReal.";
580 coutE(InputArguments) << errorMsg << std::endl;
581 throw std::runtime_error(errorMsg);
582 }
583
584 _paramSet.add( *comp );
585 }
586
587 return 0;
588}
589
590
591////////////////////////////////////////////////////////////////////////////////
592/// Find the bin corresponding to the current value of the observable, and evaluate
593/// the associated parameter.
595{
596 return getParameter().getVal();
597}
598
599
600////////////////////////////////////////////////////////////////////////////////
601/// Find all bins corresponding to the values of the observables in `evalData`, and evaluate
602/// the associated parameters.
603/// \param[in/out] evalData Input/output data for evaluating the ParamHistFunc.
604/// \param[in] normSet Normalisation set passed on to objects that are serving values to us.
605void ParamHistFunc::computeBatch(cudaStream_t*, double* output, size_t size, RooFit::Detail::DataMap const& dataMap) const {
606 std::vector<double> oldValues;
607 std::vector<RooSpan<const double>> data;
608 oldValues.reserve(_dataVars.size());
609 data.reserve(_dataVars.size());
610
611 // Retrieve data for all variables
612 for (auto arg : _dataVars) {
613 const auto* var = static_cast<RooRealVar*>(arg);
614 oldValues.push_back(var->getVal());
615 data.push_back(dataMap.at(var));
616 }
617
618 // Run computation for each entry in the dataset
619 for (std::size_t i = 0; i < size; ++i) {
620 for (unsigned int j = 0; j < _dataVars.size(); ++j) {
621 assert(i < data[j].size());
622 auto& var = static_cast<RooRealVar&>(_dataVars[j]);
623 var.setCachedValue(data[j][i], /*notifyClients=*/false);
624 }
625
626 const auto index = _dataSet.getIndex(_dataVars, /*fast=*/true);
627 const RooAbsReal& param = getParameter(index);
628 output[i] = param.getVal();
629 }
630
631 // Restore old values
632 for (unsigned int j = 0; j < _dataVars.size(); ++j) {
633 auto& var = static_cast<RooRealVar&>(_dataVars[j]);
634 var.setCachedValue(oldValues[j], /*notifyClients=*/false);
635 }
636}
637
638////////////////////////////////////////////////////////////////////////////////
639/// Advertise that all integrals can be handled internally.
640
642 const RooArgSet* normSet,
643 const char* /*rangeName*/) const
644{
645 // Handle trivial no-integration scenario
646 if (allVars.getSize()==0) return 0 ;
647 if (_forceNumInt) return 0 ;
648
649
650 // Select subset of allVars that are actual dependents
651 analVars.add(allVars) ;
652
653 // Check if this configuration was created before
654 Int_t sterileIdx(-1) ;
655 CacheElem* cache = (CacheElem*) _normIntMgr.getObj(normSet,&analVars,&sterileIdx,(const char*)0) ;
656 if (cache) {
657 return _normIntMgr.lastIndex()+1 ;
658 }
659
660 // Create new cache element
661 cache = new CacheElem ;
662
663 // Store cache element
664 Int_t code = _normIntMgr.setObj(normSet,&analVars,(RooAbsCacheElement*)cache,0) ;
665
666 return code+1 ;
667
668}
669
670
671////////////////////////////////////////////////////////////////////////////////
672/// Implement analytical integrations by doing appropriate weighting from component integrals
673/// functions to integrators of components
674
676 const char* /*rangeName*/) const
677{
678 Double_t value(0) ;
679
680 // Simply loop over bins,
681 // get the height, and
682 // multiply by the bind width
683 auto binVolumes = _dataSet.binVolumes(0, _dataSet.numEntries());
684
685 for (unsigned int i=0; i < _paramSet.size(); ++i) {
686 const auto& param = static_cast<const RooAbsReal&>(_paramSet[i]);
687 assert(static_cast<Int_t>(i) == _dataSet.getIndex(param)); // We assume that each parameter i belongs to bin i
688
689 // Get the gamma's value
690 const double paramVal = param.getVal();
691
692 // Finally, get the subtotal
693 value += paramVal * binVolumes[i];
694 }
695
696 return value;
697
698}
699
700
701
702////////////////////////////////////////////////////////////////////////////////
703/// Return sampling hint for making curves of (projections) of this function
704/// as the recursive division strategy of RooCurve cannot deal efficiently
705/// with the vertical lines that occur in a non-interpolated histogram
706
708 Double_t xhi) const
709{
710 // copied and edited from RooHistFunc
711 RooAbsLValue* lvarg = &obs;
712
713 // Retrieve position of all bin boundaries
714 const RooAbsBinning* binning = lvarg->getBinningPtr(0) ;
715 Double_t* boundaries = binning->array() ;
716
717 std::list<Double_t>* hint = new std::list<Double_t> ;
718
719 // Widen range slighty
720 xlo = xlo - 0.01*(xhi-xlo) ;
721 xhi = xhi + 0.01*(xhi-xlo) ;
722
723 Double_t delta = (xhi-xlo)*1e-8 ;
724
725 // Construct array with pairs of points positioned epsilon to the left and
726 // right of the bin boundaries
727 for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
728 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
729 hint->push_back(boundaries[i]-delta) ;
730 hint->push_back(boundaries[i]+delta) ;
731 }
732 }
733 return hint ;
734}
735
736
737////////////////////////////////////////////////////////////////////////////////
738/// Return sampling hint for making curves of (projections) of this function
739/// as the recursive division strategy of RooCurve cannot deal efficiently
740/// with the vertical lines that occur in a non-interpolated histogram
741
743 Double_t xhi) const
744{
745 // copied and edited from RooHistFunc
746 RooAbsLValue* lvarg = &obs;
747
748 // Retrieve position of all bin boundaries
749 const RooAbsBinning* binning = lvarg->getBinningPtr(0) ;
750 Double_t* boundaries = binning->array() ;
751
752 std::list<Double_t>* hint = new std::list<Double_t> ;
753
754 // Construct array with pairs of points positioned epsilon to the left and
755 // right of the bin boundaries
756 for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
757 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
758 hint->push_back(boundaries[i]) ;
759 }
760 }
761
762 return hint ;
763}
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define oocoutE(o, a)
#define coutE(a)
double Double_t
Definition RtypesCore.h:59
#define ClassImp(name)
Definition Rtypes.h:364
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)
virtual ~ParamHistFunc()
void setParamConst(Int_t, Bool_t=kTRUE)
RooDataHist _dataSet
static Int_t GetNumBins(const RooArgSet &vars)
void setConstant(bool constant)
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...
Int_t getCurrentBin() const
Get the index of the gamma parameter associated with the current bin.
RooObjCacheManager _normIntMgr
! The integration cache manager
Int_t numBins() const
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const override
Advertise that all integrals can be handled internally.
Int_t addVarSet(const RooArgList &vars)
return 0 for success return 1 for failure Check that the elements are actually RooRealVar's If so,...
RooAbsReal & getParameter() const
Int_t addParamSet(const RooArgList &params)
NumBins _numBinsPerDim
double evaluate() const override
Find the bin corresponding to the current value of the observable, and evaluate the associated parame...
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const override
Implement analytical integrations by doing appropriate weighting from component integrals functions t...
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.
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...
RooListProxy _paramSet
interpolation parameters
void setShape(TH1 *shape)
RooListProxy _dataVars
The RooRealVars.
void computeBatch(cudaStream_t *, double *output, size_t size, RooFit::Detail::DataMap const &) const override
Find all bins corresponding to the values of the observables in evalData, and evaluate the associated...
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
virtual Double_t * array() const =0
virtual Int_t numBoundaries() const =0
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
Int_t getSize() const
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Storage_t::size_type size() const
const char * GetName() const
Returns name of object.
Abstract base class for objects that are lvalues, i.e.
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 Int_t numBins(const char *rangeName=0) const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:64
Bool_t _forceNumInt
Definition RooAbsReal.h:487
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:94
void setCachedValue(double value, bool notifyClients=true) final
Overwrite the value stored in this object's cache.
Definition RooAbsReal.h:608
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:35
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
Int_t lastIndex() const
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
Int_t getIndex(const RooAbsCollection &coord, Bool_t fast=false) const
Calculate bin number of the given coordinates.
RooSpan< 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:98
void removeSelfFromDir()
Int_t numEntries() const override
Return the number of bins.
auto & at(RooAbsArg const *arg, RooAbsArg const *=nullptr)
Definition DataMap.h:88
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Reimplementation of standard RooArgList::add()
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:39
void setMin(const char *name, Double_t value)
Set minimum of name range to given value.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
The RooWorkspace is a persistable container for RooFit projects.
Bool_t 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.
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
virtual Int_t GetNbinsY() const
Definition TH1.h:297
virtual Int_t GetNbinsZ() const
Definition TH1.h:298
virtual Int_t GetNbinsX() const
Definition TH1.h:296
Bool_t IsBinUnderflow(Int_t bin, Int_t axis=0) const
Return true if the bin is underflow.
Definition TH1.cxx:5147
Bool_t IsBinOverflow(Int_t bin, Int_t axis=0) const
Return true if the bin is overflow.
Definition TH1.cxx:5115
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:4994
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
Mother of all ROOT objects.
Definition TObject.h:41
RooCmdArg RecycleConflictNodes(Bool_t flag=kTRUE)
const Int_t n
Definition legend1.C:16
static int Prefix[TSIZE]
Definition gifdecode.c:12
static void output(int code)
Definition gifencode.c:226