Logo ROOT  
Reference Guide
ParamHistFunc.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id: cranmer $
2 // Author: George Lewis, Kyle Cranmer
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 #ifndef ROO_PARAMHISTFUNC
13 #define ROO_PARAMHISTFUNC
14 
15 #include <map>
16 #include <vector>
17 #include <list>
18 #include <string>
19 
20 #include "RooAbsReal.h"
21 #include "RooRealProxy.h"
22 #include "RooListProxy.h"
23 #include "RooObjCacheManager.h"
24 #include "RooDataHist.h"
25 
26 // Forward Declarations
27 class RooRealVar;
28 class RooArgList ;
29 class RooWorkspace;
30 class RooBinning;
31 
32 class ParamHistFunc : public RooAbsReal {
33 public:
34 
35  ParamHistFunc() ;
36  ParamHistFunc(const char *name, const char *title, const RooArgList& vars, const RooArgList& paramSet );
37  ParamHistFunc(const char *name, const char *title, const RooArgList& vars, const RooArgList& paramSet, const TH1* hist );
38  virtual ~ParamHistFunc() ;
39 
40  ParamHistFunc(const ParamHistFunc& other, const char* name = 0);
41  virtual TObject* clone(const char* newname) const { return new ParamHistFunc(*this, newname); }
42 
43  const RooArgList& paramList() const { return _paramSet ; }
44 
45  Int_t numBins() const { return _dataSet.numEntries(); } // Number of bins (called numEntries in RooDataHist)
46 
48  void setConstant(bool constant);
49 
50  void setShape(TH1* shape);
51 
52  RooRealVar& getParameter() const ;
53  RooRealVar& getParameter( Int_t masterIdx ) const ;
54 
55  const RooArgSet* get(Int_t masterIdx) const { return _dataSet.get( masterIdx ) ; }
56  const RooArgSet* get(const RooArgSet& coord) const { return _dataSet.get( coord ) ; }
57 
58  double binVolume() const { return _dataSet.binVolume(); }
59 
60  virtual Bool_t forceAnalyticalInt(const RooAbsArg&) const { return kTRUE ; }
61 
62  Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet,const char* rangeName=0) const ;
63  Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
64 
65  static RooArgList createParamSet(RooWorkspace& w, const std::string&, const RooArgList& Vars);
66  static RooArgList createParamSet(RooWorkspace& w, const std::string&, const RooArgList& Vars, Double_t, Double_t);
67  static RooArgList createParamSet(const std::string&, Int_t, Double_t, Double_t);
68 
69  virtual std::list<Double_t>* binBoundaries(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const ;
70  virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const ;
71  virtual Bool_t isBinnedDistribution(const RooArgSet& /*obs*/) const {return kTRUE;}
72 
73 
74 protected:
75 
76  class CacheElem : public RooAbsCacheElement {
77  public:
78  CacheElem() {} ;
79  virtual ~CacheElem() {} ;
81  RooArgList ret(_funcIntList) ;
82  ret.add(_lowIntList);
83  ret.add(_highIntList);
84  return ret ;
85  }
89  // will want std::vector<RooRealVar*> for low and high also
90  } ;
91  mutable RooObjCacheManager _normIntMgr ; // The integration cache manager
92 
93  // Turn into a RooListProxy
94  //RooRealProxy _dataVar; // The RooRealVar
95  RooListProxy _dataVars; // The RooRealVars
96  RooListProxy _paramSet ; // interpolation parameters
97  //RooAbsBinning* _binning; // Holds the binning of the dataVar (at construction time)
98 
100  mutable std::map<Int_t, Int_t> _binMap;
102  //Bool_t _normalized;
103 
104  // std::vector< Double_t > _nominalVals; // The nominal vals when gamma = 1.0 ( = 1.0 by default)
105  RooArgList _ownedList ; // List of owned components
106 
107  Int_t getCurrentBin() const ;
108  Int_t addVarSet( const RooArgList& vars );
109  Int_t addParamSet( const RooArgList& params );
110  static Int_t GetNumBins( const RooArgSet& vars );
111  Double_t evaluate() const;
112 
113  ClassDef(ParamHistFunc,5) // Sum of RooAbsReal objects
114 };
115 
116 #endif
ParamHistFunc::CacheElem::~CacheElem
virtual ~CacheElem()
Definition: ParamHistFunc.h:79
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooAbsReal.h
ParamHistFunc::plotSamplingHint
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...
Definition: ParamHistFunc.cxx:751
ParamHistFunc::CacheElem::containedArgs
virtual RooArgList containedArgs(Action)
Definition: ParamHistFunc.h:80
ParamHistFunc::CacheElem
Definition: ParamHistFunc.h:76
ParamHistFunc::addVarSet
Int_t addVarSet(const RooArgList &vars)
return 0 for success return 1 for failure Check that the elements are actually RooRealVar's If so,...
Definition: ParamHistFunc.cxx:531
RooBinning
Class RooBinning is an implements RooAbsBinning in terms of an array of boundary values,...
Definition: RooBinning.h:28
ParamHistFunc::_ownedList
RooArgList _ownedList
Definition: ParamHistFunc.h:105
ParamHistFunc::_binMap
std::map< Int_t, Int_t > _binMap
Definition: ParamHistFunc.h:100
ParamHistFunc::forceAnalyticalInt
virtual Bool_t forceAnalyticalInt(const RooAbsArg &) const
Definition: ParamHistFunc.h:60
ParamHistFunc::ParamHistFunc
ParamHistFunc()
Definition: ParamHistFunc.cxx:73
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
ParamHistFunc::getParameter
RooRealVar & getParameter() const
Definition: ParamHistFunc.cxx:249
ParamHistFunc::get
const RooArgSet * get(Int_t masterIdx) const
Definition: ParamHistFunc.h:55
ParamHistFunc::evaluate
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Definition: ParamHistFunc.cxx:653
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
ParamHistFunc::CacheElem::CacheElem
CacheElem()
Definition: ParamHistFunc.h:78
RooAbsCacheElement
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
Definition: RooAbsCacheElement.h:26
ParamHistFunc::getAnalyticalIntegralWN
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
Definition: ParamHistFunc.cxx:668
ParamHistFunc::_paramSet
RooListProxy _paramSet
Definition: ParamHistFunc.h:96
ParamHistFunc::_numBins
Int_t _numBins
Definition: ParamHistFunc.h:99
bool
ParamHistFunc::setConstant
void setConstant(bool constant)
Definition: ParamHistFunc.cxx:261
ParamHistFunc::get
const RooArgSet * get(const RooArgSet &coord) const
Definition: ParamHistFunc.h:56
ParamHistFunc::getCurrentBin
Int_t getCurrentBin() const
Get the index of the gamma parameter associated with the current bin.
Definition: ParamHistFunc.cxx:219
ParamHistFunc::analyticalIntegralWN
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...
Definition: ParamHistFunc.cxx:702
RooDataHist
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:41
RooDataHist::get
const RooArgSet * get() const override
Get bin centre of current bin.
Definition: RooDataHist.h:78
ParamHistFunc::_dataSet
RooDataHist _dataSet
Definition: ParamHistFunc.h:101
RooDataHist.h
RooRealProxy.h
ParamHistFunc::~ParamHistFunc
virtual ~ParamHistFunc()
Definition: ParamHistFunc.cxx:205
RooAbsCollection::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Definition: RooAbsCollection.cxx:437
ParamHistFunc::GetNumBins
static Int_t GetNumBins(const RooArgSet &vars)
Definition: ParamHistFunc.cxx:157
RooListProxy
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:24
ParamHistFunc::CacheElem::_lowIntList
RooArgList _lowIntList
Definition: ParamHistFunc.h:87
RooDataHist::binVolume
double binVolume(std::size_t i) const
Return bin volume of i-th bin.
Definition: RooDataHist.h:107
RooObjCacheManager.h
ParamHistFunc::_normIntMgr
RooObjCacheManager _normIntMgr
Definition: ParamHistFunc.h:91
ParamHistFunc::_dataVars
RooListProxy _dataVars
Definition: ParamHistFunc.h:95
ParamHistFunc::numBins
Int_t numBins() const
Definition: ParamHistFunc.h:45
ParamHistFunc::setShape
void setShape(TH1 *shape)
Definition: ParamHistFunc.cxx:270
RooListProxy.h
RooWorkspace
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
RooDataHist::numEntries
Int_t numEntries() const override
Return the number of bins.
Definition: RooDataHist.cxx:1710
Double_t
double Double_t
Definition: RtypesCore.h:59
ParamHistFunc::binVolume
double binVolume() const
Definition: ParamHistFunc.h:58
ParamHistFunc::paramList
const RooArgList & paramList() const
Definition: ParamHistFunc.h:43
RooObjCacheManager
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
Definition: RooObjCacheManager.h:32
RooAbsCacheElement::Action
Action
Definition: RooAbsCacheElement.h:39
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
ParamHistFunc::CacheElem::_highIntList
RooArgList _highIntList
Definition: ParamHistFunc.h:88
TH1
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
name
char name[80]
Definition: TGX11.cxx:110
ParamHistFunc::clone
virtual TObject * clone(const char *newname) const
Definition: ParamHistFunc.h:41
ParamHistFunc
A class which maps the current values of a RooRealVar (or a set of RooRealVars) to one of a number of...
Definition: ParamHistFunc.h:32
ParamHistFunc::CacheElem::_funcIntList
RooArgList _funcIntList
Definition: ParamHistFunc.h:86
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
ParamHistFunc::isBinnedDistribution
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
Definition: ParamHistFunc.h:71
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
ParamHistFunc::createParamSet
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.
Definition: ParamHistFunc.cxx:311
ParamHistFunc::binBoundaries
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...
Definition: ParamHistFunc.cxx:786
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
ParamHistFunc::addParamSet
Int_t addParamSet(const RooArgList &params)
Definition: ParamHistFunc.cxx:606
int
ParamHistFunc::setParamConst
void setParamConst(Int_t, Bool_t=kTRUE)
Definition: ParamHistFunc.cxx:255