1 |
claudioc |
1.1 |
#include "Math/LorentzVector.h"
|
2 |
|
|
#include "Math/VectorUtil.h"
|
3 |
|
|
#include "TMath.h"
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
//----------------------------------------
|
7 |
|
|
// To be used on Monte Carlo events.
|
8 |
|
|
// Input is hypothesis index.
|
9 |
|
|
// Output is the 2010 trigger efficiency for the
|
10 |
|
|
// given hypothesis.
|
11 |
|
|
//
|
12 |
|
|
// Claudio, Jae, Avi 3 Nov 2010
|
13 |
|
|
//----------------------------------------
|
14 |
|
|
// float triggerSuperModelEffic(int hyp) {
|
15 |
|
|
float triggerSuperModelEffic(int hyp, float pt1, float eta1,
|
16 |
|
|
int id1, float pt2, float eta2, int id2) {
|
17 |
|
|
|
18 |
|
|
//----------------------------------------------
|
19 |
|
|
// Some important inputs
|
20 |
|
|
//-----------------------------------------------
|
21 |
|
|
// Plateau efficiency of muon trigger
|
22 |
|
|
// (For now we ignore the fact that in the mu9 period
|
23 |
|
|
// it was not quite as good)
|
24 |
|
|
float effmu = 0.93;
|
25 |
|
|
|
26 |
|
|
// Fraction of luminosity where mu9 was not prescaled
|
27 |
|
|
// run <= 147116
|
28 |
|
|
float f9=0.215;
|
29 |
|
|
|
30 |
|
|
// Fraction of luminosity where mu9 was prescaled and mu11
|
31 |
|
|
// was unprescaled
|
32 |
|
|
// 147196 <= run <= 148058
|
33 |
|
|
float f11=0.04;
|
34 |
|
|
|
35 |
|
|
// Fraction of luminosity where mu9 and mu11 were prescaled
|
36 |
|
|
// and mu15 was not
|
37 |
|
|
//float f15 = 1.0 - f9 - f11;
|
38 |
|
|
|
39 |
|
|
// Fraction of luminosity with 100% efficient ele10 trigger
|
40 |
|
|
// run <= 139980
|
41 |
|
|
float e10=0.002;
|
42 |
|
|
|
43 |
|
|
//Fraction of luminosity with 100% efficienct ele15 GeV trigger
|
44 |
|
|
// 139980<run<=144114
|
45 |
|
|
float e15=0.086;
|
46 |
|
|
|
47 |
|
|
//Fraction of luminosity with 100% efficient ele17 trigger
|
48 |
|
|
// 14114<run<=147116
|
49 |
|
|
float e17=0.127;
|
50 |
|
|
|
51 |
|
|
//Fraction of luminosity with somewhat inefficient (~93%) ele17 trigger
|
52 |
|
|
// 147116<run<=148058
|
53 |
|
|
float e17b=0.273;
|
54 |
|
|
|
55 |
|
|
//Efficiency of 17 GeV trigger in 147116<run<=148058
|
56 |
|
|
float eff17b=0.93;
|
57 |
|
|
|
58 |
|
|
//Fraction of luminosity with messy electron trigger
|
59 |
|
|
// run>148058
|
60 |
|
|
float emess=0.512;
|
61 |
|
|
|
62 |
|
|
//Efficiency in pt bins for messy electron trigger period
|
63 |
|
|
// run>148058 (rounded to the nearest 1%)
|
64 |
|
|
float eff17to22 =0.99;
|
65 |
|
|
float eff22to27 =0.97;
|
66 |
|
|
float eff27to32 =0.98;
|
67 |
|
|
float eff32andUp=1.00;
|
68 |
|
|
|
69 |
|
|
//-------------------------------------------------
|
70 |
|
|
// Algorithm applies only to events with one
|
71 |
|
|
// lepton above 20 and one letpon above 10.
|
72 |
|
|
// If this is not the case, return zero and complain.
|
73 |
|
|
//-------------------------------------------------
|
74 |
|
|
//bool badHyp = false;
|
75 |
|
|
//if( TMath::Max(cms2.hyp_ll_p4()[hyp].pt(),cms2.hyp_lt_p4()[hyp].pt()) < 20.)
|
76 |
|
|
//badHyp=true;
|
77 |
|
|
//if( TMath::Min(cms2.hyp_ll_p4()[hyp].pt(),cms2.hyp_lt_p4()[hyp].pt()) < 10.)
|
78 |
|
|
//badHyp=true;
|
79 |
|
|
//if (badHyp) {
|
80 |
|
|
//std::cout << "Bad inputs to trigger SuperModelEffic" << std::endl;
|
81 |
|
|
// return 0.0;
|
82 |
|
|
//}
|
83 |
|
|
|
84 |
|
|
//-------------------------------------------------
|
85 |
|
|
// If it is a dielectron event, we return 100%
|
86 |
|
|
//-------------------------------------------------
|
87 |
|
|
//if (cms2.hyp_type()[hyp] == 3) return 1.0;
|
88 |
|
|
if (hyp == 3) return 1.0;
|
89 |
|
|
|
90 |
|
|
//-------------------------------------------------
|
91 |
|
|
// Dimuon events.
|
92 |
|
|
//-------------------------------------------------
|
93 |
|
|
if (hyp == 0) {
|
94 |
|
|
|
95 |
|
|
if (pt2>pt1) {
|
96 |
|
|
float pttemp = pt2;
|
97 |
|
|
float etatemp = eta2;
|
98 |
|
|
pt2 = pt1;
|
99 |
|
|
eta2 = eta1;
|
100 |
|
|
pt1 = pttemp;
|
101 |
|
|
eta1 = etatemp;
|
102 |
|
|
}
|
103 |
|
|
|
104 |
|
|
// both above 15 and both in eta<2.1
|
105 |
|
|
if (pt2>=15 && eta1<=2.1 && eta2<=2.1) {
|
106 |
|
|
float eff = 1 - (1-effmu)*(1-effmu);
|
107 |
|
|
return eff;
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
// the 2nd one between 11 and 15, both in eta<2.1
|
111 |
|
|
if (pt2>11 && pt2<15 && eta1<=2.1 && eta2<=2.1) {
|
112 |
|
|
float eff = effmu + (f9+f11)*effmu*(1-effmu);
|
113 |
|
|
return eff;
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
// the 2nd one between 10 and 11, both in eta<2.1
|
117 |
|
|
if (pt2<11 && eta1<=2.1 && eta2<=2.1) {
|
118 |
|
|
float eff = effmu + f9*effmu*(1-effmu);
|
119 |
|
|
return eff;
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
// both at high eta
|
123 |
|
|
if (eta1>2.1 && eta2>2.1) {
|
124 |
|
|
float eff = effmu*effmu;
|
125 |
|
|
return eff;
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
// One with pt>15 eta<2.1. The other with eta>2.1
|
129 |
|
|
if ( (pt1>=15 && eta1<=2.1 && eta2>2.1) ||
|
130 |
|
|
(pt2>=15 && eta2<=2.1 && eta1>2.1) ) {
|
131 |
|
|
float eff = effmu;
|
132 |
|
|
return eff;
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
// First with 11<pt<15 eta<2.1. Second one with eta>2.1
|
137 |
|
|
if ( (pt1>=11 && pt1<15 && eta1<=2.1 && eta2>2.1) ||
|
138 |
|
|
(pt2>=11 && pt2<15 && eta2<=2.1 && eta1>2.1) ) {
|
139 |
|
|
float eff = (f9+f11)*effmu + (1-f9-f11)*effmu*effmu;
|
140 |
|
|
return eff;
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
// First with 10<pt<11 eta<2.1. Second one with eta>2.1
|
144 |
|
|
if ( (pt1<11 && eta1<=2.1 && eta2>2.1) ||
|
145 |
|
|
(pt2<11 && eta2<=2.1 && eta1>2.1) ) {
|
146 |
|
|
float eff = f9*effmu + (1-f9)*effmu*effmu;
|
147 |
|
|
return eff;
|
148 |
|
|
}
|
149 |
|
|
|
150 |
|
|
// We should never get here!
|
151 |
|
|
std::cout << "----------" <<std::endl;
|
152 |
|
|
std::cout << "Logic failure for mu-mu events in triggerSuperModel" << std::endl;
|
153 |
|
|
std::cout << "This should never happen -- do not ignore" << std::endl;
|
154 |
|
|
std::cout << "----------" << std::endl;
|
155 |
|
|
return 0.0;
|
156 |
|
|
|
157 |
|
|
} // close mumu code block
|
158 |
|
|
|
159 |
|
|
//-------------------------------------------------
|
160 |
|
|
// emu events
|
161 |
|
|
//-------------------------------------------------
|
162 |
|
|
if (hyp == 1 || hyp == 2) {
|
163 |
|
|
|
164 |
|
|
float ptmu;
|
165 |
|
|
float ptele;
|
166 |
|
|
float etamu;
|
167 |
|
|
|
168 |
|
|
if (id1 == 13) {
|
169 |
|
|
ptmu = pt1;
|
170 |
|
|
ptele = pt2;
|
171 |
|
|
etamu= eta1;
|
172 |
|
|
} else {
|
173 |
|
|
ptmu = pt2;
|
174 |
|
|
ptele = pt1;
|
175 |
|
|
etamu= eta2;
|
176 |
|
|
}
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
// muon in eta<2.1 and pt>15;
|
180 |
|
|
if (ptmu>= 15 && etamu<= 2.1) {
|
181 |
|
|
float delta;
|
182 |
|
|
if (ptele<=15.) {
|
183 |
|
|
delta=e10;
|
184 |
|
|
} else if (ptele<17) {
|
185 |
|
|
delta=e10+e15;
|
186 |
|
|
} else if (ptele>=17) {
|
187 |
|
|
delta = e10+e15+e17+e17b*eff17b;
|
188 |
|
|
} if (ptele<=22) {
|
189 |
|
|
delta = e10+e15+e17+e17b*eff17b+emess*eff17to22;
|
190 |
|
|
} else if (ptele<=27) {
|
191 |
|
|
delta = e10+e15+e17+e17b*eff17b+emess*eff22to27;
|
192 |
|
|
} else if (ptele<=32) {
|
193 |
|
|
delta = e10+e15+e17+e17b*eff17b+emess*eff27to32;
|
194 |
|
|
} else {
|
195 |
|
|
delta = e10+e15+e17+e17b*eff17b+emess*eff32andUp;
|
196 |
|
|
}
|
197 |
|
|
float eff = effmu + (1-effmu)*delta;
|
198 |
|
|
return eff;
|
199 |
|
|
}
|
200 |
|
|
|
201 |
|
|
// muon in eta<2.1 and pt beween 11 and 15 or 10 and 11
|
202 |
|
|
// (note: here the electron has pt>20 for sure)
|
203 |
|
|
if (ptmu< 15 && etamu<= 2.1) {
|
204 |
|
|
float eleff;
|
205 |
|
|
float f=f9;
|
206 |
|
|
if (ptmu>=11) f=f11+f9;
|
207 |
|
|
if (ptele <= 22) eleff=eff17to22;
|
208 |
|
|
if (ptele <= 27) eleff=eff22to27;
|
209 |
|
|
if (ptele <= 32) eleff=eff27to32;
|
210 |
|
|
if (ptele > 32) eleff=eff32andUp;
|
211 |
|
|
float delta2 = (1-f)*(effmu + (1-effmu)*eleff);
|
212 |
|
|
float delta3 = f*(1-effmu)*( (e10+e15+e17)/f + eff17b*(f-e10-e15-e17)/f);
|
213 |
|
|
float eff = f*effmu + delta2 +delta3;
|
214 |
|
|
return eff;
|
215 |
|
|
}
|
216 |
|
|
|
217 |
|
|
// muon in eta>2.1
|
218 |
|
|
if (etamu>2.1) {
|
219 |
|
|
float eff;
|
220 |
|
|
if (ptele<=15) {
|
221 |
|
|
eff = e10;
|
222 |
|
|
} else if (ptele<=17) {
|
223 |
|
|
eff = e10 + e15;
|
224 |
|
|
} else if (ptele <= 22) {
|
225 |
|
|
eff = e10 + e15 + e17 + e17b*eff17b + emess*eff17to22;
|
226 |
|
|
} else if (ptele <= 27) {
|
227 |
|
|
eff = e10 + e15 + e17 + e17b*eff17b + emess*eff22to27;
|
228 |
|
|
} else if (ptele <= 32) {
|
229 |
|
|
eff = e10 + e15 + e17 + e17b*eff17b + emess*eff27to32;
|
230 |
|
|
} else {
|
231 |
|
|
eff = e10 + e15 + e17 + e17b*eff17b + emess*eff32andUp;
|
232 |
|
|
}
|
233 |
|
|
return eff;
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
// We should never get here!
|
237 |
|
|
std::cout << "----------" <<std::endl;
|
238 |
|
|
std::cout << "Logic failure for e-mu events in triggerSuperModel" << std::endl;
|
239 |
|
|
std::cout << "This should never happen -- do not ignore" << std::endl;
|
240 |
|
|
std::cout << "----------" << std::endl;
|
241 |
|
|
return 0.0;
|
242 |
|
|
|
243 |
|
|
} // Close emu code block
|
244 |
|
|
|
245 |
|
|
// We should never get here!
|
246 |
|
|
std::cout << "----------" <<std::endl;
|
247 |
|
|
std::cout << "Logic failure in triggerSuperModel" << std::endl;
|
248 |
|
|
std::cout << "This should never happen -- do not ignore" << std::endl;
|
249 |
|
|
std::cout << "----------" << std::endl;
|
250 |
|
|
return 0.0;
|
251 |
|
|
|
252 |
|
|
}
|