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