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 RooRealVars:
17 *
18 * `ParamHistFunc: {val1, val2, ...} -> {gamma (RooRealVar)}`
19 *
20 * The intended interpretation is that each parameter in the
21 * range represent the height of a bin over the domain
22 * space.
23 *
24 * The 'createParamSet' is an easy way to create these
25 * parameters from a set of observables. They are
26 * stored using the "TH1" ordering convention (as compared
27 * to the RooDataHist convention, which is used internally
28 * and one must map between the two).
29 *
30 * All indices include '0':<br>
31 * \f$ \gamma_{i,j} \f$ = `paramSet[ size(i)*j + i ]`
32 *
33 * ie assuming the dimensions are 5*5:<br>
34 * \f$ \gamma_{2,1} \f$ = `paramSet[ 5*1 + 2 ] = paramSet[7]`
35 */
36
37
38#include <sstream>
39#include <math.h>
40#include <stdexcept>
41#include <iostream>
42
43#include "TH1.h"
44
45#include "RooFit.h"
47#include "RooAbsReal.h"
48#include "RooAbsPdf.h"
49
50#include "RooConstVar.h"
51#include "RooBinning.h"
52#include "RooErrorHandler.h"
53
54#include "RooGaussian.h"
55#include "RooHistFunc.h"
56#include "RooArgSet.h"
57#include "RooNLLVar.h"
58#include "RooChi2Var.h"
59#include "RooMsgService.h"
60
61// Forward declared:
62#include "RooRealVar.h"
63#include "RooArgList.h"
64#include "RooWorkspace.h"
65
66//using namespace std;
67
69
70
71////////////////////////////////////////////////////////////////////////////////
72
74{
75 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
76}
77
78
79////////////////////////////////////////////////////////////////////////////////
80/// Create a function which returns binewise-values
81/// This class contains N RooRealVar's, one for each
82/// bin from the given RooRealVar.
83///
84/// The value of the function in the ith bin is
85/// given by:
86///
87/// F(i) = gamma_i * nominal(i)
88///
89/// Where the nominal values are simply fixed
90/// numbers (default = 1.0 for all i)
91ParamHistFunc::ParamHistFunc(const char* name, const char* title,
92 const RooArgList& vars, const RooArgList& paramSet) :
93 RooAbsReal(name, title),
94 _dataVars("!dataVars","data Vars", this),
95 _paramSet("!paramSet","bin parameters", this),
96 _numBins(0),
97 _dataSet( (std::string(name)+"_dataSet").c_str(), "", vars)
98{
99
100 // Create the dataset that stores the binning info:
101
102 // _dataSet = RooDataSet("
103
104 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
105
106 // Set the binning
107 // //_binning = var.getBinning().clone() ;
108
109 // Create the set of parameters
110 // controlling the height of each bin
111
112 // Get the number of bins
113 _numBins = GetNumBins( vars );
114
115 // Add the parameters (with checking)
116 addVarSet( vars );
117 addParamSet( paramSet );
118}
119
120
121////////////////////////////////////////////////////////////////////////////////
122/// Create a function which returns bin-wise values.
123/// This class allows to multiply bin contents of histograms
124/// with the values of a set of RooRealVars.
125///
126/// The value of the function in the ith bin is
127/// given by:
128/// \f[
129/// F(i) = \gamma_{i} * \mathrm{nominal}(i)
130/// \f]
131///
132/// Where the nominal values are taken from the histogram,
133/// and the \f$ \gamma_{i} \f$ can be set from the outside.
134ParamHistFunc::ParamHistFunc(const char* name, const char* title,
135 const RooArgList& vars, const RooArgList& paramSet,
136 const TH1* Hist ) :
137 RooAbsReal(name, title),
138 // _dataVar("!dataVar","data Var", this, (RooRealVar&) var),
139 _dataVars("!dataVars","data Vars", this),
140 _paramSet("!paramSet","bin parameters", this),
141 _numBins(0),
142 _dataSet( (std::string(name)+"_dataSet").c_str(), "", vars, Hist)
143{
144
145 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
146
147 // Get the number of bins
148 _numBins = GetNumBins( vars );
149
150 // Add the parameters (with checking)
151 addVarSet( vars );
152 addParamSet( paramSet );
153
154}
155
156
158
159 // A helper method to get the number of bins
160
161 if( vars.getSize() == 0 ) return 0;
162
163 Int_t numBins = 1;
164
165 RooFIter varIter = vars.fwdIterator() ;
166 RooAbsArg* comp ;
167 while((comp = (RooAbsArg*) varIter.next())) {
168 if (!dynamic_cast<RooRealVar*>(comp)) {
169 std::cout << "ParamHistFunc::GetNumBins" << vars.GetName() << ") ERROR: component "
170 << comp->GetName()
171 << " in vars list is not of type RooRealVar" << std::endl ;
173 return -1;
174 }
175 RooRealVar* var = (RooRealVar*) comp;
176
177 Int_t varNumBins = var->numBins();
178 numBins *= varNumBins;
179 }
180
181 return numBins;
182
183}
184
185
186////////////////////////////////////////////////////////////////////////////////
187
189 RooAbsReal(other, name),
190 _dataVars("!dataVars", this, other._dataVars ),
191 _paramSet("!paramSet", this, other._paramSet),
192 _numBins( other._numBins ),
193 _binMap( other._binMap ),
194 _dataSet( other._dataSet )
195{
196 _dataSet.removeSelfFromDir(); // files must not delete _dataSet.
197
198 // Copy constructor
199 // Member _ownedList is intentionally not copy-constructed -- ownership is not transferred
200}
201
202
203////////////////////////////////////////////////////////////////////////////////
204
206{
207 ;
208}
209
210
211////////////////////////////////////////////////////////////////////////////////
212/// Get the index of the gamma parameter associated
213/// with the current bin.
214/// This number is the "RooDataSet" style index
215/// and it must be because it uses the RooDataSet method directly
216/// This is intended to be fed into the getParameter(Int_t) method:
217///
218/// RooRealVar currentParam = getParameter( getCurrentBin() );
220 Int_t dataSetIndex = _dataSet.getIndex( _dataVars ); // calcTreeIndex();
221 return dataSetIndex;
222
223}
224
225
226////////////////////////////////////////////////////////////////////////////////
227/// Get the parameter associate with the the
228/// input RooDataHist style index
229/// It uses the binMap to convert the RooDataSet style index
230/// into the TH1 style index (which is how they are stored
231/// internally in the '_paramSet' vector
233 Int_t gammaIndex = -1;
234 if( _binMap.find( index ) != _binMap.end() ) {
235 gammaIndex = _binMap[ index ];
236 }
237 else {
238 std::cout << "Error: ParamHistFunc internal bin index map "
239 << "not properly configured" << std::endl;
240 throw -1;
241 }
242
243 return (RooRealVar&) _paramSet[gammaIndex];
244}
245
246
247////////////////////////////////////////////////////////////////////////////////
248
250 Int_t index = getCurrentBin();
251 return getParameter( index );
252}
253
254
256 RooRealVar& var = getParameter( index );
257 var.setConstant( varConst );
258}
259
260
261void ParamHistFunc::setConstant( bool constant ) {
262 for( int i=0; i < numBins(); ++i) {
263 setParamConst(i, constant);
264 }
265}
266
267
268////////////////////////////////////////////////////////////////////////////////
269
271 int num_hist_bins = shape->GetNbinsX()*shape->GetNbinsY()*shape->GetNbinsZ();
272
273 if( num_hist_bins != numBins() ) {
274 std::cout << "Error - ParamHistFunc: cannot set Shape of ParamHistFunc: " << GetName()
275 << " using histogram: " << shape->GetName()
276 << ". Bins don't match" << std::endl;
277 throw std::runtime_error("setShape");
278 }
279
280
281 Int_t TH1BinNumber = 0;
282 for( Int_t i = 0; i < numBins(); ++i) {
283
284 TH1BinNumber++;
285
286 while( shape->IsBinUnderflow(TH1BinNumber) || shape->IsBinOverflow(TH1BinNumber) ){
287 TH1BinNumber++;
288 }
289
290 //RooRealVar& var = dynamic_cast<RooRealVar&>(getParameter(i));
291 RooRealVar& var = dynamic_cast<RooRealVar&>(_paramSet[i]);
292 var.setVal( shape->GetBinContent(TH1BinNumber) );
293 }
294
295}
296
297
298////////////////////////////////////////////////////////////////////////////////
299/// Create the list of RooRealVar
300/// parameters which represent the
301/// height of the histogram bins.
302/// The list 'vars' represents the
303/// observables (corresponding to histogram bins)
304/// that these newly created parameters will
305/// be mapped to. (ie, we create one parameter
306/// per observable in vars and per bin in each observable)
307
308/// Store them in a list using:
309/// _paramSet.add( createParamSet() );
310/// This list is stored in the "TH1" index order
312 const RooArgList& vars) {
313
314
315 // Get the number of bins
316 // in the nominal histogram
317
318 RooArgList paramSet;
319
320 Int_t numVars = vars.getSize();
321 Int_t numBins = GetNumBins( vars );
322
323 if( numVars == 0 ) {
324 std::cout << "Warning - ParamHistFunc::createParamSet() :"
325 << " No Variables provided. Not making constraint terms."
326 << std::endl;
327 return paramSet;
328 }
329
330 else if( numVars == 1 ) {
331
332 // For each bin, create a RooRealVar
333 for( Int_t i = 0; i < numBins; ++i) {
334
335 std::stringstream VarNameStream;
336 VarNameStream << Prefix << "_bin_" << i;
337 std::string VarName = VarNameStream.str();
338
339 RooRealVar gamma( VarName.c_str(), VarName.c_str(), 1.0 );
340 // "Hard-Code" a minimum of 0.0
341 gamma.setMin( 0.0 );
342 gamma.setConstant( false );
343
345 RooRealVar* gamma_wspace = (RooRealVar*) w.var( VarName.c_str() );
346
347 paramSet.add( *gamma_wspace );
348
349 }
350 }
351
352 else if( numVars == 2 ) {
353
354 // Create a vector of indices
355 // all starting at 0
356 std::vector< Int_t > Indices(numVars, 0);
357
358 RooRealVar* varx = (RooRealVar*) vars.at(0);
359 RooRealVar* vary = (RooRealVar*) vars.at(1);
360
361 // For each bin, create a RooRealVar
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
368
369 std::stringstream VarNameStream;
370 VarNameStream << Prefix << "_bin_" << i << "_" << j;
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
379 RooRealVar* gamma_wspace = (RooRealVar*) w.var( VarName.c_str() );
380
381 paramSet.add( *gamma_wspace );
382
383 }
384 }
385 }
386
387 else if( numVars == 3 ) {
388
389 // Create a vector of indices
390 // all starting at 0
391 std::vector< Int_t > Indices(numVars, 0);
392
393 RooRealVar* varx = (RooRealVar*) vars.at(0);
394 RooRealVar* vary = (RooRealVar*) vars.at(1);
395 RooRealVar* varz = (RooRealVar*) vars.at(2);
396
397 // For each bin, create a RooRealVar
398 for( Int_t k = 0; k < varz->numBins(); ++k) {
399 for( Int_t j = 0; j < vary->numBins(); ++j) {
400 for( Int_t i = 0; i < varx->numBins(); ++i) {
401
402 // Ordering is important:
403 // To match TH1, list goes over x bins
404 // first, then y, then z
405
406 std::stringstream VarNameStream;
407 VarNameStream << Prefix << "_bin_" << i << "_" << j << "_" << k;
408 std::string VarName = VarNameStream.str();
409
410 RooRealVar gamma( VarName.c_str(), VarName.c_str(), 1.0 );
411 // "Hard-Code" a minimum of 0.0
412 gamma.setMin( 0.0 );
413 gamma.setConstant( false );
414
416 RooRealVar* gamma_wspace = (RooRealVar*) w.var( VarName.c_str() );
417
418 paramSet.add( *gamma_wspace );
419
420 }
421 }
422 }
423 }
424
425 else {
426 std::cout << " Error: ParamHistFunc doesn't support dimensions > 3D " << std::endl;
427 }
428
429 return paramSet;
430
431}
432
433
434////////////////////////////////////////////////////////////////////////////////
435/// Create the list of RooRealVar parameters which scale the
436/// height of histogram bins.
437/// The list `vars` represents the observables (corresponding to histogram bins)
438/// that these newly created parameters will
439/// be mapped to. *I.e.*, we create one parameter
440/// per observable in `vars` and per bin in each observable.
441///
442/// The new parameters are initialised to 1 with an uncertainty of +/- 1.,
443/// their range is set to the function arguments.
444///
445/// Store the parameters in a list using:
446/// ```
447/// _paramSet.add( createParamSet() );
448/// ```
449/// This list is stored in the "TH1" index order.
451 const RooArgList& vars,
452 Double_t gamma_min, Double_t gamma_max) {
453
454
455
457
458 for (auto comp : params) {
459 auto var = static_cast<RooRealVar*>(comp);
460
461 var->setMin( gamma_min );
462 var->setMax( gamma_max );
463 }
464
465 return params;
466
467}
468
469
470////////////////////////////////////////////////////////////////////////////////
471/// Create the list of RooRealVar
472/// parameters which represent the
473/// height of the histogram bins.
474/// Store them in a list
476 Double_t gamma_min, Double_t gamma_max) {
477
478
479 // _paramSet.add( createParamSet() );
480
481 // Get the number of bins
482 // in the nominal histogram
483
484 RooArgList paramSet;
485
486 if( gamma_max <= gamma_min ) {
487
488 std::cout << "Warning: gamma_min <= gamma_max: Using default values (0, 10)" << std::endl;
489
490 gamma_min = 0.0;
491 gamma_max = 10.0;
492
493 }
494
495 Double_t gamma_nominal = 1.0;
496
497 if( gamma_nominal < gamma_min ) {
498 gamma_nominal = gamma_min;
499 }
500
501 if( gamma_nominal > gamma_max ) {
502 gamma_nominal = gamma_max;
503 }
504
505 // For each bin, create a RooRealVar
506 for( Int_t i = 0; i < numBins; ++i) {
507
508 std::stringstream VarNameStream;
509 VarNameStream << Prefix << "_bin_" << i;
510 std::string VarName = VarNameStream.str();
511
512 RooRealVar* gamma = new RooRealVar( VarName.c_str(), VarName.c_str(),
513 gamma_nominal, gamma_min, gamma_max );
514 gamma->setConstant( false );
515 paramSet.add( *gamma );
516
517 }
518
519 return paramSet;
520
521}
522
523
524////////////////////////////////////////////////////////////////////////////////
525/// return 0 for success
526/// return 1 for failure
527/// Check that the elements
528/// are actually RooRealVar's
529/// If so, add them to the
530/// list of vars
532
533
534 int numVars = 0;
535
536 RooFIter varIter = vars.fwdIterator() ;
537 RooAbsArg* comp ;
538 while((comp = (RooAbsArg*) varIter.next())) {
539 if (!dynamic_cast<RooRealVar*>(comp)) {
540 coutE(InputArguments) << "ParamHistFunc::(" << GetName() << ") ERROR: component "
541 << comp->GetName() << " in variables list is not of type RooRealVar"
542 << std::endl;
544 return 1;
545 }
546
547 _dataVars.add( *comp );
548 numVars++;
549
550 }
551
552 Int_t numBinsX = 1;
553 Int_t numBinsY = 1;
554 Int_t numBinsZ = 1;
555
556 if( numVars == 1 ) {
557 RooRealVar* varX = (RooRealVar*) _dataVars.at(0);
558 numBinsX = varX->numBins();
559 numBinsY = 1;
560 numBinsZ = 1;
561 } else if( numVars == 2 ) {
562 RooRealVar* varX = (RooRealVar*) _dataVars.at(0);
563 RooRealVar* varY = (RooRealVar*) _dataVars.at(1);
564 numBinsX = varX->numBins();
565 numBinsY = varY->numBins();
566 numBinsZ = 1;
567 } else if( numVars == 3 ) {
568 RooRealVar* varX = (RooRealVar*) _dataVars.at(0);
569 RooRealVar* varY = (RooRealVar*) _dataVars.at(1);
570 RooRealVar* varZ = (RooRealVar*) _dataVars.at(2);
571 numBinsX = varX->numBins();
572 numBinsY = varY->numBins();
573 numBinsZ = varZ->numBins();
574 } else {
575 std::cout << "ParamHistFunc() - Only works for 1-3 variables (1d-3d)" << std::endl;
576 throw -1;
577 }
578
579 // Fill the mapping between
580 // RooDataHist bins and TH1 Bins:
581
582 // Clear the map
583 _binMap.clear();
584
585 // Fill the map
586 for( Int_t i = 0; i < numBinsX; ++i ) {
587 for( Int_t j = 0; j < numBinsY; ++j ) {
588 for( Int_t k = 0; k < numBinsZ; ++k ) {
589
590 Int_t RooDataSetBin = k + j*numBinsZ + i*numBinsY*numBinsZ;
591 Int_t TH1HistBin = i + j*numBinsX + k*numBinsX*numBinsY;
592
593 _binMap[RooDataSetBin] = TH1HistBin;
594
595 }
596 }
597 }
598
599 return 0;
600
601}
602
603
604////////////////////////////////////////////////////////////////////////////////
605
607 // return 0 for success
608 // return 1 for failure
609
610 // Check that the supplied list has
611 // the right number of arguments:
612
613 Int_t numVarBins = _numBins;
614 Int_t numElements = params.getSize();
615
616 if( numVarBins != numElements ) {
617 std::cout << "ParamHistFunc::addParamSet - ERROR - "
618 << "Supplied list of parameters " << params.GetName()
619 << " has " << numElements << " elements but the ParamHistFunc"
620 << GetName() << " has " << numVarBins << " bins."
621 << std::endl;
622 return 1;
623
624 }
625
626 // Check that the elements
627 // are actually RooRealVar's
628 // If so, add them to the
629 // list of params
630
631 RooFIter paramIter = params.fwdIterator() ;
632 RooAbsArg* comp ;
633 while((comp = (RooAbsArg*) paramIter.next())) {
634 if (!dynamic_cast<RooRealVar*>(comp)) {
635 coutE(InputArguments) << "ParamHistFunc::(" << GetName() << ") ERROR: component "
636 << comp->GetName() << " in paramater list is not of type RooRealVar"
637 << std::endl;
639 return 1;
640 }
641
642 _paramSet.add( *comp );
643
644 }
645
646 return 0;
647
648}
649
650
651////////////////////////////////////////////////////////////////////////////////
652
654{
655 // Find the bin cooresponding to the current
656 // value of the RooRealVar:
657
658 RooRealVar* param = (RooRealVar*) &(getParameter());
659 Double_t value = param->getVal();
660 return value;
661
662}
663
664
665////////////////////////////////////////////////////////////////////////////////
666/// Advertise that all integrals can be handled internally.
667
669 const RooArgSet* normSet,
670 const char* /*rangeName*/) const
671{
672 // Handle trivial no-integration scenario
673 if (allVars.getSize()==0) return 0 ;
674 if (_forceNumInt) return 0 ;
675
676
677 // Select subset of allVars that are actual dependents
678 analVars.add(allVars) ;
679
680 // Check if this configuration was created before
681 Int_t sterileIdx(-1) ;
682 CacheElem* cache = (CacheElem*) _normIntMgr.getObj(normSet,&analVars,&sterileIdx,(const char*)0) ;
683 if (cache) {
684 return _normIntMgr.lastIndex()+1 ;
685 }
686
687 // Create new cache element
688 cache = new CacheElem ;
689
690 // Store cache element
691 Int_t code = _normIntMgr.setObj(normSet,&analVars,(RooAbsCacheElement*)cache,0) ;
692
693 return code+1 ;
694
695}
696
697
698////////////////////////////////////////////////////////////////////////////////
699/// Implement analytical integrations by doing appropriate weighting from component integrals
700/// functions to integrators of components
701
703 const char* /*rangeName*/) const
704{
705 Double_t value(0) ;
706
707 // Simply loop over bins,
708 // get the height, and
709 // multiply by the bind width
710
711 RooFIter paramIter = _paramSet.fwdIterator();
712 RooRealVar* param = NULL;
713 Int_t nominalItr = 0;
714 while((param = (RooRealVar*) paramIter.next())) {
715
716 // Get the gamma's value
717 Double_t paramVal = (*param).getVal();
718
719 // Get the bin volume
720 _dataSet.get( nominalItr );
721 Double_t binVolumeDS = _dataSet.binVolume(); //_binning->binWidth( nominalItr );
722
723 // Finally, get the subtotal
724 value += paramVal*binVolumeDS;
725
726 ++nominalItr;
727
728 /*
729 std::cout << "Integrating : "
730 << " bin: " << nomValue
731 << " binVolume: " << binVolumeDS
732 << " paramValue: " << paramVal
733 << " nomValue: " << nomValue
734 << " subTotal: " << value
735 << std::endl;
736 */
737
738 }
739
740 return value;
741
742}
743
744
745
746////////////////////////////////////////////////////////////////////////////////
747/// Return sampling hint for making curves of (projections) of this function
748/// as the recursive division strategy of RooCurve cannot deal efficiently
749/// with the vertical lines that occur in a non-interpolated histogram
750
752 Double_t xhi) const
753{
754 // copied and edited from RooHistFunc
755 RooAbsLValue* lvarg = &obs;
756
757 // Retrieve position of all bin boundaries
758 const RooAbsBinning* binning = lvarg->getBinningPtr(0) ;
759 Double_t* boundaries = binning->array() ;
760
761 std::list<Double_t>* hint = new std::list<Double_t> ;
762
763 // Widen range slighty
764 xlo = xlo - 0.01*(xhi-xlo) ;
765 xhi = xhi + 0.01*(xhi-xlo) ;
766
767 Double_t delta = (xhi-xlo)*1e-8 ;
768
769 // Construct array with pairs of points positioned epsilon to the left and
770 // right of the bin boundaries
771 for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
772 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
773 hint->push_back(boundaries[i]-delta) ;
774 hint->push_back(boundaries[i]+delta) ;
775 }
776 }
777 return hint ;
778}
779
780
781////////////////////////////////////////////////////////////////////////////////
782/// Return sampling hint for making curves of (projections) of this function
783/// as the recursive division strategy of RooCurve cannot deal efficiently
784/// with the vertical lines that occur in a non-interpolated histogram
785
787 Double_t xhi) const
788{
789 // copied and edited from RooHistFunc
790 RooAbsLValue* lvarg = &obs;
791
792 // Retrieve position of all bin boundaries
793 const RooAbsBinning* binning = lvarg->getBinningPtr(0) ;
794 Double_t* boundaries = binning->array() ;
795
796 std::list<Double_t>* hint = new std::list<Double_t> ;
797
798 // Construct array with pairs of points positioned epsilon to the left and
799 // right of the bin boundaries
800 for (Int_t i=0 ; i<binning->numBoundaries() ; i++) {
801 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
802 hint->push_back(boundaries[i]) ;
803 }
804 }
805
806 return hint ;
807}
#define e(i)
Definition RSha256.hxx:103
#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...
virtual ~ParamHistFunc()
void setParamConst(Int_t, Bool_t=kTRUE)
RooRealVar & getParameter() const
RooDataHist _dataSet
static Int_t GetNumBins(const RooArgSet &vars)
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Return sampling hint for making curves of (projections) of this function as the recursive division st...
void setConstant(bool constant)
Int_t getCurrentBin() const
Get the index of the gamma parameter associated with the current bin.
RooObjCacheManager _normIntMgr
Int_t numBins() const
Int_t addVarSet(const RooArgList &vars)
return 0 for success return 1 for failure Check that the elements are actually RooRealVar's If so,...
Int_t addParamSet(const RooArgList &params)
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.
RooListProxy _paramSet
void setShape(TH1 *shape)
RooListProxy _dataVars
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Implement analytical integrations by doing appropriate weighting from component integrals functions t...
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Return sampling hint for making curves of (projections) of this function as the recursive division st...
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
std::map< Int_t, Int_t > _binMap
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition RooAbsArg.h:72
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
RooFIter fwdIterator() const
One-time forward iterator.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
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
void setConstant(Bool_t value=kTRUE)
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:61
Bool_t _forceNumInt
Definition RooAbsReal.h:478
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:91
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:21
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Definition RooArgList.h:70
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:29
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
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)
void removeSelfFromDir()
Int_t getIndex(const RooArgSet &coord, Bool_t fast=false) const
Calculate bin number of the given coordinates.
double binVolume(std::size_t i) const
Return bin volume of i-th bin.
const RooArgSet * get() const override
Get bin centre of current bin.
Definition RooDataHist.h:74
static void softAbort()
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
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.
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
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.
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:5146
Bool_t IsBinOverflow(Int_t bin, Int_t axis=0) const
Return true if the bin is overflow.
Definition TH1.cxx:5114
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:4993
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
RooCmdArg RecycleConflictNodes(Bool_t flag=kTRUE)
static int Prefix[TSIZE]
Definition gifdecode.c:12