39 event.selectedTaus = []
41 event.inclusiveTaus = []
44 alltaus =
map( Tau, self.handles[
'taus'].product() )
48 tau.associatedVertex = event.goodVertices[0]
if len(event.goodVertices)>0
else event.vertices[0]
50 tau.idDecayMode = tau.tauID(
"decayModeFinding")
51 tau.idDecayModeNewDMs = tau.tauID(
"decayModeFindingNewDMs")
52 if hasattr(self.cfg_ana,
'decayModeID')
and self.cfg_ana.decayModeID
and not tau.tauID(self.cfg_ana.decayModeID):
55 if self.cfg_ana.vetoLeptons:
56 for lep
in event.selectedLeptons:
57 if deltaR(lep.eta(), lep.phi(), tau.eta(), tau.phi()) < self.cfg_ana.leptonVetoDR:
59 if tau.lepVeto:
continue
60 if self.cfg_ana.vetoLeptonsPOG:
61 if not tau.tauID(self.cfg_ana.tauAntiMuonID):
63 if not tau.tauID(self.cfg_ana.tauAntiElectronID):
65 if tau.lepVeto:
continue
67 if tau.pt() < self.cfg_ana.ptMin:
continue
68 if abs(tau.eta()) > self.cfg_ana.etaMax:
continue
69 if abs(tau.dxy()) > self.cfg_ana.dxyMax
or abs(tau.dz()) > self.cfg_ana.dzMax:
continue
73 """Create an integer equal to 1-2-3 for (loose,medium,tight)"""
74 return tau.tauID(X%
"Loose") + tau.tauID(X%
"Medium") + tau.tauID(X%
"Tight")
76 """Create an integer equal to 1-2-3-4-5 for (very loose,
77 loose, medium, tight, very tight)"""
78 return id3(tau, X) + tau.tauID(X%
"VLoose") + tau.tauID(X%
"VTight")
80 """Create an integer equal to 1-2-3-4-5-6 for (very loose,
81 loose, medium, tight, very tight, very very tight)"""
82 return id5(tau, X) + tau.tauID(X%
"VVTight")
84 tau.idMVA = id6(tau,
"by%sIsolationMVA3oldDMwLT")
85 tau.idMVANewDM = id6(tau,
"by%sIsolationMVA3newDMwLT")
86 tau.idCI3hit = id3(tau,
"by%sCombinedIsolationDeltaBetaCorr3Hits")
87 tau.idAntiMu = tau.tauID(
"againstMuonLoose") + tau.tauID(
"againstMuonTight")
88 tau.idAntiE = id5(tau,
"againstElectron%sMVA5")
90 if tau.tauID(self.cfg_ana.tauID):
91 event.selectedTaus.append(tau)
92 event.inclusiveTaus.append(tau)
93 elif tau.tauID(self.cfg_ana.tauLooseID):
94 event.looseTaus.append(tau)
95 event.inclusiveTaus.append(tau)
97 event.selectedTaus.sort(key =
lambda l : l.pt(), reverse =
True)
98 event.looseTaus.sort(key =
lambda l : l.pt(), reverse =
True)
99 self.counters.counter(
'events').inc(
'all events')
100 if foundTau: self.counters.counter(
'events').inc(
'has >=1 tau at preselection')
101 if len(event.selectedTaus): self.counters.counter(
'events').inc(
'has >=1 selected taus')
102 if len(event.looseTaus): self.counters.counter(
'events').inc(
'has >=1 loose taus')
103 if len(event.inclusiveTaus): self.counters.counter(
'events').inc(
'has >=1 inclusive taus')