Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
27class RooRealVar;
28class RooArgList ;
29class RooWorkspace;
30class RooBinning;
31
32class ParamHistFunc : public RooAbsReal {
33public:
34
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
74protected:
75
77 public:
78 CacheElem() {} ;
79 virtual ~CacheElem() {} ;
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
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
virtual RooArgList containedArgs(Action)
A class which maps the current values of a RooRealVar (or a set of RooRealVars) to one of a number of...
const RooArgSet * get(Int_t masterIdx) const
virtual ~ParamHistFunc()
void setParamConst(Int_t, Bool_t=kTRUE)
RooRealVar & getParameter() const
RooDataHist _dataSet
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
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
const RooArgList & paramList() const
Int_t getCurrentBin() const
Get the index of the gamma parameter associated with the current bin.
virtual TObject * clone(const char *newname) const
RooObjCacheManager _normIntMgr
Int_t numBins() const
const RooArgSet * get(const RooArgSet &coord) const
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
RooListProxy _paramSet
void setShape(TH1 *shape)
double binVolume() const
RooListProxy _dataVars
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
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition RooAbsArg.h:72
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:61
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:29
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:37
double binVolume(std::size_t i) const
Return bin volume of i-th bin.
Int_t numEntries() const override
Return the number of bins.
const RooArgSet * get() const override
Get bin centre of current bin.
Definition RooDataHist.h:74
RooListProxy is the concrete proxy for RooArgList objects.
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:39
The RooWorkspace is a persistable container for RooFit projects.
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
Mother of all ROOT objects.
Definition TObject.h:37