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 "RooAbsReal.h"
17#include "RooRealProxy.h"
18#include "RooListProxy.h"
19#include "RooObjCacheManager.h"
20#include "RooDataHist.h"
21
22// Forward Declarations
23class RooRealVar;
24class RooArgList ;
25class RooWorkspace;
26class RooBinning;
27
28class ParamHistFunc : public RooAbsReal {
29public:
30
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
70protected:
71
73 public:
74 CacheElem() {} ;
75 virtual ~CacheElem() {} ;
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
double Double_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassDef(name, id)
Definition: Rtypes.h:322
char name[80]
Definition: TGX11.cxx:109
virtual RooArgList containedArgs(Action)
Definition: ParamHistFunc.h:76
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
const RooArgSet * get(Int_t masterIdx) const
Definition: ParamHistFunc.h:51
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)
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Definition: ParamHistFunc.h:67
const RooArgList & paramList() const
Definition: ParamHistFunc.h:39
Int_t getCurrentBin() const
Get the index of the gamma parameter associated with the current bin.
virtual TObject * clone(const char *newname) const
Definition: ParamHistFunc.h:37
RooObjCacheManager _normIntMgr
Definition: ParamHistFunc.h:87
Int_t numBins() const
Definition: ParamHistFunc.h:41
const RooArgSet * get(const RooArgSet &coord) const
Definition: ParamHistFunc.h:52
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.
RooArgList _ownedList
virtual Bool_t forceAnalyticalInt(const RooAbsArg &) const
Definition: ParamHistFunc.h:56
RooListProxy _paramSet
Definition: ParamHistFunc.h:92
void setShape(TH1 *shape)
double binVolume() const
Definition: ParamHistFunc.h:54
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
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:60
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
Class RooBinning is an implements RooAbsBinning in terms of an array of boundary values,...
Definition: RooBinning.h:28
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:40
virtual Int_t numEntries() const
Return the number of bins.
virtual const RooArgSet * get() const
Definition: RooDataHist.h:79
Double_t binVolume() const
Definition: RooDataHist.h:112
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:25
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:35
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
The TH1 histogram class.
Definition: TH1.h:56
Mother of all ROOT objects.
Definition: TObject.h:37