-
Notifications
You must be signed in to change notification settings - Fork 1
/
covBase.h
97 lines (85 loc) · 2.77 KB
/
covBase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef _COVBASE_H_
#define _COVBASE_H_
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>
#include <vector>
#include "TFile.h"
#include "TMatrixDSym.h"
#include "TVectorT.h"
#include "TVectorD.h"
#include "TRandom3.h"
#include "TString.h"
#include "TF1.h"
#include "TMath.h"
class covBase
{
public:
covBase();
covBase(std::string name, std::string file);
covBase(std::string name, std::string file, unsigned int seed);
virtual ~covBase();
void setName(std::string name) { mName = name; }
void setParName(int i, std::string name) { fParName[i] = name; }
void setEvalLikelihood(int i, bool e) { fParEvalLikelihood[i] = e; }
void setPar(int i, double val) { fParCurr[i] = val; }
void setPars(std::vector<double> pars);
void setThrowPar(int i, double val) { fParSigma[i] = val; } // set sigma of a parameter or decide whether to throw a parameter or not
void setStepScales(float scale);
void setStepScale(int i, float scale) { fStepScale[i] = scale; }
void setPropFunc(int i, TF1 *func);
TMatrixDSym* getCovMatrix() { return cov; }
TMatrixDSym* getInvCovMatrix() { return invCov; }
std::string getName() { return mName; }
std::string getParName(int i) { return fParName[i]; }
std::vector<double> getNominalArray();
std::vector<double> getProposedArray();
std::vector<double> getCurrentArray();
double getNominal(int i) { return nominal.at(i); }
double getUncertainty(int i) {return fParSigma[i]; }
double getUp(int i) { return fParUp[i]; }
double getLow(int i) { return fParLow[i]; }
double getProposed(int i) { return fParProp[i]; }
double getCurrent(int i) { return fParCurr[i]; }
double getInit(int i) {return fParInit[i]; }
int getNPar() { return size; }
int getNXsecPar() {return size;}
TF1* getPropFunc(int i) { return fPropKernel[i]; }
bool isParameterFixed(int i) { return fParEvalLikelihood[i]; }
void PrintNominal();
void PrintPars();
virtual void throwNominal(bool nomValues = true, unsigned int seed = 0);
virtual double getLikelihood();
virtual void proposeStep();
virtual double GetWeightFrac(int i) {return fParCurr[i]-1;}
virtual double GetWeight(int i) {return fParCurr[i];}
void acceptStep();
protected:
void init(std::string name, std::string file);
void correlateSteps();
void genPropKernels();
void CholeskyDecomp(int npars, TMatrixD &chel_matrix);
void randomize();
TRandom3 *rnd;
int size;
int size_xsec;
std::string mName;
TMatrixDSym *cov;
TMatrixDSym *invCov;
std::vector<double> nominal;
TVectorD randPar;
TMatrixD *chel;
float *fStepScale;
TF1 **fPropKernel;
std::string *fParName;
double *fParInit;
double *fParCurr;
double *fParProp;
double *fParSigma;
double *fParUp;
double *fParLow;
bool *fParEvalLikelihood;
};
#endif