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