ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/dhidas/OSUAnalysis/Tools/interface/ToplikeCandidate.h
Revision: 1.1.1.1 (vendor branch)
Committed: Thu Dec 1 16:28:48 2011 UTC (13 years, 5 months ago) by dhidas
Content type: text/plain
Branch: dhidas
CVS Tags: START
Changes since 1.1: +0 -0 lines
Log Message:
osu copy modified

File Contents

# Content
1 #ifndef TOPLIKECANDIDATE_H_
2 #define TOPLIKECANDIDATE_H_
3
4
5 #include <map>
6
7 #include "RecoObjects/MCParticle.h"
8 #include "TopPairEventCandidate.h"
9
10 // using namespace BAT;
11 using namespace std;
12
13 namespace BAT {
14
15
16 namespace ToplikeSelectionSteps { // Note the name space!
17 enum Step { // Any new constant must be added to selStepArr below.
18 // Note this order not important. See selection arrays below.
19 FilterOutScraping,
20 GoodPrimaryvertex,
21 HighLevelTrigger,
22 OneIsolatedElectron,
23 OneIsolatedMuon,
24 LooseMuonVeto,
25 LooseElectronVeto,
26 TightMuonVeto,
27 TightElectronVeto,
28 ConversionRejection,
29 ConversionFinder,
30 MissingTransverseEnergy,
31 HT700GeV,
32 AtLeastOneGoodJet,
33 AtLeastTwoGoodJets,
34 AtLeastThreeGoodJets,
35 AtLeastFourGoodJets,
36 AtLeastFiveGoodJets,
37 FortyfiveGeVElectron,
38 AtLeastOneBtag,
39 AtLeastTwoBtags
40 };
41
42 const std::string StringSteps[] = {
43 "Scraping Filter",
44 "Good primary vertex",
45 "High Level Trigger",
46 "Exactly one isolated electron",
47 "Exactly one isolated muon",
48 "Loose muon veto",
49 "Loose electron veto",
50 "Tight muon veto",
51 "Tight electron veto",
52 "Conversion veto (missing hits)",
53 "Conversion finder (partner track)",
54 "MpT $>$ 20 GeV",
55 "HT (sum pT) $>$ 700 GeV",
56 "$>=$ 1 jets $>$180 GeV",
57 "$>=$ 2 jets $>$90 GeV",
58 "$>=$ 3 jets",
59 "$>=$ 4 jets",
60 "$>=$ 5 jets",
61 "$>$45 GeV electron pT",
62 "$>=$1 SSV b-tag",
63 "$>=$2 SSV b-tags"
64 };
65 }
66
67 typedef struct {
68 ToplikeSelectionSteps::Step key;
69 TTbarEPlusJetsSelection::Step value;
70 } selPair;
71
72 const selPair selStepArr[] = {
73 {ToplikeSelectionSteps::FilterOutScraping, TTbarEPlusJetsSelection::FilterOutScraping},
74 {ToplikeSelectionSteps::HighLevelTrigger, TTbarEPlusJetsSelection::HighLevelTrigger},
75 {ToplikeSelectionSteps::GoodPrimaryvertex, TTbarEPlusJetsSelection::GoodPrimaryvertex},
76 {ToplikeSelectionSteps::OneIsolatedElectron, TTbarEPlusJetsSelection::OneIsolatedElectron},
77 {ToplikeSelectionSteps::LooseMuonVeto, TTbarEPlusJetsSelection::LooseMuonVeto},
78 {ToplikeSelectionSteps::ConversionRejection, TTbarEPlusJetsSelection::ConversionRejection},
79 {ToplikeSelectionSteps::ConversionFinder, TTbarEPlusJetsSelection::ConversionFinder},
80 {ToplikeSelectionSteps::AtLeastOneGoodJet, TTbarEPlusJetsSelection::AtLeastOneGoodJets},
81 {ToplikeSelectionSteps::AtLeastTwoGoodJets, TTbarEPlusJetsSelection::AtLeastTwoGoodJets},
82 {ToplikeSelectionSteps::AtLeastThreeGoodJets, TTbarEPlusJetsSelection::AtLeastThreeGoodJets},
83 {ToplikeSelectionSteps::AtLeastFourGoodJets, TTbarEPlusJetsSelection::AtLeastFourGoodJets},
84 {ToplikeSelectionSteps::AtLeastOneBtag, TTbarEPlusJetsSelection::AtLeastOneBtag},
85 {ToplikeSelectionSteps::AtLeastTwoBtags, TTbarEPlusJetsSelection::AtLeastTwoBtags},
86 {ToplikeSelectionSteps::MissingTransverseEnergy, TTbarEPlusJetsSelection::MissingTransverseEnergy}
87 };
88
89
90 const ToplikeSelectionSteps::Step toplikeElectronSelection[] = {
91 ToplikeSelectionSteps::HighLevelTrigger,
92 ToplikeSelectionSteps::OneIsolatedElectron,
93 ToplikeSelectionSteps::TightMuonVeto,
94 ToplikeSelectionSteps::ConversionRejection,
95 ToplikeSelectionSteps::ConversionFinder,
96 ToplikeSelectionSteps::MissingTransverseEnergy,
97 ToplikeSelectionSteps::HT700GeV,
98 ToplikeSelectionSteps::AtLeastOneGoodJet,
99 ToplikeSelectionSteps::AtLeastTwoGoodJets,
100 ToplikeSelectionSteps::AtLeastOneBtag,
101 ToplikeSelectionSteps::AtLeastThreeGoodJets,
102 ToplikeSelectionSteps::AtLeastFourGoodJets,
103 ToplikeSelectionSteps::AtLeastFiveGoodJets
104 // ToplikeSelectionSteps::AtLeastTwoBtags
105 };
106
107 const unsigned int toplikeElectronSelSize =
108 sizeof(toplikeElectronSelection)/sizeof(ToplikeSelectionSteps::AtLeastOneGoodJet);
109
110 const ToplikeSelectionSteps::Step toplikeMuonSelection[] = {
111 ToplikeSelectionSteps::HighLevelTrigger,
112 ToplikeSelectionSteps::OneIsolatedMuon,
113 ToplikeSelectionSteps::TightElectronVeto,
114 ToplikeSelectionSteps::MissingTransverseEnergy,
115 ToplikeSelectionSteps::HT700GeV,
116 ToplikeSelectionSteps::AtLeastOneGoodJet,
117 ToplikeSelectionSteps::AtLeastTwoGoodJets,
118 ToplikeSelectionSteps::AtLeastOneBtag,
119 ToplikeSelectionSteps::AtLeastThreeGoodJets,
120 ToplikeSelectionSteps::AtLeastFourGoodJets,
121 ToplikeSelectionSteps::AtLeastFiveGoodJets
122 // ToplikeSelectionSteps::AtLeastTwoBtags
123 };
124
125 const unsigned int toplikeMuonSelSize =
126 sizeof(toplikeMuonSelection)/sizeof(ToplikeSelectionSteps::AtLeastOneGoodJet);
127
128
129 typedef struct {
130 float deltaR;
131 bool leptonic, hadronic;
132 } topTruth;
133
134 typedef struct {
135 float deltaR;
136 int gpInd;
137 MCParticlePointer ptr;
138 } mcObj;
139
140
141 typedef std::vector< mcObj > mcList;
142
143
144 class ToplikeCandidate : public TopPairEventCandidate {
145
146 protected:
147 // ElectronPointer electronFromW;
148 // JetPointer leptonicBJet, hadronicBJet, jet1FromW, jet2FromW;
149 JetPointer jet3FromW, jet4FromW;
150 ParticlePointer hadronicWtPrime, tPrime;
151 // ParticlePointer neutrino1, neutrino2, leptonicW1, leptonicW2, hadronicW,
152 // leptonicTop1, leptonicTop2, hadronicTop, ttbarResonance;
153 // unsigned short selectedNeutrino, currentSelectedNeutrino, hadronicBIndex,
154 // leptonicBIndex, jet1FromWIndex, jet2FromWIndex;
155 unsigned short jet3FromWIndex, jet4FromWIndex;
156 double ptTprimeSystem, htSystem;
157 bool doneReconstructiontop;
158 mcList getMCList(const Particle *const recoObject) const;
159 mcList getMCListForJets(const Jet *const recoObject) const;
160 bool chkBW(const int ind1, const int ind2, const int ind3) const;
161 bool chkIfChild(int gpInd, int motherGpInd) const;
162 int chkMCMatch(const Particle *const recoObject, int motherInd,
163 const int pdgId, int antiId = 0) const;
164 int chkForQuark(const JetPointer recoObject, const int motherInd,
165 const int badInd = -1) const;
166 int getNumMCMatchesForTop(const ParticlePointer &recoTop,
167 bool hadronic = true) const;
168 int getNumMCPermutsForTop(const ParticlePointer &recoTop,
169 bool hadronic = true) const;
170 // int lTopDauMatching(const mcObj &topTru) const;
171 // int hTopDauMatching(const mcObj &topTru) const;
172 int strictHTopMatching(const mcObj &topTru) const;
173 int strictLTopMatching(const mcObj &topTru) const;
174
175 public:
176 ToplikeCandidate();
177 ToplikeCandidate(const Event& event);
178 virtual ~ToplikeCandidate();
179
180 virtual bool isTopReconstructed(void) const {
181 return doneReconstructiontop;
182 }
183
184 /*
185 const JetPointer getJet3FromHadronicW2() const;
186 const JetPointer getJet4FromHadronicW2() const;
187 const ParticlePointer getHadronicW2() const;
188 const ParticlePointer getTprimeResonance() const;
189 */
190
191 void recoTprimeUsingChi2(ElectronPointer electron);
192 virtual void recoBestSingleTop(LeptonPointer lepton);
193 double TPrimeHTSystem() const;
194 double PtTPrimeSystem() const;
195
196 // Overload the following
197 // virtual const ParticlePointer getResonance() const;
198 bool hasAtLeastFiveGoodJets() const;
199 double tpmass() const;
200 virtual double getGlobalChi2() const;
201 virtual double getLeptonicChi2(double topMass, double unused) const;
202 virtual double getHadronicChi2() const;
203 double getWChi2() const;
204 double sumPt() const;
205 double PtTtbarSystem() const;
206 double PtTtbarSystem(unsigned short neutrinoSolution) const;
207 virtual double getLoneHadChi2() const;
208 topTruth getMCMatches(const ParticlePointer &recoObject) const;
209 int getNumMCMatchesHTop() const;
210 int getNumMCMatchesLTop() const;
211 int getNumCorrectIDLTop() const;
212 int getNumCorrectIDHTop() const;
213 int goodLTopMatching() const;
214 int goodHTopMatching() const;
215 int getTausInJets() const;
216 int numTaus() const;
217 int missRecoJetsForGenJets() const;
218 int missGenJetsForRecoJets() const;
219 };
220
221
222 class TopNoMassConstraint : public ToplikeCandidate {
223 public:
224 TopNoMassConstraint();
225 TopNoMassConstraint(const Event& event);
226 virtual ~TopNoMassConstraint();
227
228 virtual double getLoneHadChi2() const;
229 virtual double getLepBAngle() const;
230 };
231
232
233 class TopPlusXCandidates : public ToplikeCandidate {
234 public:
235
236 static const JetPointer nulljet;
237
238 TopPlusXCandidates();
239 TopPlusXCandidates(const Event& event);
240 virtual ~TopPlusXCandidates();
241
242 virtual void recoBestLeptoTop(LeptonPointer lepton,
243 const JetPointer jet = nulljet, const JetPointer wJet1 = nulljet,
244 const JetPointer wJet2 = nulljet);
245 virtual void recoHadronicTop(LeptonPointer lepton,
246 const JetPointer jet = nulljet);
247 virtual void findDJet(const JetPointer topJet = nulljet);
248 virtual bool passesSelectionStep(enum
249 ToplikeSelectionSteps::Step step) const;
250 virtual bool passesSelectionStepUpTo(unsigned int step,
251 const ToplikeSelectionSteps::Step steps[]) const;
252 virtual bool passesFullEPlusJetSelection() const;
253 virtual bool passesFullEPlusJetSelectionKK() const;
254 virtual bool passesFullMuPlusJetSelection() const;
255 virtual bool passesMETCut() const;
256 virtual bool passesHTCut() const;
257 virtual bool passesExtraElectronCut() const;
258 virtual bool hasOnlyOneGoodIsolatedMuon() const;
259 virtual bool hasNoIsolatedElectron() const;
260 virtual bool hasNoGoodIsolatedElectron() const;
261 virtual bool hasNoGoodIsolatedMuon() const;
262 virtual bool hasAtLeastOneGoodJet() const;
263 virtual bool hasAtLeastTwoGoodJets() const;
264
265 virtual double jetsHTNoTop(unsigned int numJets = 3) const;
266 virtual double ST() const;
267 virtual double getTopMetAngle() const;
268 virtual JetPointer leadnontopjet() const;
269 virtual double mass2jets(unsigned int jet1, unsigned int jet2) const;
270 virtual double mass4jets() const;
271
272 // The templates below are no longer necessary because there is now a
273 // LeptonPointer, but they still work, so leave them as-is.
274
275 // Template functions must be defined here to be instantiated in other files.
276 template <class PartPtr> double transMass4j(const PartPtr leptonPtr) const {
277 double px = leptonPtr->px() + met->px();
278 double py = leptonPtr->py() + met->py();
279 double pz = 0.0;
280 double et = leptonPtr->et() + met->et();
281 for (unsigned short jetIndex = 0; jetIndex < 4 && jetIndex < goodJets.size(); ++jetIndex) {
282 px += goodJets.at(jetIndex)->px();
283 py += goodJets.at(jetIndex)->py();
284 et += goodJets.at(jetIndex)->et();
285 }
286 Particle mt(et, px, py, pz);
287 return (mt.mass());
288 }
289
290 template <class PartPtr> double transMass2j(const PartPtr leptonPtr) const {
291 double px = leptonPtr->px() + met->px();
292 double py = leptonPtr->py() + met->py();
293 double pz = 0.0;
294 double et = leptonPtr->et() + met->et();
295 if (goodBJets.size() > 0) {
296 px += goodBJets.front()->px();
297 py += goodBJets.front()->py();
298 et += goodBJets.front()->et();
299 }
300 for (unsigned short jetIndex = 0; jetIndex < 2 && jetIndex < goodJets.size(); ++jetIndex) {
301 if (goodBJets.size() <= 0 || goodJets.at(jetIndex) != goodBJets.front()) {
302 px += goodJets.at(jetIndex)->px();
303 py += goodJets.at(jetIndex)->py();
304 et += goodJets.at(jetIndex)->et();
305 jetIndex = 2; // Terminate loop.
306 }
307 }
308 Particle mt(et, px, py, pz);
309 return (mt.mass());
310 }
311
312
313 template <class PartPtr> const ParticlePointer transMasslm1b(const PartPtr leptonPtr) const {
314 double px = leptonPtr->px() + met->px();
315 double py = leptonPtr->py() + met->py();
316 double pz = 0.0;
317 double et = leptonPtr->et() + met->et();
318 if (goodBJets.size() > 0) {
319 px += goodBJets.front()->px();
320 py += goodBJets.front()->py();
321 et += goodBJets.front()->et();
322 }
323 return (ParticlePointer(new Particle(et, px, py, pz)));
324 }
325
326
327 template <class PartPtr> const ParticlePointer massl1b(const PartPtr leptonPtr) const {
328 double px = leptonPtr->px();
329 double py = leptonPtr->py();
330 double pz = 0.0;
331 double et = leptonPtr->et();
332 if (goodBJets.size() > 0) {
333 px += goodBJets.front()->px();
334 py += goodBJets.front()->py();
335 et += goodBJets.front()->et();
336 }
337 return (ParticlePointer(new Particle(et, px, py, pz)));
338 }
339
340
341 template <class PartPtr> double deltaPhiTops(const PartPtr leptonPtr) const {
342 double px = 0.0, py = 0.0, pz = 0.0, et = 0.0;
343 for (unsigned short jetIndex = 1; jetIndex < 4 && jetIndex < goodJets.size(); ++jetIndex) {
344 px += goodJets.at(jetIndex)->px();
345 py += goodJets.at(jetIndex)->py();
346 et += goodJets.at(jetIndex)->et();
347 }
348 ParticlePointer mt = ParticlePointer(new Particle(et, px, py, pz));
349 return (transMasslm1b(leptonPtr)->deltaPhi(mt));
350 }
351
352
353 template <class PartPtr> double deltaPhiLepJet(const PartPtr leptonPtr) const {
354 if (goodJets.size() > 0)
355 return (leptonPtr->deltaPhi(goodJets.front()));
356 return (0.0);
357 }
358
359
360 JetPointer dJetFromWp;
361 short dJetFromWpIndex;
362 };
363
364
365 class TwoNonResTops : public TopPlusXCandidates {
366 public:
367 TwoNonResTops();
368 TwoNonResTops(const Event& event);
369 virtual ~TwoNonResTops();
370
371 void recoNonResTops(LeptonPointer lepton);
372 void recoNonResTopsWdjet(LeptonPointer lepton);
373 void recoWpFrom1Top(LeptonPointer lepton);
374 virtual double getGlobalChi2() const;
375 virtual const JetPointer getLtNonTopJet() const;
376 virtual const ParticlePointer getWprime() const;
377 virtual const ParticlePointer getBtBWprime() const;
378 virtual const ParticlePointer getNegWprime() const;
379 virtual const ParticlePointer getNegWprimeBad() const;
380 virtual double getHadTopDAngle() const;
381 virtual void getTrueWpChain();
382 virtual MCParticlePointer getWpTru() const;
383 virtual MCParticlePointer getWpTopTru() const;
384 virtual MCParticlePointer getSpecTop() const;
385 virtual MCParticlePointer getWpTopBTru() const;
386 virtual MCParticlePointer getSpecTopB() const;
387 virtual MCParticlePointer getWpDDauTru() const;
388 virtual double getTotalChi2DJ(unsigned short neutrinoSolution) const;
389
390 template <class PartPtr> double deltaPhiLepDJet(const PartPtr leptonPtr) const {
391 if (goodJets.size() > 4)
392 return (leptonPtr->deltaPhi(getLtNonTopJet()));
393 return (0.0);
394 }
395
396 ParticlePointer wpFrom1Top, wpBadFrom1Top;
397
398 protected:
399 MCParticlePointer wpTru, wpTopTru, specTopTru, wpDDauTru;
400 MCParticlePointer wpTopBTru, specTopBTru;
401 bool wpGenParticlesSet;
402 ParticlePointer topFromWp;
403 };
404
405
406 class LeptoTopNoMassConstraint : public TopNoMassConstraint {
407 public:
408 LeptoTopNoMassConstraint();
409 LeptoTopNoMassConstraint(const Event& event);
410 virtual ~LeptoTopNoMassConstraint();
411
412 // virtual bool passesFullEPlusJetSelection() const;
413 virtual void inspectReconstructedEvent() const;
414
415 };
416
417 }
418
419 #endif /* TOPLIKECANDIDATE_H_ */