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