1 import FWCore.ParameterSet.Config
as cms
13 finalTaus = cms.EDFilter(
"PATTauRefSelector",
14 src = cms.InputTag(
"slimmedTausUpdated"),
15 cut = cms.string(
"pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT2015') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2') || tauID('byVVVLooseDeepTau2017v2p1VSjet'))")
18 from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff
import run2_nanoAOD_94XMiniAODv1
19 for era
in [run2_nanoAOD_94XMiniAODv1,]:
20 era.toModify(finalTaus,
21 cut = cms.string(
"pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2') || tauID('byVVVLooseDeepTau2017v2p1VSjet'))")
23 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff
import run2_miniAOD_80XLegacy
24 run2_miniAOD_80XLegacy.toModify(finalTaus,
25 src = cms.InputTag(
"slimmedTaus"),
26 cut = cms.string(
"pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT'))")
31 return Var(
" + ".
join([
"%d * tauID('%s')" % (
pow(2,i), pattern % c)
for (i,c)
in enumerate(choices)]),
"uint8",
32 doc=doc+
": bitmask "+
", ".
join([
"%d = %s" % (
pow(2,i),c)
for (i,c)
in enumerate(choices)]))
34 return _tauIdWPMask(pattern,choices=(
"Loose",
"Tight"),doc=doc)
36 return _tauIdWPMask(pattern,choices=(
"Loose",
"Medium",
"Tight"),doc=doc)
38 return _tauIdWPMask(pattern, choices=(
"VLoose",
"Loose",
"Medium",
"Tight"), doc=doc)
40 return _tauIdWPMask(pattern,choices=(
"VLoose",
"Loose",
"Medium",
"Tight",
"VTight"),doc=doc)
42 return _tauIdWPMask(pattern,choices=(
"VLoose",
"Loose",
"Medium",
"Tight",
"VTight",
"VVTight"),doc=doc)
44 return _tauIdWPMask(pattern,choices=(
"VVLoose",
"VLoose",
"Loose",
"Medium",
"Tight",
"VTight",
"VVTight"),doc=doc)
46 return _tauIdWPMask(pattern,choices=(
"VVVLoose",
"VVLoose",
"VLoose",
"Loose",
"Medium",
"Tight",
"VTight",
"VVTight"),doc=doc)
48 tauTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
49 src = cms.InputTag(
"linkedObjects",
"taus"),
51 name= cms.string(
"Tau"),
52 doc = cms.string(
"slimmedTaus after basic selection (" + finalTaus.cut.value()+
")"),
53 singleton = cms.bool(
False),
54 extension = cms.bool(
False),
55 variables = cms.PSet()
57 _tauVarsBase = cms.PSet(P4Vars,
58 charge =
Var(
"charge", int, doc=
"electric charge"),
59 jetIdx =
Var(
"?hasUserCand('jet')?userCand('jet').key():-1", int, doc=
"index of the associated jet (-1 if none)"),
60 decayMode =
Var(
"decayMode()",int),
61 idDecayMode =
Var(
"tauID('decayModeFinding')", bool),
62 idDecayModeNewDMs =
Var(
"tauID('decayModeFindingNewDMs')", bool),
64 leadTkPtOverTauPt =
Var(
"leadChargedHadrCand.pt/pt ",float, doc=
"pt of the leading track divided by tau pt",precision=10),
65 leadTkDeltaEta =
Var(
"leadChargedHadrCand.eta - eta ",float, doc=
"eta of the leading track, minus tau eta",precision=8),
66 leadTkDeltaPhi =
Var(
"deltaPhi(leadChargedHadrCand.phi, phi) ",float, doc=
"phi of the leading track, minus tau phi",precision=8),
68 dxy =
Var(
"leadChargedHadrCand().dxy()",float, doc=
"d_{xy} of lead track with respect to PV, in cm (with sign)",precision=10),
69 dz =
Var(
"leadChargedHadrCand().dz()",float, doc=
"d_{z} of lead track with respect to PV, in cm (with sign)",precision=14),
72 rawIso =
Var(
"tauID('byCombinedIsolationDeltaBetaCorrRaw3Hits')", float, doc =
"combined isolation (deltaBeta corrections)", precision=10),
73 rawIsodR03 =
Var(
"(tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum')))", float, doc =
"combined isolation (deltaBeta corrections, dR=0.3)", precision=10),
74 chargedIso =
Var(
"tauID('chargedIsoPtSum')", float, doc =
"charged isolation", precision=10),
75 neutralIso =
Var(
"tauID('neutralIsoPtSum')", float, doc =
"neutral (photon) isolation", precision=10),
76 puCorr =
Var(
"tauID('puCorrPtSum')", float, doc =
"pileup correction", precision=10),
77 photonsOutsideSignalCone =
Var(
"tauID('photonPtSumOutsideSignalCone')", float, doc =
"sum of photons outside signal cone", precision=10),
79 idAntiMu =
_tauId2WPMask(
"againstMuon%s3", doc=
"Anti-muon discriminator V3: "),
86 _mvaIsoVars2015 = cms.PSet(
87 rawMVAnewDM =
Var(
"tauID('byIsolationMVArun2v1DBnewDMwLTraw')",float, doc=
"byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10),
88 rawMVAoldDM =
Var(
"tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc=
"byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10),
89 rawMVAoldDMdR03 =
Var(
"tauID('byIsolationMVArun2v1DBdR03oldDMwLTraw')",float, doc=
"byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10),
90 idMVAnewDM =
_tauId6WPMask(
"by%sIsolationMVArun2v1DBnewDMwLT", doc=
"IsolationMVArun2v1DBnewDMwLT ID working point (2015)"),
91 idMVAoldDM =
_tauId6WPMask(
"by%sIsolationMVArun2v1DBoldDMwLT", doc=
"IsolationMVArun2v1DBoldDMwLT ID working point (2015)"),
92 idMVAoldDMdR03 =
_tauId6WPMask(
"by%sIsolationMVArun2v1DBdR03oldDMwLT", doc=
"IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2015)")
94 _mvaIsoVars2015Reduced = cms.PSet(
95 rawMVAoldDM =
Var(
"tauID('byIsolationMVArun2v1DBoldDMwLTraw2015')",float, doc=
"byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10),
96 idMVAoldDM =
_tauId6WPMask(
"by%sIsolationMVArun2v1DBoldDMwLT2015", doc=
"IsolationMVArun2v1DBoldDMwLT ID working point (2015)"),
98 _mvaIsoVars2017v1 = cms.PSet(
99 rawMVAoldDM2017v1 =
Var(
"tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc=
"byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)",precision=10),
100 idMVAoldDM2017v1 =
_tauId7WPMask(
"by%sIsolationMVArun2v1DBoldDMwLT", doc=
"IsolationMVArun2v1DBoldDMwLT ID working point (2017v1)")
102 _mvaIsoVars2017v2 = cms.PSet(
103 rawMVAnewDM2017v2 =
Var(
"tauID('byIsolationMVArun2v1DBnewDMwLTraw2017v2')",float, doc=
"byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)",precision=10),
104 rawMVAoldDM2017v2 =
Var(
"tauID('byIsolationMVArun2v1DBoldDMwLTraw2017v2')",float, doc=
"byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)",precision=10),
105 rawMVAoldDMdR032017v2 =
Var(
"tauID('byIsolationMVArun2v1DBdR03oldDMwLTraw2017v2')",float, doc=
"byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)",precision=10),
106 idMVAnewDM2017v2 =
_tauId7WPMask(
"by%sIsolationMVArun2v1DBnewDMwLT2017v2", doc=
"IsolationMVArun2v1DBnewDMwLT ID working point (2017v2)"),
107 idMVAoldDM2017v2 =
_tauId7WPMask(
"by%sIsolationMVArun2v1DBoldDMwLT2017v2", doc=
"IsolationMVArun2v1DBoldDMwLT ID working point (2017v2)"),
108 idMVAoldDMdR032017v2 =
_tauId7WPMask(
"by%sIsolationMVArun2v1DBdR03oldDMwLT2017v2", doc=
"IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2017v2)")
110 _mvaAntiEVars = cms.PSet(
111 rawAntiEle2018 =
Var(
"tauID('againstElectronMVA6Raw')", float, doc=
"Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10),
112 rawAntiEleCat2018 =
Var(
"tauID('againstElectronMVA6category')", int, doc=
"Anti-electron MVA discriminator V6 category (2018)"),
113 idAntiEle2018 =
_tauId5WPMask(
"againstElectron%sMVA6", doc=
"Anti-electron MVA discriminator V6 (2018)"),
114 rawAntiEle =
Var(
"tauID('againstElectronMVA6Raw2015')", float, doc=
"Anti-electron MVA discriminator V6 raw output discriminator (2015)", precision=10),
115 rawAntiEleCat =
Var(
"tauID('againstElectronMVA6category2015')", int, doc=
"Anti-electron MVA discriminator V6 category (2015"),
116 idAntiEle =
_tauId5WPMask(
"againstElectron%sMVA62015", doc=
"Anti-electron MVA discriminator V6 (2015)"),
118 _mvaAntiEVars2015 = cms.PSet(
119 rawAntiEle =
Var(
"tauID('againstElectronMVA6Raw')", float, doc=
"Anti-electron MVA discriminator V6 raw output discriminator (2015)", precision=10),
120 rawAntiEleCat =
Var(
"tauID('againstElectronMVA6category')", int, doc=
"Anti-electron MVA discriminator V6 category (2015"),
121 idAntiEle =
_tauId5WPMask(
"againstElectron%sMVA6", doc=
"Anti-electron MVA discriminator V6 (2015)"),
123 _deepTauVars2017v2p1 = cms.PSet(
124 rawDeepTau2017v2p1VSe =
Var(
"tauID('byDeepTau2017v2p1VSeraw')", float, doc=
"byDeepTau2017v2p1VSe raw output discriminator (deepTau2017v2p1)", precision=10),
125 rawDeepTau2017v2p1VSmu =
Var(
"tauID('byDeepTau2017v2p1VSmuraw')", float, doc=
"byDeepTau2017v2p1VSmu raw output discriminator (deepTau2017v2p1)", precision=10),
126 rawDeepTau2017v2p1VSjet =
Var(
"tauID('byDeepTau2017v2p1VSjetraw')", float, doc=
"byDeepTau2017v2p1VSjet raw output discriminator (deepTau2017v2p1)", precision=10),
127 idDeepTau2017v2p1VSe =
_tauId8WPMask(
"by%sDeepTau2017v2p1VSe", doc=
"byDeepTau2017v2p1VSe ID working points (deepTau2017v2p1)"),
128 idDeepTau2017v2p1VSmu =
_tauId4WPMask(
"by%sDeepTau2017v2p1VSmu", doc=
"byDeepTau2017v2p1VSmu ID working points (deepTau2017v2p1)"),
129 idDeepTau2017v2p1VSjet =
_tauId8WPMask(
"by%sDeepTau2017v2p1VSjet", doc=
"byDeepTau2017v2p1VSjet ID working points (deepTau2017v2p1)"),
132 _variablesMiniV2 = cms.PSet(
135 _mvaIsoVars2015Reduced,
140 _variablesMiniV1 = _variablesMiniV2.clone()
141 _variablesMiniV1.rawMVAoldDM =
Var(
"tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc=
"byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10)
142 _variablesMiniV1.rawMVAoldDM2017v1 =
Var(
"tauID('byIsolationMVArun2v1DBoldDMwLTraw2017v1')",float, doc=
"byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)",precision=10)
143 _variablesMiniV1.idMVAoldDM =
_tauId6WPMask(
"by%sIsolationMVArun2v1DBoldDMwLT", doc=
"IsolationMVArun2v1DBoldDMwLT ID working point (2015)")
144 _variablesMiniV1.idMVAoldDM2017v1 =
_tauId7WPMask(
"by%sIsolationMVArun2v1DBoldDMwLT2017v1", doc=
"IsolationMVArun2v1DBoldDMwLT ID working point (2017v1)")
145 _variables80X = cms.PSet(
151 tauTable.variables = _variablesMiniV2
153 for era
in [run2_nanoAOD_94XMiniAODv1,]:
154 era.toModify(tauTable,
155 variables = _variablesMiniV1
157 run2_miniAOD_80XLegacy.toModify(tauTable,
158 variables = _variables80X
160 (~run2_miniAOD_80XLegacy).toModify(tauTable.variables,
161 rawAntiEle2018 =
Var(
"tauID('againstElectronMVA6Raw2018')", float, doc=
"Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10),
162 rawAntiEleCat2018 =
Var(
"tauID('againstElectronMVA6category2018')", int, doc=
"Anti-electron MVA discriminator V6 category (2018)"),
163 idAntiEle2018 =
_tauId5WPMask(
"againstElectron%sMVA62018", doc=
"Anti-electron MVA discriminator V6 (2018)"),
164 rawAntiEle =
Var(
"tauID('againstElectronMVA6Raw')", float, doc=
"Anti-electron MVA discriminator V6 raw output discriminator (2015)", precision=10),
165 rawAntiEleCat =
Var(
"tauID('againstElectronMVA6category')", int, doc=
"Anti-electron MVA discriminator V6 category (2015"),
166 idAntiEle =
_tauId5WPMask(
"againstElectron%sMVA6", doc=
"Anti-electron MVA discriminator V6 (2015)")
169 tauGenJets.GenParticles = cms.InputTag(
"prunedGenParticles")
170 tauGenJets.includeNeutrinos = cms.bool(
False)
172 genVisTaus = cms.EDProducer(
"GenVisTauProducer",
173 src = cms.InputTag(
"tauGenJetsSelectorAllHadrons"),
174 srcGenParticles = cms.InputTag(
"prunedGenParticles")
177 genVisTauTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
178 src = cms.InputTag(
"genVisTaus"),
179 cut = cms.string(
"pt > 10."),
180 name = cms.string(
"GenVisTau"),
181 doc = cms.string(
"gen hadronic taus "),
182 singleton = cms.bool(
False),
183 extension = cms.bool(
False),
184 variables = cms.PSet(
185 pt =
Var(
"pt", float,precision=8),
186 phi =
Var(
"phi", float,precision=8),
187 eta =
Var(
"eta", float,precision=8),
188 mass =
Var(
"mass", float,precision=8),
189 charge =
Var(
"charge", int),
190 status =
Var(
"status", int, doc=
"Hadronic tau decay mode. 0=OneProng0PiZero, 1=OneProng1PiZero, 2=OneProng2PiZero, 10=ThreeProng0PiZero, 11=ThreeProng1PiZero, 15=Other"),
191 genPartIdxMother =
Var(
"?numberOfMothers>0?motherRef(0).key():-1", int, doc=
"index of the mother particle"),
195 tausMCMatchLepTauForTable = cms.EDProducer(
"MCMatcher",
197 matched = cms.InputTag(
"finalGenParticles"),
198 mcPdgId = cms.vint32(11,13),
199 checkCharge = cms.bool(
False),
200 mcStatus = cms.vint32(),
201 maxDeltaR = cms.double(0.3),
202 maxDPtRel = cms.double(0.5),
203 resolveAmbiguities = cms.bool(
True),
204 resolveByMatchQuality = cms.bool(
True),
207 tausMCMatchHadTauForTable = cms.EDProducer(
"MCMatcher",
209 matched = cms.InputTag(
"genVisTaus"),
210 mcPdgId = cms.vint32(15),
211 checkCharge = cms.bool(
False),
212 mcStatus = cms.vint32(),
213 maxDeltaR = cms.double(0.3),
214 maxDPtRel = cms.double(1.),
215 resolveAmbiguities = cms.bool(
True),
216 resolveByMatchQuality = cms.bool(
True),
219 tauMCTable = cms.EDProducer(
"CandMCMatchTableProducer",
221 mcMap = cms.InputTag(
"tausMCMatchLepTauForTable"),
222 mcMapVisTau = cms.InputTag(
"tausMCMatchHadTauForTable"),
223 objName = tauTable.name,
224 objType = tauTable.name,
225 branchName = cms.string(
"genPart"),
226 docString = cms.string(
"MC matching to status==2 taus"),
230 tauSequence = cms.Sequence(patTauMVAIDsSeq + finalTaus)
231 _tauSequence80X = cms.Sequence(finalTaus)
232 run2_miniAOD_80XLegacy.toReplaceWith(tauSequence,_tauSequence80X)
233 tauTables = cms.Sequence(tauTable)
234 tauMC = cms.Sequence(tauGenJets + tauGenJetsSelectorAllHadrons + genVisTaus + genVisTauTable + tausMCMatchLepTauForTable + tausMCMatchHadTauForTable + tauMCTable)