-
Notifications
You must be signed in to change notification settings - Fork 0
/
likelihood.h
94 lines (66 loc) · 2.09 KB
/
likelihood.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
#ifndef LIKELIHOOD_H__
#define LIKELIHOOD_H__
#include <vector>
#include <map>
#include "Minuit2/FCNBase.h"
#include "wave.h"
#include "event.h"
class TH2;
class likelihood : public ROOT::Minuit2::FCNBase {
std::vector<coherent_waves> ws;
std::vector<std::vector<event> > binnedRDevents;
std::vector<std::vector<event> > binnedMCevents;
std::vector<event> flatMCevents;
std::vector<double> binnedEtaAcc;
size_t nBins;
double threshold;
double binWidth;
size_t idxBranching;
size_t currentBin;
mutable std::map<int, double> weights;
public:
likelihood(waveset ws_,
std::vector<event>& RDevents,
std::vector<event>& MCevents,
std::vector<event>& MCallEvents,
size_t nBins_, double threshold_, double binWidth_,
size_t idxBranching);
double Up() const { return 0.5; }
public:
double
decay(int reflectivity, int l, int m, double theta, double phi) const;
double
probabilityDensity(const std::vector<double>& x, double theta, double phi) const;
double
probabilityDensity(const std::vector<double>& x, const event& e) const;
double
MCweight(int reflectivity, const wave& w1, const wave& w2) const;
double
calc_mc_likelihood(const std::vector<double>& x) const;
double
calc_rd_likelihood(const std::vector<double>& x) const;
double
calc_likelihood(const std::vector<double>& x) const;
void
fillPredict(const std::vector<double>& x, TH2* hth, TH2* hph) const;
double
operator()(const std::vector<double>& x) const;
std::complex<double>
calcMoment(int L, int M) const;
void
setBin(size_t iBin) { currentBin = iBin;
massLow = threshold + iBin*binWidth;
massHigh = threshold + (iBin+1)*binWidth;
}
size_t
eventsInBin() const { return binnedRDevents[currentBin].size(); }
size_t
MCeventsInBin() const { return (size_t)(binnedMCevents[currentBin].size() / binnedEtaAcc[currentBin]); }
void
clearWeights() { weights.clear(); }
private:
// Not implemented, used to check that likelihoods are not copied,
// which previously happened unintendedly.
likelihood& operator=(const likelihood&);
};
#endif