Logo ROOT   6.10/09
Reference Guide
RooBarlowBeestonLL.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
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 #ifndef ROOBARLOWBEESTONLL
12 #define ROOBARLOWBEESTONLL
13 
14 #include "RooAbsReal.h"
15 #include "RooRealProxy.h"
16 #include "RooSetProxy.h"
17 #include <map>
18 #include <set>
19 #include <string>
20 
21 class RooMinuit ;
22 
23 namespace RooStats{
24  namespace HistFactory{
25 
27 public:
28 
30  RooBarlowBeestonLL(const char *name, const char *title, RooAbsReal& nll /*, const RooArgSet& observables*/);
31  RooBarlowBeestonLL(const RooBarlowBeestonLL& other, const char* name=0) ;
32  virtual TObject* clone(const char* newname) const { return new RooBarlowBeestonLL(*this,newname); }
33  virtual ~RooBarlowBeestonLL() ;
34 
35  // A simple class to store the
36  // necessary objects for a
37  // single gamma in a single channel
38  class BarlowCache {
39  public:
43  sumPdf(NULL), nData(-1) {}
47  RooArgSet* bin_center; // Snapshot
51  double nData;
52  double binVolume;
53  void SetBinCenter() const;
54  /*
55  // Restore original values and constant status of observables
56  TIterator* iter = obsSetOrig->createIterator() ;
57  RooRealVar* var ;
58  while((var=(RooRealVar*)iter->Next())) {
59  RooRealVar* target = (RooRealVar*) _obs.find(var->GetName()) ;
60  target->setVal(var->getVal()) ;
61  target->setConstant(var->isConstant()) ;
62  }
63  */
64 
65  };
66 
67 
68  void initializeBarlowCache();
69 
70  RooArgSet* getParameters(const RooArgSet* depList, Bool_t stripDisconnected=kTRUE) const;
71 
72  // void setAlwaysStartFromMin(Bool_t flag) { _startFromMin = flag ; }
73  // Bool_t alwaysStartFromMin() const { return _startFromMin ; }
74 
75  //RooMinuit* minuit() { return _minuit ; }
76  RooAbsReal& nll() { return const_cast<RooAbsReal&>(_nll.arg()) ; }
77  // const RooArgSet& bestFitParams() const ;
78  // const RooArgSet& bestFitObs() const ;
79 
80  // virtual RooAbsReal* createProfile(const RooArgSet& paramsOfInterest) ;
81 
82  virtual Bool_t redirectServersHook(const RooAbsCollection& /*newServerList*/, Bool_t /*mustReplaceAll*/, Bool_t /*nameChange*/, Bool_t /*isRecursive*/) ;
83 
84  // void clearAbsMin() { _absMinValid = kFALSE ; }
85 
86  // Int_t numEval() const { return _neval ; }
87 
88  void setPdf(RooAbsPdf* pdf) { _pdf = pdf; }
90 
91  //void FactorizePdf(const RooArgSet &observables, RooAbsPdf &pdf,
92  // RooArgList &obsTerms, RooArgList &constraints) const;
93 
94 
95 protected:
96 
97  // void validateAbsMin() const ;
98 
99 
100  RooRealProxy _nll ; // Input -log(L) function
101  /*
102  RooSetProxy _obs ; // Parameters of profile likelihood
103  RooSetProxy _par ; // Marginialized parameters of likelihood
104  */
107  mutable std::map< std::string, std::vector< BarlowCache > > _barlowCache;
108  mutable std::set< std::string > _statUncertParams;
109  // Bool_t _startFromMin ; // Always start minimization for global minimum?
110 
111  /*
112  TIterator* _piter ; //! Iterator over profile likelihood parameters to be minimized
113  TIterator* _oiter ; //! Iterator of profile likelihood output parameter(s)
114  */
115 
116  // mutable RooMinuit* _minuit ; //! Internal minuit instance
117 
118  // mutable Bool_t _absMinValid ; // flag if absmin is up-to-date
119  // mutable Double_t _absMin ; // absolute minimum of -log(L)
120  // mutable RooArgSet _paramAbsMin ; // Parameter values at absolute minimum
121  // mutable RooArgSet _obsAbsMin ; // Observable values at absolute minimum
122  mutable std::map<std::string,bool> _paramFixed ; // Parameter constant status at last time of use
123  // mutable Int_t _neval ; // Number evaluations used in last minimization
124  Double_t evaluate() const ;
125  //Double_t evaluate_bad() const ;
126 
127 
128 private:
129 
130  ClassDef(RooStats::HistFactory::RooBarlowBeestonLL,0) // Real-valued function representing a Barlow-Beeston minimized profile likelihood of external (likelihood) function
131 };
132 
133  }
134 }
135 
136 #endif
std::map< std::string, std::vector< BarlowCache > > _barlowCache
RooArgSet * getParameters(const RooArgSet *depList, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don&#39;t match any of...
bool Bool_t
Definition: RtypesCore.h:59
#define NULL
Definition: RtypesCore.h:88
#define ClassDef(name, id)
Definition: Rtypes.h:297
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
Double_t evaluate() const
Optimized implementation of createProfile for profile likelihoods.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
Namespace for the RooStats classes.
Definition: Asimov.h:20
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
std::map< std::string, bool > _paramFixed
Mother of all ROOT objects.
Definition: TObject.h:37
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects...
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
RooRealProxy is the concrete proxy for RooAbsReal objects A RooRealProxy is the general mechanism to ...
Definition: RooRealProxy.h:23
virtual TObject * clone(const char *newname) const
const RooAbsReal & arg() const
Definition: RooRealProxy.h:43
const Bool_t kTRUE
Definition: RtypesCore.h:91
virtual Bool_t redirectServersHook(const RooAbsCollection &, Bool_t, Bool_t, Bool_t)
RooMinuit is a wrapper class around TFitter/TMinuit that provides a seamless interface between the MI...
Definition: RooMinuit.h:39