-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFakeFunctions.cc
150 lines (102 loc) · 4.33 KB
/
FakeFunctions.cc
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#include "FakeFunctions.h"
double FailFailToSingle(Double_t &weight, Double_t &error, TLorentzVector Lep1, TLorentzVector Lep2, TH2F* fakerate, TH2F* promptrate, Double_t eventWeight) {
UInt_t FRbinLep1, FRbinLep2;
if (0==eventWeight) eventWeight=1.0;
FRbinLep1=fakerate->FindBin(Lep1.Eta(),Lep1.Pt());
FRbinLep2=fakerate->FindBin(Lep2.Eta(),Lep2.Pt());
Double_t Lep1FR, Lep2FR;
Double_t Lep1FRerr, Lep2FRerr;
Lep1FR=fakerate->GetBinContent(FRbinLep1);
Lep1FRerr=fakerate->GetBinError(FRbinLep1);
Lep2FR=fakerate->GetBinContent(FRbinLep2);
Lep2FRerr=fakerate->GetBinError(FRbinLep2);
weight = (Lep1FR*(1-Lep2FR)+Lep2FR*(1-Lep1FR)) / ((1-Lep1FR)*(1-Lep2FR));
return weight;
/*
Double_t epsilon1, epsilon2;
Double_t epsilon1err, epsilon2err;
epsilon1 = Lep1FR / (1-Lep1FR);
epsilon2 = Lep2FR / (1-Lep2FR);
*/
}
double FailFail(Double_t &weight, Double_t &error, TLorentzVector Lep1, TLorentzVector Lep2, TH2F* fakerate, TH2F* promptrate, Double_t eventWeight) {
UInt_t FRbinLep1, FRbinLep2;
if (0==eventWeight) eventWeight=1.0;
FRbinLep1=fakerate->FindBin(fabs(Lep1.Eta()),Lep1.Pt());
cout<< "Eta " << fabs(Lep1.Eta()) << " and pt " << Lep1.Pt() << endl;
FRbinLep2=fakerate->FindBin(fabs(Lep2.Eta()),Lep2.Pt());
Double_t Lep1FR, Lep2FR;
Double_t Lep1FRerr, Lep2FRerr;
Lep1FR=fakerate->GetBinContent(FRbinLep1);
Lep1FRerr=fakerate->GetBinError(FRbinLep1);
Lep2FR=fakerate->GetBinContent(FRbinLep2);
Lep2FRerr=fakerate->GetBinError(FRbinLep2);
weight = - Lep1FR*Lep2FR / ((1-Lep1FR)*(1-Lep2FR));
return weight;
/*
Double_t epsilon1, epsilon2;
Double_t epsilon1err, epsilon2err;
epsilon1 = Lep1FR / (1-Lep1FR);
epsilon2 = Lep2FR / (1-Lep2FR);
*/
}
double FailPass(Double_t &weight, Double_t &error, TLorentzVector Lep1, TLorentzVector Lep2, TH2F* fakerate, TH2F* promptrate, Double_t eventWeight) {
UInt_t FRbinLep1, FRbinLep2;
if (0==eventWeight) eventWeight=1.0;
FRbinLep1=fakerate->FindBin(Lep1.Eta(),Lep1.Pt());
FRbinLep2=fakerate->FindBin(Lep2.Eta(),Lep2.Pt());
Double_t Lep1FR, Lep2FR;
Double_t Lep1FRerr, Lep2FRerr;
Lep1FR=fakerate->GetBinContent(FRbinLep1);
Lep1FRerr=fakerate->GetBinError(FRbinLep1);
Lep2FR=fakerate->GetBinContent(FRbinLep2);
Lep2FRerr=fakerate->GetBinError(FRbinLep2);
weight = Lep1FR / (1-Lep1FR);
return weight;
/*
Double_t epsilon1, epsilon2;
Double_t epsilon1err, epsilon2err;
epsilon1 = Lep1FR / (1-Lep1FR);
epsilon2 = Lep2FR / (1-Lep2FR);
*/
}
double PassFail(Double_t &weight, Double_t &error, TLorentzVector Lep1, TLorentzVector Lep2, TH2F* fakerate, TH2F* promptrate, Double_t eventWeight) {
UInt_t FRbinLep1, FRbinLep2;
if (0==eventWeight) eventWeight=1.0;
FRbinLep1=fakerate->FindBin(Lep1.Eta(),Lep1.Pt());
FRbinLep2=fakerate->FindBin(Lep2.Eta(),Lep2.Pt());
Double_t Lep1FR, Lep2FR;
Double_t Lep1FRerr, Lep2FRerr;
Lep1FR=fakerate->GetBinContent(FRbinLep1);
Lep1FRerr=fakerate->GetBinError(FRbinLep1);
Lep2FR=fakerate->GetBinContent(FRbinLep2);
Lep2FRerr=fakerate->GetBinError(FRbinLep2);
weight = Lep2FR / (1-Lep2FR);
return weight;
/*
Double_t epsilon1, epsilon2;
Double_t epsilon1err, epsilon2err;
epsilon1 = Lep1FR / (1-Lep1FR);
epsilon2 = Lep2FR / (1-Lep2FR);
*/
}
double PassPass(Double_t &weight, Double_t &error, TLorentzVector Lep1, TLorentzVector Lep2, TH2F* fakerate, TH2F* promptrate, Double_t eventWeight) {
UInt_t FRbinLep1, FRbinLep2;
if (0==eventWeight) eventWeight=1.0;
FRbinLep1=fakerate->FindBin(Lep1.Eta(),Lep1.Pt());
FRbinLep2=fakerate->FindBin(Lep2.Eta(),Lep2.Pt());
Double_t Lep1FR, Lep2FR;
Double_t Lep1FRerr, Lep2FRerr;
Lep1FR=fakerate->GetBinContent(FRbinLep1);
Lep1FRerr=fakerate->GetBinError(FRbinLep1);
Lep2FR=fakerate->GetBinContent(FRbinLep2);
Lep2FRerr=fakerate->GetBinError(FRbinLep2);
weight = Lep1FR*Lep2FR / ((1-Lep1FR)*(1-Lep2FR));
return weight;
/*
Double_t epsilon1, epsilon2;
Double_t epsilon1err, epsilon2err;
epsilon1 = Lep1FR / (1-Lep1FR);
epsilon2 = Lep2FR / (1-Lep2FR);
*/
}