BCRooInterface.h
1 #ifndef __BCROOINTERFACE__H
2 #define __BCROOINTERFACE__H
3 
4 #include "../../BAT/BCModel.h"
5 
6 #include <RooStats/MarkovChain.h>
7 #include <RooRealVar.h>
8 
9 #include <list>
10 #include <string>
11 #include <utility>
12 
13 class RooAbsReal;
14 class RooAbsData;
15 class RooAbsPdf;
16 class RooArgSet;
17 class RooArgList;
18 
29 class BCRooInterface : public BCModel
30 {
31 public:
32 
34  BCRooInterface(const std::string& name = "", bool fillChain = false );
35 
36  ~BCRooInterface();
38 
42  void DefineParameters();
43  double LogAPrioriProbability(const std::vector<double>& parameters);
44  double LogLikelihood(const std::vector<double>& parameters);
47  void Initialize( RooAbsData& data,
49  RooAbsPdf& model,
50  RooAbsPdf& prior,
51  const RooArgSet* params,
52  const RooArgSet& listPOI );
53 
54  void Initialize( const char* rootFile,
55  const char* wsName = "batWS",
56  const char* dataName = "data",
57  const char* modelName = "model",
58  const char* priorName = "priorPOI",
59  const char* priorNuisanceName = "priorNuisance",
60  const char* paramsName = "parameters",
61  const char* listPOIName = "POI" );
63 
65  void SetNumBins(const char* parname, int nbins);
67  void SetNumBins(int nbins);
73  RooStats::MarkovChain* GetRooStatsMarkovChain() { return _roostatsMarkovChain;}
75  RooArgSet* GetArgSetForMarkovChain() {return &_parametersForMarkovChainCurrent;}
77 private:
78 
79  void AddToCurrentChainElement(double xij, int chainNum, int poiNum);
80  bool EqualsLastChainElement(int chainNum);
81  double GetWeightForChain(int chainNum);
82 
83  RooAbsData* fData;
84  RooAbsPdf* fModel;
85  RooAbsReal* fNll;
86  RooArgList* fParams;
87  RooArgList* fParamsPOI;
88  RooAbsPdf* fPrior;
89  int _default_nbins;
90 
91  RooRealVar* priorhelpvar;
92  bool _addeddummyprior;
93 
94  bool _fillChain;
95  bool fFirstComparison;
96  RooStats::MarkovChain* _roostatsMarkovChain;
97  RooArgSet _parametersForMarkovChainPrevious;
98  RooArgSet _parametersForMarkovChainCurrent;
99 
100  std::vector< std::vector<double> > fPreviousStep;
101  std::vector< std::vector<double> > fCurrentStep;
102  std::vector< double > fVecWeights;
103 
104  std::list< std::pair<const char*, int> > _nbins_list;
105 };
106 
107 #endif
void SetupRooStatsMarkovChain()
setup RooStats Markov Chain
Interface allowing to run BAT on a problem/data defined in a standard RooFit workspace format...
void MCMCIterationInterface()
overloaded function from BCIntegrate to fill RooStats Markov Chain with every accepted step ...
void SetNumBins(const char *parname, int nbins)
set the number of histogram bins for a specific parameter
The base class for all user-defined models.
Definition: BCModel.h:39
double LogLikelihood(const std::vector< double > &parameters)
Calculates natural logarithm of the likelihood.
double LogAPrioriProbability(const std::vector< double > &parameters)
Returns natural logarithm of the prior probability.
RooStats::MarkovChain * GetRooStatsMarkovChain()
return the RooStats Markov Chain (empty if corresponding constructor option not set) ...