Logo ROOT   6.14/05
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 "RooAbsReal.h"
17 #include "RooRealProxy.h"
18 #include "RooListProxy.h"
19 #include "RooObjCacheManager.h"
20 #include "RooDataHist.h"
21 
22 // Forward Declarations
23 class RooRealVar;
24 class RooArgList ;
25 class RooWorkspace;
26 class RooBinning;
27 
28 class ParamHistFunc : public RooAbsReal {
29 public:
30 
31  ParamHistFunc() ;
32  ParamHistFunc(const char *name, const char *title, const RooArgList& vars, const RooArgList& paramSet );
33  ParamHistFunc(const char *name, const char *title, const RooArgList& vars, const RooArgList& paramSet, const TH1* hist );
34  virtual ~ParamHistFunc() ;
35 
36  ParamHistFunc(const ParamHistFunc& other, const char* name = 0);
37  virtual TObject* clone(const char* newname) const { return new ParamHistFunc(*this, newname); }
38 
39  const RooArgList& paramList() const { return _paramSet ; }
40 
41  Int_t numBins() const { return _dataSet.numEntries(); } // Number of bins (called numEntries in RooDataHist)
42 
44  void setConstant(bool constant);
45 
46  void setShape(TH1* shape);
47 
48  RooRealVar& getParameter() const ;
49  RooRealVar& getParameter( Int_t masterIdx ) const ;
50 
51  const RooArgSet* get(Int_t masterIdx) const { return _dataSet.get( masterIdx ) ; }
52  const RooArgSet* get(const RooArgSet& coord) const { return _dataSet.get( coord ) ; }
53 
54  double binVolume() const { return _dataSet.binVolume(); }
55 
56  virtual Bool_t forceAnalyticalInt(const RooAbsArg&) const { return kTRUE ; }
57 
58  Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet,const char* rangeName=0) const ;
59  Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
60 
61  static RooArgList createParamSet(RooWorkspace& w, const std::string&, const RooArgList& Vars);
62  static RooArgList createParamSet(RooWorkspace& w, const std::string&, const RooArgList& Vars, Double_t, Double_t);
63  static RooArgList createParamSet(const std::string&, Int_t, Double_t, Double_t);
64 
65  virtual std::list<Double_t>* binBoundaries(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const ;
66  virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const ;
67  virtual Bool_t isBinnedDistribution(const RooArgSet& /*obs*/) const {return kTRUE;}
68 
69 
70 protected:
71 
72  class CacheElem : public RooAbsCacheElement {
73  public:
74  CacheElem() {} ;
75  virtual ~CacheElem() {} ;
77  RooArgList ret(_funcIntList) ;
78  ret.add(_lowIntList);
79  ret.add(_highIntList);
80  return ret ;
81  }
85  // will want std::vector<RooRealVar*> for low and high also
86  } ;
87  mutable RooObjCacheManager _normIntMgr ; // The integration cache manager
88 
89  // Turn into a RooListProxy
90  //RooRealProxy _dataVar; // The RooRealVar
91  RooListProxy _dataVars; // The RooRealVars
92  RooListProxy _paramSet ; // interpolation parameters
93  //RooAbsBinning* _binning; // Holds the binning of the dataVar (at construction time)
94 
96  mutable std::map<Int_t, Int_t> _binMap;
98  //Bool_t _normalized;
99 
100  // std::vector< Double_t > _nominalVals; // The nominal vals when gamma = 1.0 ( = 1.0 by default)
101  RooArgList _ownedList ; // List of owned components
102 
103  Int_t getCurrentBin() const ;
104  Int_t addVarSet( const RooArgList& vars );
105  Int_t addParamSet( const RooArgList& params );
106  static Int_t GetNumBins( const RooArgSet& vars );
107  Double_t evaluate() const;
108 
109  ClassDef(ParamHistFunc,5) // Sum of RooAbsReal objects
110 };
111 
112 #endif
Int_t addVarSet(const RooArgList &vars)
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Definition: ParamHistFunc.h:67
const RooArgList & paramList() const
Definition: ParamHistFunc.h:39
virtual const RooArgSet * get() const
Definition: RooDataHist.h:77
static Int_t GetNumBins(const RooArgSet &vars)
Double_t evaluate() const
void setShape(TH1 *shape)
Int_t numBins() const
Definition: ParamHistFunc.h:41
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void setConstant(bool constant)
virtual TObject * clone(const char *newname) const
Definition: ParamHistFunc.h:37
virtual RooArgList containedArgs(Action)
Definition: ParamHistFunc.h:76
Int_t addParamSet(const RooArgList &params)
void setParamConst(Int_t, Bool_t=kTRUE)
RooDataSet is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:40
#define ClassDef(name, id)
Definition: Rtypes.h:320
RooDataHist _dataSet
Definition: ParamHistFunc.h:97
Double_t binVolume() const
Definition: RooDataHist.h:102
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...
Class RooBinning is an implements RooAbsBinning in terms of an array of boundary values, posing no constraints on the choice of binning, thus allowing variable bin sizes.
Definition: RooBinning.h:29
static RooArgList createParamSet(RooWorkspace &w, const std::string &, const RooArgList &Vars)
double binVolume() const
Definition: ParamHistFunc.h:54
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
RooArgList _ownedList
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 getCurrentBin() const
RooListProxy _dataVars
Definition: ParamHistFunc.h:91
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
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...
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:25
std::map< Int_t, Int_t > _binMap
Definition: ParamHistFunc.h:96
virtual Int_t numEntries() const
Return the number of bins.
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
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
RooObjCacheManager _normIntMgr
Definition: ParamHistFunc.h:87
The TH1 histogram class.
Definition: TH1.h:56
Mother of all ROOT objects.
Definition: TObject.h:37
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
RooRealVar & getParameter() const
virtual Bool_t forceAnalyticalInt(const RooAbsArg &) const
Definition: ParamHistFunc.h:56
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
virtual ~ParamHistFunc()
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
RooListProxy _paramSet
Definition: ParamHistFunc.h:92