1 |
#include "cute/cute.h"
|
2 |
#include "cute/cute_suite.h"
|
3 |
|
4 |
#include <boost/scoped_ptr.hpp>
|
5 |
|
6 |
#include "../interface/Event.h"
|
7 |
#include "../interface/OnlyForTests/DummyTTbarEvent.h"
|
8 |
#include "TestObjectFactory.h"
|
9 |
#include <iostream>
|
10 |
|
11 |
using namespace BAT;
|
12 |
using namespace std;
|
13 |
|
14 |
struct TestTopPairEventCandidate {
|
15 |
DummyTTbarEvent ttbarEvent, goodZEvent, poorZEvent, DiJetEvent, DiJetEventWithConversion, muonEvent;
|
16 |
DummyTTbarEvent emptyEvent, customEvent;
|
17 |
|
18 |
ElectronPointer goodIsolatedElectron, goodIsolatedElectron2;
|
19 |
ElectronPointer goodLooseElectron;
|
20 |
ElectronPointer badElectron;
|
21 |
ElectronPointer electronFromConversion;
|
22 |
JetPointer goodJet, goodBJet, badJet, goodJetCloseToElectron;
|
23 |
VertexPointer goodVertex;
|
24 |
VertexPointer badVertex;
|
25 |
MuonPointer goodIsolatedMuon;
|
26 |
MuonPointer badMuon;
|
27 |
METPointer met;
|
28 |
TrackCollection lessThan10Tracks;
|
29 |
TrackCollection moreThan10TracksHighPurity;
|
30 |
TrackCollection moreThan10TracksLowPurity;
|
31 |
TrackCollection moreThan10TracksMixedPurity_H;
|
32 |
TrackCollection moreThan10TracksMixedPurity_L;
|
33 |
|
34 |
TestTopPairEventCandidate() :
|
35 |
ttbarEvent(),
|
36 |
goodZEvent(),
|
37 |
poorZEvent(),
|
38 |
DiJetEvent(),
|
39 |
DiJetEventWithConversion(),
|
40 |
muonEvent(),
|
41 |
emptyEvent(),
|
42 |
customEvent(),
|
43 |
goodIsolatedElectron(TestObjectFactory::goodIsolatedElectron()),
|
44 |
goodIsolatedElectron2(TestObjectFactory::goodIsolatedElectron2()),
|
45 |
goodLooseElectron(new Electron(100., 79., -13., -5.)),
|
46 |
badElectron(new Electron(20, 14., 15., 0)),
|
47 |
electronFromConversion(new Electron(*goodIsolatedElectron)),
|
48 |
goodJet(new Jet(100, 13, 99, 5)),
|
49 |
goodBJet(new Jet(*goodJet)),
|
50 |
badJet(new Jet(20, 19, 0, 0)),
|
51 |
goodJetCloseToElectron(new Jet(100., 98., 13., 5.)),
|
52 |
goodVertex(TestObjectFactory::goodVertex()),
|
53 |
badVertex(TestObjectFactory::badFakeVertex()),
|
54 |
goodIsolatedMuon(new Muon(100., 99., 13., 5.)),
|
55 |
badMuon(new Muon(100., 99., 13., 5.)),
|
56 |
met(new MET(40, 30)) {
|
57 |
setUpGoodLooseElectron();
|
58 |
setUpBadElectron();
|
59 |
setUpGoodIsolatedElectronFromConversion();
|
60 |
setUpGoodJet();
|
61 |
setUpGoodBJet();
|
62 |
setUpGoodJetCloseToElectron();
|
63 |
setUpIsolatedGoodMuon();
|
64 |
setUpBadMuon();
|
65 |
setUpTracks();
|
66 |
|
67 |
setUpTTbarEvent();
|
68 |
setUpGoodZEvent();
|
69 |
setUpPoorZEvent();
|
70 |
setUpDiJetEvent();
|
71 |
setUpMuonEvent();
|
72 |
setUpCustomEvent();
|
73 |
}
|
74 |
|
75 |
private:
|
76 |
|
77 |
void setUpBadElectron() {
|
78 |
badElectron->setHcalIsolation(4);
|
79 |
badElectron->setEcalIsolation(44);
|
80 |
badElectron->setTrackerIsolation(1);
|
81 |
badElectron->setZDistanceToPrimaryVertex(0);
|
82 |
}
|
83 |
|
84 |
void setUpGoodLooseElectron() {
|
85 |
goodLooseElectron->setHcalIsolation(5);
|
86 |
goodLooseElectron->setEcalIsolation(3);
|
87 |
goodLooseElectron->setTrackerIsolation(4);
|
88 |
goodLooseElectron->setSigmaIEtaIEta(0.009);
|
89 |
goodLooseElectron->setDPhiIn(0.7);
|
90 |
goodLooseElectron->setDEtaIn(0.006);
|
91 |
goodLooseElectron->setHadOverEm(0.14);
|
92 |
goodLooseElectron->setRobustLooseID(true);
|
93 |
goodLooseElectron->setNumberOfMissingInnerLayerHits(0);
|
94 |
goodLooseElectron->setSuperClusterEta(0);
|
95 |
goodLooseElectron->setZDistanceToPrimaryVertex(0);
|
96 |
TrackPointer track = TrackPointer(new Track(goodLooseElectron->phi(), goodLooseElectron->eta(),
|
97 |
goodLooseElectron->pt(), goodLooseElectron->theta()));
|
98 |
track->setD0(goodLooseElectron->d0_wrtBeamSpot());
|
99 |
track->setCharge(goodLooseElectron->charge());
|
100 |
assert(goodLooseElectron->isGood() == false);
|
101 |
assert(goodLooseElectron->isLoose() && goodLooseElectron->relativeIsolation() < 1.);
|
102 |
}
|
103 |
|
104 |
void setUpGoodIsolatedElectronFromConversion() {
|
105 |
electronFromConversion->setHcalIsolation(0.5);
|
106 |
electronFromConversion->setEcalIsolation(0.3);
|
107 |
electronFromConversion->setTrackerIsolation(0.4);
|
108 |
electronFromConversion->setNumberOfMissingInnerLayerHits(3);
|
109 |
electronFromConversion->setZDistanceToPrimaryVertex(0);
|
110 |
}
|
111 |
void setUpGoodJet() {
|
112 |
goodJet->setEMF(0.2);
|
113 |
goodJet->setFHPD(0.5);
|
114 |
goodJet->setN90Hits(2);
|
115 |
}
|
116 |
|
117 |
void setUpGoodBJet() {
|
118 |
goodBJet->setEMF(0.2);
|
119 |
goodBJet->setFHPD(0.5);
|
120 |
goodBJet->setN90Hits(2);
|
121 |
goodBJet->setDiscriminatorForBtagType(2.5, BtagAlgorithm::SimpleSecondaryVertexHighEffBTag);
|
122 |
}
|
123 |
|
124 |
void setUpGoodJetCloseToElectron() {
|
125 |
goodJetCloseToElectron->setEMF(0.2);
|
126 |
goodJetCloseToElectron->setFHPD(0.5);
|
127 |
goodJetCloseToElectron->setN90Hits(2);
|
128 |
}
|
129 |
|
130 |
|
131 |
void setUpIsolatedGoodMuon() {
|
132 |
goodIsolatedMuon->makeGlobal(true);
|
133 |
goodIsolatedMuon->setEcalIsolation(1);
|
134 |
goodIsolatedMuon->setHcalIsolation(1);
|
135 |
goodIsolatedMuon->setTrackerIsolation(1);
|
136 |
}
|
137 |
|
138 |
void setUpBadMuon() {
|
139 |
badMuon->makeGlobal(false);
|
140 |
}
|
141 |
|
142 |
void setUpTTbarEvent() {
|
143 |
VertexCollection vertices;
|
144 |
vertices.push_back(goodVertex);
|
145 |
ttbarEvent.setVertices(vertices);
|
146 |
ElectronCollection electrons;
|
147 |
electrons.push_back(goodIsolatedElectron);
|
148 |
electrons.push_back(badElectron);
|
149 |
ttbarEvent.setElectrons(electrons);
|
150 |
JetCollection jets;
|
151 |
jets.push_back(goodJet);
|
152 |
jets.push_back(goodJet);
|
153 |
jets.push_back(goodBJet);
|
154 |
jets.push_back(goodBJet);
|
155 |
jets.push_back(badJet);
|
156 |
ttbarEvent.setJets(jets);
|
157 |
|
158 |
MuonCollection muons;
|
159 |
muons.push_back(badMuon);
|
160 |
ttbarEvent.setMuons(muons);
|
161 |
ttbarEvent.setMET(met);
|
162 |
ttbarEvent.setDataType(DataType::ttbar);
|
163 |
ttbarEvent.setTracks(moreThan10TracksHighPurity);
|
164 |
ttbarEvent.setBeamScrapingVeto(false);
|
165 |
assert(ttbarEvent.passesScrapingFilter());
|
166 |
assert(ttbarEvent.passesHighLevelTrigger());
|
167 |
assert(ttbarEvent.hasOneGoodPrimaryVertex());
|
168 |
assert(ttbarEvent.hasOnlyOneGoodIsolatedElectron());
|
169 |
assert(ttbarEvent.hasAtLeastFourGoodJets());
|
170 |
assert(ttbarEvent.isolatedElectronDoesNotComeFromConversion());
|
171 |
assert(ttbarEvent.isolatedElectronNotTaggedAsFromConversion());
|
172 |
}
|
173 |
|
174 |
void setUpGoodZEvent() {
|
175 |
VertexCollection vertices;
|
176 |
vertices.push_back(goodVertex);
|
177 |
goodZEvent.setVertices(vertices);
|
178 |
ElectronCollection electrons;
|
179 |
electrons.push_back(goodIsolatedElectron);
|
180 |
electrons.push_back(goodIsolatedElectron2);
|
181 |
electrons.push_back(badElectron);
|
182 |
goodZEvent.setElectrons(electrons);
|
183 |
|
184 |
JetCollection jets;
|
185 |
jets.push_back(goodJet);
|
186 |
jets.push_back(goodJet);
|
187 |
jets.push_back(goodJet);
|
188 |
jets.push_back(goodBJet);
|
189 |
goodZEvent.setJets(jets);
|
190 |
// goodZEvent.setHLT_Emulated_Photon15(true);
|
191 |
|
192 |
goodZEvent.setDataType(DataType::Zjets);
|
193 |
goodZEvent.setBeamScrapingVeto(false);
|
194 |
}
|
195 |
|
196 |
void setUpPoorZEvent() {
|
197 |
VertexCollection vertices;
|
198 |
vertices.push_back(goodVertex);
|
199 |
poorZEvent.setVertices(vertices);
|
200 |
ElectronCollection electrons;
|
201 |
electrons.push_back(goodIsolatedElectron);
|
202 |
electrons.push_back(goodLooseElectron);
|
203 |
electrons.push_back(badElectron);
|
204 |
poorZEvent.setElectrons(electrons);
|
205 |
|
206 |
JetCollection jets;
|
207 |
jets.push_back(goodJet);
|
208 |
jets.push_back(goodJet);
|
209 |
jets.push_back(goodJet);
|
210 |
jets.push_back(goodBJet);
|
211 |
poorZEvent.setJets(jets);
|
212 |
// poorZEvent.setHLT_Emulated_Photon15(true);
|
213 |
|
214 |
poorZEvent.setDataType(DataType::Zjets);
|
215 |
poorZEvent.setBeamScrapingVeto(false);
|
216 |
}
|
217 |
|
218 |
void setUpDiJetEvent() {
|
219 |
VertexCollection vertices;
|
220 |
vertices.push_back(badVertex);
|
221 |
DiJetEvent.setVertices(vertices);
|
222 |
JetCollection jets;
|
223 |
jets.push_back(goodJet);
|
224 |
jets.push_back(goodJet);
|
225 |
DiJetEvent.setJets(jets);
|
226 |
// DiJetEvent.setHLT_Emulated_Photon15(false);
|
227 |
|
228 |
DiJetEvent.setDataType(DataType::QCD_BCtoE_Pt80to170);
|
229 |
DiJetEvent.setBeamScrapingVeto(false);
|
230 |
}
|
231 |
|
232 |
void setUpDiJetEventWithConversion() {
|
233 |
VertexCollection vertices;
|
234 |
vertices.push_back(goodVertex);
|
235 |
DiJetEventWithConversion.setVertices(vertices);
|
236 |
JetCollection jets;
|
237 |
jets.push_back(goodJet);
|
238 |
jets.push_back(goodJet);
|
239 |
DiJetEventWithConversion.setJets(jets);
|
240 |
// DiJetEventWithConversion.setHLT_Emulated_Photon15(false);
|
241 |
|
242 |
ElectronCollection electrons;
|
243 |
electrons.push_back(electronFromConversion);
|
244 |
DiJetEventWithConversion.setElectrons(electrons);
|
245 |
DiJetEventWithConversion.setDataType(DataType::QCD_EMEnriched_Pt20to30);
|
246 |
DiJetEventWithConversion.setBeamScrapingVeto(false);
|
247 |
}
|
248 |
|
249 |
void setUpMuonEvent() {
|
250 |
VertexCollection vertices;
|
251 |
vertices.push_back(goodVertex);
|
252 |
muonEvent.setVertices(vertices);
|
253 |
ElectronCollection electrons;
|
254 |
electrons.push_back(goodIsolatedElectron);
|
255 |
electrons.push_back(badElectron);
|
256 |
muonEvent.setElectrons(electrons);
|
257 |
JetCollection jets;
|
258 |
jets.push_back(goodJet);
|
259 |
jets.push_back(goodJet);
|
260 |
jets.push_back(goodBJet);
|
261 |
jets.push_back(goodBJet);
|
262 |
jets.push_back(badJet);
|
263 |
muonEvent.setJets(jets);
|
264 |
// muonEvent.setHLT_Emulated_Photon15(true);
|
265 |
|
266 |
MuonCollection muons;
|
267 |
muons.push_back(goodIsolatedMuon);
|
268 |
muonEvent.setMuons(muons);
|
269 |
muonEvent.setDataType(DataType::Zjets);
|
270 |
}
|
271 |
|
272 |
void setUpTracks() {
|
273 |
TrackPointer trackHighPurity = TrackPointer(new Track(1., 0., 20., 6.));
|
274 |
TrackPointer trackLowPurity = TrackPointer(new Track(1., 0., 20., 6.));
|
275 |
trackHighPurity->setHighPurity(true);
|
276 |
trackLowPurity->setHighPurity(false);
|
277 |
for (unsigned int index = 0; index < 20; ++index) {
|
278 |
if (index < 8)
|
279 |
lessThan10Tracks.push_back(trackHighPurity);
|
280 |
if (index < 2) {
|
281 |
moreThan10TracksMixedPurity_H.push_back(trackLowPurity);
|
282 |
moreThan10TracksMixedPurity_L.push_back(trackHighPurity);
|
283 |
} else {
|
284 |
moreThan10TracksMixedPurity_H.push_back(trackHighPurity);
|
285 |
moreThan10TracksMixedPurity_L.push_back(trackLowPurity);
|
286 |
}
|
287 |
|
288 |
moreThan10TracksHighPurity.push_back(trackHighPurity);
|
289 |
moreThan10TracksLowPurity.push_back(trackLowPurity);
|
290 |
}
|
291 |
}
|
292 |
|
293 |
void setUpCustomEvent() {
|
294 |
customEvent.useCustomReturnValues = true;
|
295 |
customEvent.passConversion = false;
|
296 |
customEvent.passElectronCut = true;
|
297 |
customEvent.passHLT = true;
|
298 |
customEvent.passPV = true;
|
299 |
customEvent.passScraping = true;
|
300 |
customEvent.passes1JetCut = true;
|
301 |
customEvent.passes2JetCut = true;
|
302 |
customEvent.passes3JetCut = true;
|
303 |
customEvent.passes4JetCut = true;
|
304 |
customEvent.passesMuon = true;
|
305 |
customEvent.passesZveto = true;
|
306 |
customEvent.passConversionPartnerTrack = true;
|
307 |
assert(customEvent.passesScrapingFilter());
|
308 |
assert(customEvent.passesSelectionStep(TTbarEPlusJetsSelection::FilterOutScraping));
|
309 |
assert(customEvent.passesHighLevelTrigger());
|
310 |
assert(customEvent.passesSelectionStep(TTbarEPlusJetsSelection::HighLevelTrigger));
|
311 |
assert(customEvent.isolatedElectronDoesNotComeFromConversion() == false);
|
312 |
assert(customEvent.isolatedElectronNotTaggedAsFromConversion());
|
313 |
assert(customEvent.hasOneGoodPrimaryVertex());
|
314 |
assert(customEvent.hasOnlyOneGoodIsolatedElectron());
|
315 |
assert(customEvent.hasNoIsolatedMuon());
|
316 |
assert(customEvent.hasAtLeastOneGoodJet());
|
317 |
assert(customEvent.hasAtLeastTwoGoodJets());
|
318 |
assert(customEvent.hasAtLeastThreeGoodJets());
|
319 |
assert(customEvent.hasAtLeastFourGoodJets());
|
320 |
assert(customEvent.isNotAZBosonEvent());
|
321 |
|
322 |
assert(customEvent.useCustomReturnValues);
|
323 |
}
|
324 |
|
325 |
public:
|
326 |
void testEventConstructor() {
|
327 |
TopPairEventCandidate candidate = TopPairEventCandidate(ttbarEvent);
|
328 |
ASSERT_EQUAL(2, candidate.Electrons().size());
|
329 |
ASSERT_EQUAL(1, candidate.GoodIsolatedElectrons().size());
|
330 |
ASSERT_EQUAL(5, candidate.Jets().size());
|
331 |
ASSERT_EQUAL(4, candidate.GoodJets().size());
|
332 |
}
|
333 |
|
334 |
void testPassesHLT() {
|
335 |
ASSERT(ttbarEvent.passesHighLevelTrigger());
|
336 |
}
|
337 |
|
338 |
// void testDoesNotPassHLT() {
|
339 |
// DiJetEvent.setDataType(DataType::DATA);
|
340 |
// ASSERT_EQUAL(false, DiJetEvent.passesHighLevelTrigger());
|
341 |
// }
|
342 |
|
343 |
void testDoesHaveGoodPV() {
|
344 |
ASSERT(ttbarEvent.hasOneGoodPrimaryVertex());
|
345 |
}
|
346 |
|
347 |
void testDoesntHaveGoodPV() {
|
348 |
ASSERT(DiJetEvent.hasOneGoodPrimaryVertex() == false);
|
349 |
}
|
350 |
|
351 |
void testHasOnlyOneGoodIsolatedElectron() {
|
352 |
ASSERT(ttbarEvent.hasOnlyOneGoodIsolatedElectron());
|
353 |
}
|
354 |
|
355 |
void testHasNotOnlyOneGoodIsolatedElectron() {
|
356 |
ASSERT(goodZEvent.hasOnlyOneGoodIsolatedElectron() == false);
|
357 |
ASSERT(DiJetEvent.hasOnlyOneGoodIsolatedElectron() == false);
|
358 |
}
|
359 |
|
360 |
void testIsolatedElectronNotFromConversion() {
|
361 |
ASSERT(ttbarEvent.isolatedElectronDoesNotComeFromConversion());
|
362 |
}
|
363 |
|
364 |
void testIsolatedElectronFromConversion() {
|
365 |
ASSERT(DiJetEventWithConversion.isolatedElectronDoesNotComeFromConversion() == false);
|
366 |
}
|
367 |
|
368 |
void testNoElectronInEventReturnsFalse() {
|
369 |
ASSERT(DiJetEvent.isolatedElectronDoesNotComeFromConversion() == false);
|
370 |
}
|
371 |
|
372 |
void testHasAtLeastOneGoodJet() {
|
373 |
ASSERT(ttbarEvent.hasAtLeastOneGoodJet());
|
374 |
}
|
375 |
|
376 |
void testHasNoGoodJets() {
|
377 |
ASSERT(emptyEvent.hasAtLeastOneGoodJet() == false);
|
378 |
}
|
379 |
|
380 |
void testHasAtLeastTwoGoodjet() {
|
381 |
ASSERT(ttbarEvent.hasAtLeastTwoGoodJets());
|
382 |
}
|
383 |
|
384 |
void testHasNoTwoGoodJets() {
|
385 |
ASSERT(emptyEvent.hasAtLeastTwoGoodJets() == false);
|
386 |
}
|
387 |
|
388 |
void testHasAtLeastThreeGoodJets() {
|
389 |
ASSERT(ttbarEvent.hasAtLeastThreeGoodJets());
|
390 |
}
|
391 |
|
392 |
void testHasNoThreeGoodJets() {
|
393 |
ASSERT(DiJetEvent.hasAtLeastThreeGoodJets() == false);
|
394 |
}
|
395 |
|
396 |
void testHasAtFourThreeGoodJets() {
|
397 |
ASSERT(ttbarEvent.hasAtLeastThreeGoodJets());
|
398 |
}
|
399 |
|
400 |
void testHasNoFourThreeGoodJets() {
|
401 |
ASSERT(DiJetEvent.hasAtLeastThreeGoodJets() == false);
|
402 |
}
|
403 |
|
404 |
void testTTbarIsNotAZBosonEvent() {
|
405 |
ASSERT(ttbarEvent.isNotAZBosonEvent());
|
406 |
}
|
407 |
|
408 |
void testGoodZIsAZBosonEvent() {
|
409 |
ASSERT_EQUAL(false, goodZEvent.isNotAZBosonEvent());
|
410 |
}
|
411 |
|
412 |
void testPoorZIsAZBosonEvent() {
|
413 |
ASSERT_EQUAL(false, poorZEvent.isNotAZBosonEvent());
|
414 |
}
|
415 |
|
416 |
void testDiJetIsNotAZBosonEvent() {
|
417 |
ASSERT_EQUAL(true, DiJetEvent.isNotAZBosonEvent());
|
418 |
}
|
419 |
|
420 |
void testTTbarEventPassesMuonVeto() {
|
421 |
ASSERT_EQUAL(true, ttbarEvent.hasNoIsolatedMuon());
|
422 |
}
|
423 |
|
424 |
void testMuonEventDoesnPassMuonVeto() {
|
425 |
ASSERT_EQUAL(false, muonEvent.hasNoIsolatedMuon());
|
426 |
}
|
427 |
|
428 |
void testEventPasses0Step() {
|
429 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::FilterOutScraping));
|
430 |
}
|
431 |
|
432 |
void testEventPasses0StepWithLowNumberOfTracks() {
|
433 |
ttbarEvent.setTracks(lessThan10Tracks);
|
434 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::FilterOutScraping));
|
435 |
}
|
436 |
|
437 |
void testEventPasses0StepWithMixedTracks_H() {
|
438 |
ttbarEvent.setTracks(moreThan10TracksMixedPurity_H);
|
439 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::FilterOutScraping));
|
440 |
}
|
441 |
|
442 |
void testEventPasses0StepWithMixedTracks_L() {
|
443 |
ttbarEvent.setTracks(moreThan10TracksMixedPurity_L);
|
444 |
ASSERT_EQUAL(false, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::FilterOutScraping));
|
445 |
}
|
446 |
|
447 |
void testEventFails0StepWithLowPurityTracks() {
|
448 |
ttbarEvent.setTracks(moreThan10TracksLowPurity);
|
449 |
ASSERT_EQUAL(false, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::FilterOutScraping));
|
450 |
}
|
451 |
|
452 |
void testEventPasses1stStep() {
|
453 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::HighLevelTrigger));
|
454 |
}
|
455 |
|
456 |
void testEventPasses2ndStep() {
|
457 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::GoodPrimaryvertex));
|
458 |
}
|
459 |
|
460 |
void testEventPasses3ndStep() {
|
461 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::OneIsolatedElectron));
|
462 |
}
|
463 |
|
464 |
void testEventPasses4thStep() {
|
465 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::ConversionRejection));
|
466 |
}
|
467 |
|
468 |
void testEventPasses5thStep() {
|
469 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::LooseMuonVeto));
|
470 |
}
|
471 |
|
472 |
void testEventPasses6thStep() {
|
473 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::AtLeastFourGoodJets));
|
474 |
}
|
475 |
|
476 |
void testEventPasses7thStep() {
|
477 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStep(TTbarEPlusJetsSelection::Zveto));
|
478 |
}
|
479 |
|
480 |
void testTTbarEventPassesNStep() {
|
481 |
ASSERT_EQUAL(true, ttbarEvent.passesSelectionStepUpTo(TTbarEPlusJetsSelection::Zveto));
|
482 |
}
|
483 |
|
484 |
void testPoorZEventPassesUpToStep() {
|
485 |
assert(poorZEvent.passesScrapingFilter());
|
486 |
assert(poorZEvent.passesHighLevelTrigger());
|
487 |
assert(poorZEvent.hasOneGoodPrimaryVertex());
|
488 |
cout << poorZEvent.GoodElectrons().size() << endl;
|
489 |
cout << poorZEvent.GoodIsolatedElectrons().size() << endl;
|
490 |
assert(poorZEvent.hasOnlyOneGoodIsolatedElectron());
|
491 |
assert(poorZEvent.isolatedElectronDoesNotComeFromConversion());
|
492 |
ASSERT_EQUAL(true, poorZEvent.passesSelectionStepUpTo(TTbarEPlusJetsSelection::LooseMuonVeto));
|
493 |
}
|
494 |
|
495 |
void testPoorZEventDoesntPassUpToStep() {
|
496 |
ASSERT_EQUAL(false, poorZEvent.passesSelectionStepUpTo(TTbarEPlusJetsSelection::Zveto));
|
497 |
}
|
498 |
|
499 |
void testPassesFullTTbarSelection() {
|
500 |
ASSERT_EQUAL(true, ttbarEvent.passesFullTTbarEPlusJetSelection());
|
501 |
}
|
502 |
|
503 |
void testFailsFullTTbarSelection() {
|
504 |
ASSERT_EQUAL(false, DiJetEvent.passesFullTTbarEPlusJetSelection());
|
505 |
}
|
506 |
|
507 |
void testComputeNeutrinoPzsWithoutMETThrowsExpeption() {
|
508 |
TopPairEventCandidate cand = TopPairEventCandidate();
|
509 |
VertexCollection vertices;
|
510 |
vertices.push_back(goodVertex);
|
511 |
cand.setVertices(vertices);
|
512 |
ElectronPointer electron(new Electron(40, -40, 0, 0));
|
513 |
electron->setHcalIsolation(0);
|
514 |
electron->setEcalIsolation(0);
|
515 |
electron->setTrackerIsolation(0);
|
516 |
electron->setNumberOfMissingInnerLayerHits(0);
|
517 |
ElectronCollection eCollection;
|
518 |
eCollection.push_back(electron);
|
519 |
cand.setElectrons(eCollection);
|
520 |
ASSERT_THROWS(cand.computeNeutrinoPz(),ReconstructionException);
|
521 |
}
|
522 |
|
523 |
void testComputeNeutrinoPzsIsolatedElectronThrowsExpeption() {
|
524 |
TopPairEventCandidate cand = TopPairEventCandidate();
|
525 |
VertexCollection vertices;
|
526 |
vertices.push_back(goodVertex);
|
527 |
cand.setVertices(vertices);
|
528 |
ElectronPointer electron(new Electron(40, -40, 0, 0));
|
529 |
electron->setHcalIsolation(50);
|
530 |
electron->setEcalIsolation(50);
|
531 |
electron->setTrackerIsolation(50);
|
532 |
electron->setNumberOfMissingInnerLayerHits(0);
|
533 |
ElectronCollection eCollection;
|
534 |
eCollection.push_back(electron);
|
535 |
cand.setElectrons(eCollection);
|
536 |
ASSERT_THROWS(cand.computeNeutrinoPz(),ReconstructionException);
|
537 |
}
|
538 |
|
539 |
void testComputeNeutrinoPzs() {
|
540 |
METPointer met(new MET(40, 0));
|
541 |
ElectronPointer electron(new Electron(40, -40, 0, 0));
|
542 |
electron->setHcalIsolation(0);
|
543 |
electron->setEcalIsolation(0);
|
544 |
electron->setTrackerIsolation(0);
|
545 |
electron->setNumberOfMissingInnerLayerHits(0);
|
546 |
electron->setD0_wrtBeamSpot(0);
|
547 |
electron->setSuperClusterEta(0);
|
548 |
electron->setDEtaIn(0);
|
549 |
electron->setDPhiIn(0);
|
550 |
electron->setSigmaIEtaIEta(0);
|
551 |
electron->setHadOverEm(0);
|
552 |
|
553 |
DummyTTbarEvent cand = DummyTTbarEvent();
|
554 |
cand.setMET(met);
|
555 |
cand.setElectronFromW(electron);
|
556 |
ASSERT_EQUAL(sqrt(80*80-80.389*80.389), cand.computeNeutrinoPz().at(0));
|
557 |
ASSERT_EQUAL(sqrt(80*80-80.389*80.389), cand.computeNeutrinoPz().at(1));
|
558 |
}
|
559 |
|
560 |
void testReconstructTopEventUsingChiWithNotEnoughJetsThrowsException() {
|
561 |
METPointer met(new MET(40, 0));
|
562 |
ElectronCollection eCollection;
|
563 |
eCollection.push_back(goodIsolatedElectron);
|
564 |
TopPairEventCandidate cand = TopPairEventCandidate();
|
565 |
VertexCollection vertices;
|
566 |
vertices.push_back(goodVertex);
|
567 |
cand.setVertices(vertices);
|
568 |
cand.setMET(met);
|
569 |
cand.setElectrons(eCollection);
|
570 |
ASSERT_THROWS(cand.reconstructTTbar(goodIsolatedElectron),ReconstructionException);
|
571 |
}
|
572 |
|
573 |
void testNMinus1CutsPositive() {
|
574 |
ASSERT_EQUAL(true, customEvent.passesNMinus1(TTbarEPlusJetsSelection::ConversionRejection));
|
575 |
}
|
576 |
|
577 |
void testNMinus1CutsNegative() {
|
578 |
ASSERT_EQUAL(false, customEvent.passesNMinus1(TTbarEPlusJetsSelection::HighLevelTrigger));
|
579 |
}
|
580 |
};
|
581 |
|
582 |
extern cute::suite make_suite_TestTopPairEventCandidate() {
|
583 |
cute::suite s;
|
584 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testNMinus1CutsPositive));
|
585 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testNMinus1CutsNegative));
|
586 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventConstructor));
|
587 |
|
588 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testPassesHLT));
|
589 |
// s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testDoesNotPassHLT));
|
590 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testDoesHaveGoodPV));
|
591 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testDoesntHaveGoodPV));
|
592 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testHasOnlyOneGoodIsolatedElectron));
|
593 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testHasNotOnlyOneGoodIsolatedElectron));
|
594 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testIsolatedElectronNotFromConversion));
|
595 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testIsolatedElectronFromConversion));
|
596 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testNoElectronInEventReturnsFalse));
|
597 |
|
598 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testHasAtLeastOneGoodJet));
|
599 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testHasNoGoodJets));
|
600 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testHasAtLeastTwoGoodjet));
|
601 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testHasNoTwoGoodJets));
|
602 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testHasAtLeastThreeGoodJets));
|
603 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testHasNoThreeGoodJets));
|
604 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testHasAtFourThreeGoodJets));
|
605 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testHasNoFourThreeGoodJets));
|
606 |
|
607 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testTTbarIsNotAZBosonEvent));
|
608 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testGoodZIsAZBosonEvent));
|
609 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testPoorZIsAZBosonEvent));
|
610 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testDiJetIsNotAZBosonEvent));
|
611 |
|
612 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testTTbarEventPassesMuonVeto));
|
613 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testMuonEventDoesnPassMuonVeto));
|
614 |
|
615 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses0Step));
|
616 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses0StepWithLowNumberOfTracks));
|
617 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventFails0StepWithLowPurityTracks));
|
618 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses0StepWithMixedTracks_H));
|
619 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses0StepWithMixedTracks_L));
|
620 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses1stStep));
|
621 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses2ndStep));
|
622 |
// s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses2ndStepInRealData));
|
623 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses3ndStep));
|
624 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses4thStep));
|
625 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses5thStep));
|
626 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses6thStep));
|
627 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testEventPasses7thStep));
|
628 |
|
629 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testTTbarEventPassesNStep));
|
630 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testPoorZEventPassesUpToStep));
|
631 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testPoorZEventDoesntPassUpToStep));
|
632 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testPassesFullTTbarSelection));
|
633 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testFailsFullTTbarSelection));
|
634 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testComputeNeutrinoPzsWithoutMETThrowsExpeption));
|
635 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testComputeNeutrinoPzsIsolatedElectronThrowsExpeption));
|
636 |
s.push_back(CUTE_SMEMFUN(TestTopPairEventCandidate, testComputeNeutrinoPzs));
|
637 |
s.push_back(
|
638 |
CUTE_SMEMFUN(TestTopPairEventCandidate, testReconstructTopEventUsingChiWithNotEnoughJetsThrowsException));
|
639 |
|
640 |
return s;
|
641 |
}
|