BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCMVCDataModel.h
1 /*
2  * Copyright (C) 2007-2014, the BAT core developer team
3  * All rights reserved.
4  *
5  * For the licensing terms see doc/COPYING.
6  * For documentation see http://mpp.mpg.de/bat
7  */
8 
9 // ---------------------------------------------------------
10 
11 #ifndef __BCMVCDATAMODEL__H
12 #define __BCMVCDATAMODEL__H
13 
14 #include "../../BAT/BCModel.h"
15 
16 #include "BCMVCombination.h"
17 
18 #include <TH1D.h>
19 #include <TMatrixT.h>
20 #include <TMatrixD.h>
21 #include <TVectorT.h>
22 
23 // ---------------------------------------------------------
24 class BCMVCDataModel : public BCModel
25 {
26  public:
27 
28  // Constructor
30 
31  // Destructor
32  ~BCMVCDataModel();
33 
34  // setters
35 
36  // set the number of measurements
37  void SetNMeasurements(int n, double min, double max);
38 
39  // set the vector of measurements
40  void SetVectorMeasurements(TVectorD measurements)
41  { fVectorMeasurements.Clear();
42  fVectorMeasurements.ResizeTo(measurements);
43  fVectorMeasurements=measurements; };
44 
45  // set parameters
46  void SetParameters(std::vector<double> parameters);
47 
48  // set the ranges of the measurements for each measurement
49  // individually
50  void SetMeasurementRanges(const std::vector<double> & min, const std::vector<double> & max);
51 
52  // set the ranges of the measurements for all measurements
53  void SetMeasurementRanges(double min, double max);
54 
55  // set vector of observables
56  void SetVectorObservable(std::vector<int> vec)
57  { fVectorObservable = vec; };
58 
59  // set the covariance matrix
60  void SetCovarianceMatrix(TMatrixD matrix);
61 
62  // set the chi2 histogram
63  void SetHistChi2(TH1D* hist)
64  { fHistChi2 = hist; };
65 
66  // misc
67 
68  // print scatter plots of toy models and the chi2 indicating the
69  // position of the observed data
70  void PrintToys(std::string filename);
71 
72  // print a summary to the screen
73  void PrintSummary();
74 
75  // calculate the chi2
76  double Chi2(TVectorD observables, TVectorD measurements);
77 
78  // BAT methods
79 
80  // Methods to overload, see file BCMVCDataModel.cxx
81  double LogAPrioriProbability(const std::vector<double> &parameters);
82 
83  double LogLikelihood(const std::vector<double> &parameters);
84 
85  void MCMCUserIterationInterface();
86 
87  private:
88 
89  // the vector of measurements
90  TVectorD fVectorMeasurements;
91 
92  // the total covariance matrix
93  TMatrixD fCovarianceMatrix;
94 
95  // the inverse of the covariance matrix
96  TMatrixD fInvCovarianceMatrix;
97 
98  // the determinant of the covariance matrix
99  double fDetCovariance;
100 
101  // the parameters
102  std::vector<double> fPars;
103 
104  // the vector of observables
105  TVectorD fVectorObservables;
106 
107  // the vector of the index of the observables being measured
108  std::vector<int> fVectorObservable;
109 
110  // the chi2 histogram
111  TH1D* fHistChi2;
112 
113 };
114 // ---------------------------------------------------------
115 
116 #endif
117 
The base class for all user-defined models.
Definition: BCModel.h:50
double LogLikelihood(const std::vector< double > &parameters)
double LogAPrioriProbability(const std::vector< double > &parameters)