1 |
dhidas |
1.1 |
/*
|
2 |
|
|
* Electron.cpp
|
3 |
|
|
*
|
4 |
|
|
* Created on: Jun 25, 2010
|
5 |
|
|
* Author: lkreczko
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
#include "../../interface/RecoObjects/Electron.h"
|
9 |
|
|
#include <assert.h>
|
10 |
|
|
|
11 |
|
|
namespace BAT {
|
12 |
|
|
|
13 |
|
|
static const float initialBigValue = 123456789;
|
14 |
|
|
Electron::Electron() :
|
15 |
|
|
Lepton(),
|
16 |
|
|
usedAlgorithm(ElectronAlgorithm::Calo),
|
17 |
|
|
robustLooseId(false),
|
18 |
|
|
robustTightId(false),
|
19 |
|
|
superCluser_Eta(initialBigValue),
|
20 |
|
|
ecal_Isolation(initialBigValue),
|
21 |
|
|
hcal_Isolation(initialBigValue),
|
22 |
|
|
tracker_Isolation(initialBigValue),
|
23 |
|
|
innerLayerMissingHits_(initialBigValue),
|
24 |
|
|
sigma_IEtaIEta(0),
|
25 |
|
|
dPhi_In(0),
|
26 |
|
|
dEta_In(0),
|
27 |
|
|
hadOverEm(0),
|
28 |
|
|
gsfTrack(),
|
29 |
|
|
closesTrackID(-1),
|
30 |
|
|
sharedFractionInnerHits(0),
|
31 |
|
|
dCotThetaToNextTrack(0),
|
32 |
|
|
distToNextTrack(0)
|
33 |
|
|
{
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
Electron::Electron(float energy, float px, float py, float pz) :
|
37 |
|
|
Lepton(energy, px, py, pz),
|
38 |
|
|
usedAlgorithm(ElectronAlgorithm::Calo),
|
39 |
|
|
robustLooseId(false),
|
40 |
|
|
robustTightId(false),
|
41 |
|
|
superCluser_Eta(initialBigValue),
|
42 |
|
|
ecal_Isolation(initialBigValue),
|
43 |
|
|
hcal_Isolation(initialBigValue),
|
44 |
|
|
tracker_Isolation(initialBigValue),
|
45 |
|
|
innerLayerMissingHits_(initialBigValue),
|
46 |
|
|
sigma_IEtaIEta(0),
|
47 |
|
|
dPhi_In(0),
|
48 |
|
|
dEta_In(0),
|
49 |
|
|
hadOverEm(0),
|
50 |
|
|
gsfTrack(),
|
51 |
|
|
closesTrackID(-1),
|
52 |
|
|
sharedFractionInnerHits(0),
|
53 |
|
|
dCotThetaToNextTrack(0),
|
54 |
|
|
distToNextTrack(0)
|
55 |
|
|
{
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
Electron::~Electron() {
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
float Electron::superClusterEta() const {
|
62 |
|
|
return superCluser_Eta;
|
63 |
|
|
}
|
64 |
|
|
float Electron::ecalIsolation() const {
|
65 |
|
|
return ecal_Isolation;
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
float Electron::hcalIsolation() const {
|
69 |
|
|
return hcal_Isolation;
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
float Electron::trackerIsolation() const {
|
73 |
|
|
return tracker_Isolation;
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
float Electron::relativeIsolation() const {
|
77 |
|
|
return (ecal_Isolation + hcal_Isolation + tracker_Isolation) / this->et();
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
bool Electron::isIsolated() const {
|
81 |
|
|
return relativeIsolation() < 0.1;
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
bool Electron::isHEEPIsolated() const {
|
85 |
|
|
if (isInBarrelRegion())
|
86 |
|
|
return (ecal_Isolation + hcal_Isolation) < 2 + 0.03 * et();
|
87 |
|
|
else if (isInEndCapRegion() && et() < 50)
|
88 |
|
|
return (ecal_Isolation + hcal_Isolation) < 2.5;
|
89 |
|
|
else if (isInEndCapRegion() && et() >= 50)
|
90 |
|
|
return (ecal_Isolation + hcal_Isolation) < 2.5 + 0.03 * (et() - 50);
|
91 |
|
|
else
|
92 |
|
|
return false;
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
ElectronAlgorithm::value Electron::getUsedAlgorithm() const {
|
96 |
|
|
return usedAlgorithm;
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
void Electron::setEcalIsolation(float isolation) {
|
100 |
|
|
ecal_Isolation = isolation;
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
void Electron::setHcalIsolation(float isolation) {
|
104 |
|
|
hcal_Isolation = isolation;
|
105 |
|
|
}
|
106 |
|
|
|
107 |
|
|
void Electron::setTrackerIsolation(float isolation) {
|
108 |
|
|
tracker_Isolation = isolation;
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
void Electron::setSuperClusterEta(float eta) {
|
112 |
|
|
superCluser_Eta = eta;
|
113 |
|
|
}
|
114 |
|
|
|
115 |
|
|
void Electron::setRobustLooseID(bool id) {
|
116 |
|
|
robustLooseId = id;
|
117 |
|
|
}
|
118 |
|
|
|
119 |
|
|
void Electron::setRobustTightID(bool id) {
|
120 |
|
|
robustTightId = id;
|
121 |
|
|
}
|
122 |
|
|
|
123 |
|
|
void Electron::setSigmaIEtaIEta(float sigma) {
|
124 |
|
|
sigma_IEtaIEta = sigma;
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
void Electron::setDPhiIn(float dphi) {
|
128 |
|
|
dPhi_In = dphi;
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
void Electron::setDEtaIn(float deta) {
|
132 |
|
|
dEta_In = deta;
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
void Electron::setHadOverEm(float HoverE) {
|
136 |
|
|
hadOverEm = HoverE;
|
137 |
|
|
}
|
138 |
|
|
|
139 |
|
|
bool Electron::isLoose() const {
|
140 |
|
|
bool passesEt = et() > 20;
|
141 |
|
|
bool passesEta = fabs(eta()) < 2.5;
|
142 |
|
|
bool isolated = isPFIsolated();
|
143 |
|
|
bool notInCrack = isInCrack() == false;
|
144 |
|
|
return passesEt && passesEta && isolated && notInCrack && VBTF_W95_ElectronID();
|
145 |
|
|
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
bool Electron::isGood(const float unused) const {
|
149 |
|
|
bool passesPt = pt() > 45.0;
|
150 |
|
|
bool passesEta = fabs(eta()) < 2.5 && !isInCrack();
|
151 |
|
|
|
152 |
|
|
bool passesD0 = false;
|
153 |
|
|
if (usedAlgorithm == ElectronAlgorithm::Calo)
|
154 |
|
|
passesD0 = fabs(d0_wrtBeamSpot()) < 0.02;//cm
|
155 |
|
|
else
|
156 |
|
|
// use d0 wrt primary vertex for
|
157 |
|
|
passesD0 = fabs(d0()) < 0.02; //cm
|
158 |
|
|
|
159 |
|
|
bool passesDistanceToPV = fabs(zDistanceToPrimaryVertex) < 1;
|
160 |
|
|
bool passesID = VBTF_W70_ElectronID();
|
161 |
|
|
return passesPt && passesEta && passesD0 && passesID && passesDistanceToPV;
|
162 |
|
|
}
|
163 |
|
|
|
164 |
|
|
bool Electron::isQCDElectron(const float minEt) const {
|
165 |
|
|
bool passesEt = et() > minEt;
|
166 |
|
|
bool passesEta = fabs(eta()) < 2.5 && !isInCrack();
|
167 |
|
|
|
168 |
|
|
bool passesD0 = false;
|
169 |
|
|
if (usedAlgorithm == ElectronAlgorithm::Calo)
|
170 |
|
|
passesD0 = fabs(d0_wrtBeamSpot()) < 0.02;//cm
|
171 |
|
|
else
|
172 |
|
|
passesD0 = fabs(d0()) < 0.02;//cm
|
173 |
|
|
|
174 |
|
|
bool passesDistanceToPV = fabs(zDistanceToPrimaryVertex) < 1;
|
175 |
|
|
bool passesID = QCD_AntiID_W70();
|
176 |
|
|
return passesEt && passesEta && passesD0 && passesID && passesDistanceToPV;
|
177 |
|
|
}
|
178 |
|
|
|
179 |
|
|
bool Electron::isInBarrelRegion() const {
|
180 |
|
|
return fabs(superClusterEta()) < 1.4442;
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
bool Electron::isInCrack() const {
|
184 |
|
|
return !isInBarrelRegion() && !isInEndCapRegion();
|
185 |
|
|
}
|
186 |
|
|
|
187 |
|
|
bool Electron::isInEndCapRegion() const {
|
188 |
|
|
return fabs(superClusterEta()) > 1.5660;
|
189 |
|
|
}
|
190 |
|
|
|
191 |
|
|
bool Electron::isFromConversion() const {
|
192 |
|
|
return innerLayerMissingHits_ > 0;
|
193 |
|
|
}
|
194 |
|
|
|
195 |
|
|
bool Electron::isTaggedAsConversion(float maxDist, float maxDCotTheta) const {
|
196 |
|
|
return fabs(distToNextTrack) < maxDist && fabs(dCotThetaToNextTrack) < maxDCotTheta;
|
197 |
|
|
}
|
198 |
|
|
|
199 |
|
|
/* Electron ID cuts (without isolation) from:
|
200 |
|
|
* https://twiki.cern.ch/twiki/bin/view/CMS/SimpleCutBasedEleID#Cuts_for_use_on_2010_data
|
201 |
|
|
*/
|
202 |
|
|
bool Electron::VBTF_W70_ElectronID() const {
|
203 |
|
|
if (isInBarrelRegion())
|
204 |
|
|
return getVBTF_W70_ElectronID_Barrel();
|
205 |
|
|
else if (isInEndCapRegion())
|
206 |
|
|
return getVBTF_W70_ElectronID_Endcap();
|
207 |
|
|
else
|
208 |
|
|
// in crack
|
209 |
|
|
return false;
|
210 |
|
|
}
|
211 |
|
|
|
212 |
|
|
bool Electron::getVBTF_W70_ElectronID_Barrel() const {
|
213 |
|
|
bool passesSigmaIEta = sigma_IEtaIEta < 0.01;
|
214 |
|
|
bool passesDPhiIn = fabs(dPhi_In) < 0.03;
|
215 |
|
|
bool passesDEtaIn = fabs(dEta_In) < 0.004;
|
216 |
|
|
bool passesHadOverEm = hadOverEm < 0.025;
|
217 |
|
|
return passesSigmaIEta && passesDPhiIn && passesDEtaIn && passesHadOverEm;
|
218 |
|
|
}
|
219 |
|
|
|
220 |
|
|
bool Electron::getVBTF_W70_ElectronID_Endcap() const {
|
221 |
|
|
bool passesSigmaIEta = sigma_IEtaIEta < 0.03;
|
222 |
|
|
bool passesDPhiIn = fabs(dPhi_In) < 0.02;
|
223 |
|
|
bool passesDEtaIn = fabs(dEta_In) < 0.005;
|
224 |
|
|
bool passesHadOverEm = hadOverEm < 0.025;
|
225 |
|
|
return passesSigmaIEta && passesDPhiIn && passesDEtaIn && passesHadOverEm;
|
226 |
|
|
}
|
227 |
|
|
|
228 |
|
|
bool Electron::VBTF_W95_ElectronID() const {
|
229 |
|
|
if (isInBarrelRegion())
|
230 |
|
|
return getVBTF_W95_ElectronID_Barrel();
|
231 |
|
|
else if (isInEndCapRegion())
|
232 |
|
|
return getVBTF_W95_ElectronID_Endcap();
|
233 |
|
|
else
|
234 |
|
|
// in crack
|
235 |
|
|
return false;
|
236 |
|
|
}
|
237 |
|
|
|
238 |
|
|
bool Electron::getVBTF_W95_ElectronID_Barrel() const {
|
239 |
|
|
bool passesSigmaIEta = sigma_IEtaIEta < 0.01;
|
240 |
|
|
bool passesDPhiIn = fabs(dPhi_In) < 0.8;
|
241 |
|
|
bool passesDEtaIn = fabs(dEta_In) < 0.007;
|
242 |
|
|
bool passesHadOverEm = hadOverEm < 0.15;
|
243 |
|
|
return passesSigmaIEta && passesDPhiIn && passesDEtaIn && passesHadOverEm;
|
244 |
|
|
}
|
245 |
|
|
|
246 |
|
|
bool Electron::getVBTF_W95_ElectronID_Endcap() const {
|
247 |
|
|
bool passesSigmaIEta = sigma_IEtaIEta < 0.03;
|
248 |
|
|
bool passesDPhiIn = fabs(dPhi_In) < 0.7;
|
249 |
|
|
bool passesDEtaIn = fabs(dEta_In) < 0.01;
|
250 |
|
|
bool passesHadOverEm = hadOverEm < 0.07;
|
251 |
|
|
return passesSigmaIEta && passesDPhiIn && passesDEtaIn && passesHadOverEm;
|
252 |
|
|
}
|
253 |
|
|
|
254 |
|
|
bool Electron::QCD_AntiID_W70() const {
|
255 |
|
|
if (isInBarrelRegion())
|
256 |
|
|
return QCD_AntiID_W70_Barrel();
|
257 |
|
|
else if (isInEndCapRegion())
|
258 |
|
|
return QCD_AntiID_W70_Endcap();
|
259 |
|
|
else
|
260 |
|
|
return false;
|
261 |
|
|
}
|
262 |
|
|
|
263 |
|
|
bool Electron::QCD_AntiID_W70_Barrel() const {
|
264 |
|
|
bool passesSigmaIEta = sigma_IEtaIEta < 0.01;
|
265 |
|
|
bool passesDPhiIn = fabs(dPhi_In) > 0.03;
|
266 |
|
|
bool passesDEtaIn = fabs(dEta_In) > 0.004;
|
267 |
|
|
bool passesHadOverEm = hadOverEm < 0.025;
|
268 |
|
|
return passesSigmaIEta && passesDPhiIn && passesDEtaIn && passesHadOverEm;
|
269 |
|
|
}
|
270 |
|
|
|
271 |
|
|
bool Electron::QCD_AntiID_W70_Endcap() const {
|
272 |
|
|
bool passesSigmaIEta = sigma_IEtaIEta < 0.03;
|
273 |
|
|
bool passesDPhiIn = fabs(dPhi_In) > 0.02;
|
274 |
|
|
bool passesDEtaIn = fabs(dEta_In) > 0.005;
|
275 |
|
|
bool passesHadOverEm = hadOverEm < 0.025;
|
276 |
|
|
return passesSigmaIEta && passesDPhiIn && passesDEtaIn && passesHadOverEm;
|
277 |
|
|
}
|
278 |
|
|
|
279 |
|
|
float Electron::sigmaIEtaIEta() const {
|
280 |
|
|
return sigma_IEtaIEta;
|
281 |
|
|
}
|
282 |
|
|
|
283 |
|
|
float Electron::dPhiIn() const {
|
284 |
|
|
return dPhi_In;
|
285 |
|
|
}
|
286 |
|
|
|
287 |
|
|
float Electron::dEtaIn() const {
|
288 |
|
|
return dEta_In;
|
289 |
|
|
}
|
290 |
|
|
|
291 |
|
|
float Electron::HadOverEm() const {
|
292 |
|
|
return hadOverEm;
|
293 |
|
|
}
|
294 |
|
|
|
295 |
|
|
float Electron::HEEPet() const {
|
296 |
|
|
return energy() * sin(fourvector.Theta());
|
297 |
|
|
}
|
298 |
|
|
|
299 |
|
|
bool Electron::RobustLooseID() const {
|
300 |
|
|
return robustLooseId;
|
301 |
|
|
}
|
302 |
|
|
|
303 |
|
|
bool Electron::RobustTightID() const {
|
304 |
|
|
return robustTightId;
|
305 |
|
|
}
|
306 |
|
|
|
307 |
|
|
void Electron::setNumberOfMissingInnerLayerHits(float missingHits) {
|
308 |
|
|
innerLayerMissingHits_ = missingHits;
|
309 |
|
|
}
|
310 |
|
|
|
311 |
|
|
unsigned short Electron::getClosestJetIndex(const JetCollection& jets) const {
|
312 |
|
|
unsigned short idOfClosest = 999;
|
313 |
|
|
float closestDR = 999.;
|
314 |
|
|
for (unsigned short index = 0; index < jets.size(); ++index) {
|
315 |
|
|
float DR = deltaR(jets.at(index));
|
316 |
|
|
if (DR < closestDR) {
|
317 |
|
|
closestDR = DR;
|
318 |
|
|
idOfClosest = index;
|
319 |
|
|
}
|
320 |
|
|
}
|
321 |
|
|
return idOfClosest;
|
322 |
|
|
}
|
323 |
|
|
|
324 |
|
|
void Electron::setUsedAlgorithm(ElectronAlgorithm::value algo) {
|
325 |
|
|
usedAlgorithm = algo;
|
326 |
|
|
}
|
327 |
|
|
|
328 |
|
|
void Electron::setGSFTrack(const TrackPointer track) {
|
329 |
|
|
gsfTrack = track;
|
330 |
|
|
}
|
331 |
|
|
|
332 |
|
|
const TrackPointer Electron::GSFTrack() const {
|
333 |
|
|
return gsfTrack;
|
334 |
|
|
}
|
335 |
|
|
|
336 |
|
|
void Electron::setClosestTrackID(int trackID) {
|
337 |
|
|
closesTrackID = trackID;
|
338 |
|
|
}
|
339 |
|
|
|
340 |
|
|
int Electron::closestCTFTrackID() const {
|
341 |
|
|
return closesTrackID;
|
342 |
|
|
}
|
343 |
|
|
|
344 |
|
|
void Electron::setSharedFractionInnerHits(float hits) {
|
345 |
|
|
sharedFractionInnerHits = hits;
|
346 |
|
|
}
|
347 |
|
|
|
348 |
|
|
float Electron::shFracInnerLayer() const {
|
349 |
|
|
return sharedFractionInnerHits;
|
350 |
|
|
}
|
351 |
|
|
|
352 |
|
|
void Electron::setDistToNextTrack(float dist) {
|
353 |
|
|
distToNextTrack = dist;
|
354 |
|
|
}
|
355 |
|
|
|
356 |
|
|
void Electron::setDCotThetaToNextTrack(float dCotTheta) {
|
357 |
|
|
dCotThetaToNextTrack = dCotTheta;
|
358 |
|
|
}
|
359 |
|
|
|
360 |
|
|
bool Electron::isPFIsolated() const {
|
361 |
|
|
return pfIsolation() < 0.1;
|
362 |
|
|
}
|
363 |
|
|
|
364 |
|
|
ElectronAlgorithm::value Electron::algorithm() const {
|
365 |
|
|
return usedAlgorithm;
|
366 |
|
|
}
|
367 |
|
|
|
368 |
|
|
float Electron::innerLayerMissingHits() const {
|
369 |
|
|
return innerLayerMissingHits_;
|
370 |
|
|
}
|
371 |
|
|
|
372 |
|
|
float Electron::distToClosestTrack() const {
|
373 |
|
|
return distToNextTrack;
|
374 |
|
|
}
|
375 |
|
|
|
376 |
|
|
float Electron::dCotThetaToClosestTrack() const {
|
377 |
|
|
return dCotThetaToNextTrack;
|
378 |
|
|
}
|
379 |
|
|
|
380 |
|
|
}
|