36 event.inclusiveTaus = []
37 event.selectedTaus = []
41 alltaus =
map( Tau, self.handles[
'taus'].product() )
45 tau.associatedVertex = event.goodVertices[0]
if len(event.goodVertices)>0
else event.vertices[0]
47 tau.idDecayMode = tau.tauID(
"decayModeFinding")
48 tau.idDecayModeNewDMs = tau.tauID(
"decayModeFindingNewDMs")
50 if hasattr(self.cfg_ana,
'inclusive_decayModeID')
and self.cfg_ana.inclusive_decayModeID
and not tau.tauID(self.cfg_ana.inclusive_decayModeID):
53 tau.inclusive_lepVeto =
False 54 if self.cfg_ana.inclusive_vetoLeptons:
55 for lep
in event.selectedLeptons:
56 if deltaR(lep.eta(), lep.phi(), tau.eta(), tau.phi()) < self.cfg_ana.inclusive_leptonVetoDR:
57 tau.inclusive_lepVeto =
True 58 if tau.inclusive_lepVeto:
continue 59 if self.cfg_ana.inclusive_vetoLeptonsPOG:
60 if not tau.tauID(self.cfg_ana.inclusive_tauAntiMuonID):
61 tau.inclusive_lepVeto =
True 62 if not tau.tauID(self.cfg_ana.inclusive_tauAntiElectronID):
63 tau.inclusive_lepVeto =
True 64 if tau.inclusive_lepVeto:
continue 66 if tau.pt() < self.cfg_ana.inclusive_ptMin:
continue 67 if abs(tau.eta()) > self.cfg_ana.inclusive_etaMax:
continue 68 if abs(tau.dxy()) > self.cfg_ana.inclusive_dxyMax
or abs(tau.dz()) > self.cfg_ana.inclusive_dzMax:
continue 71 """Create an integer equal to 1-2-3 for (loose,medium,tight)""" 72 return tau.tauID(X%
"Loose") + tau.tauID(X%
"Medium") + tau.tauID(X%
"Tight")
74 """Create an integer equal to 1-2-3-4-5 for (very loose, 75 loose, medium, tight, very tight)""" 76 return id3(tau, X) + tau.tauID(X%
"VLoose") + tau.tauID(X%
"VTight")
78 """Create an integer equal to 1-2-3-4-5-6 for (very loose, 79 loose, medium, tight, very tight, very very tight)""" 80 return id5(tau, X) + tau.tauID(X%
"VVTight")
82 tau.idMVA = id6(tau,
"by%sIsolationMVArun2v1DBoldDMwLT")
83 tau.idMVANewDM = id6(tau,
"by%sIsolationMVArun2v1DBnewDMwLT")
84 tau.idCI3hit = id3(tau,
"by%sCombinedIsolationDeltaBetaCorr3Hits")
85 tau.idAntiMu = tau.tauID(
"againstMuonLoose3") + tau.tauID(
"againstMuonTight3")
86 tau.idAntiE = id5(tau,
"againstElectron%sMVA6")
89 if tau.tauID(self.cfg_ana.inclusive_tauID):
90 event.inclusiveTaus.append(tau)
92 for tau
in event.inclusiveTaus:
94 tau.loose_lepVeto =
False 95 if self.cfg_ana.loose_vetoLeptons:
96 for lep
in event.selectedLeptons:
97 if deltaR(lep.eta(), lep.phi(), tau.eta(), tau.phi()) < self.cfg_ana.loose_leptonVetoDR:
98 tau.loose_lepVeto =
True 99 if self.cfg_ana.loose_vetoLeptonsPOG:
100 if not tau.tauID(self.cfg_ana.loose_tauAntiMuonID):
101 tau.loose_lepVeto =
True 102 if not tau.tauID(self.cfg_ana.loose_tauAntiElectronID):
103 tau.loose_lepVeto =
True 105 if tau.tauID(self.cfg_ana.loose_decayModeID)
and \
106 tau.pt() > self.cfg_ana.loose_ptMin
and abs(tau.eta()) < self.cfg_ana.loose_etaMax
and \
107 abs(tau.dxy()) < self.cfg_ana.loose_dxyMax
and abs(tau.dz()) < self.cfg_ana.loose_dzMax
and \
108 tau.tauID(self.cfg_ana.loose_tauID)
and not tau.loose_lepVeto:
109 event.selectedTaus.append(tau)
111 event.otherTaus.append(tau)
113 event.inclusiveTaus.sort(key =
lambda l : l.pt(), reverse =
True)
114 event.selectedTaus.sort(key =
lambda l : l.pt(), reverse =
True)
115 event.otherTaus.sort(key =
lambda l : l.pt(), reverse =
True)
116 self.counters.counter(
'events').inc(
'all events')
117 if len(event.inclusiveTaus): self.counters.counter(
'events').inc(
'has >=1 tau at preselection')
118 if len(event.selectedTaus): self.counters.counter(
'events').inc(
'has >=1 selected taus')
119 if len(event.otherTaus): self.counters.counter(
'events').inc(
'has >=1 other taus')
def makeTaus(self, event)
Abs< T >::type abs(const T &t)
double deltaR(double eta1, double eta2, double phi1, double phi2)