129 self.process.rerunMvaIsolationTask = cms.Task()
130 self.process.rerunMvaIsolationSequence = cms.Sequence()
131 tauIDSources = cms.PSet()
134 if "2017v1" in self.toKeep:
135 self.tauIdDiscrMVA_2017_version =
"v1"
136 self.tauIdDiscrMVA_trainings_run2_2017 = {
137 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
139 self.tauIdDiscrMVA_WPs_run2_2017 = {
140 'tauIdMVAIsoDBoldDMwLT2017' : {
141 'Eff95' :
"DBoldDMwLTEff95",
142 'Eff90' :
"DBoldDMwLTEff90",
143 'Eff80' :
"DBoldDMwLTEff80",
144 'Eff70' :
"DBoldDMwLTEff70",
145 'Eff60' :
"DBoldDMwLTEff60",
146 'Eff50' :
"DBoldDMwLTEff50",
147 'Eff40' :
"DBoldDMwLTEff40"
151 if not self.is_above_cmssw_version(9, 4, 4, self.debug):
152 if self.debug:
print (
"runTauID: not is_above_cmssw_version(9, 4, 4). Will update the list of available in DB samples to access 2017v1")
153 self.loadMVA_WPs_run2_2017()
155 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
156 PATTauProducer = cms.InputTag(
'slimmedTaus'),
157 Prediscriminants = noPrediscriminants,
158 loadMVAfromDB = cms.bool(
True),
159 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),
160 mvaOpt = cms.string(
"DBoldDMwLTwGJ"),
161 verbosity = cms.int32(0)
164 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1 = patDiscriminationByIsolationMVArun2v1.clone(
165 PATTauProducer = cms.InputTag(
'slimmedTaus'),
166 Prediscriminants = noPrediscriminants,
167 toMultiplex = cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1raw'),
168 loadMVAfromDB = cms.bool(
True),
169 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"),
172 category = cms.uint32(0),
173 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),
174 variable = cms.string(
"pt"),
177 workingPoints = cms.vstring(
188 self.rerunIsolationOldDMMVArun2017v1Task = cms.Task(
189 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw,
190 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1
192 self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMMVArun2017v1Task)
193 self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationOldDMMVArun2017v1Task)
195 tauIDSources.byIsolationMVArun2017v1DBoldDMwLTraw2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v1",
"raw")
196 tauIDSources.byVVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v1",
"_WPEff95")
197 tauIDSources.byVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v1",
"_WPEff90")
198 tauIDSources.byLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v1",
"_WPEff80")
199 tauIDSources.byMediumIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v1",
"_WPEff70")
200 tauIDSources.byTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v1",
"_WPEff60")
201 tauIDSources.byVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v1",
"_WPEff50")
202 tauIDSources.byVVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v1",
"_WPEff40")
205 if "2017v2" in self.toKeep:
206 self.tauIdDiscrMVA_2017_version =
"v2"
207 self.tauIdDiscrMVA_trainings_run2_2017 = {
208 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
210 self.tauIdDiscrMVA_WPs_run2_2017 = {
211 'tauIdMVAIsoDBoldDMwLT2017' : {
212 'Eff95' :
"DBoldDMwLTEff95",
213 'Eff90' :
"DBoldDMwLTEff90",
214 'Eff80' :
"DBoldDMwLTEff80",
215 'Eff70' :
"DBoldDMwLTEff70",
216 'Eff60' :
"DBoldDMwLTEff60",
217 'Eff50' :
"DBoldDMwLTEff50",
218 'Eff40' :
"DBoldDMwLTEff40"
222 if not self.is_above_cmssw_version(9, 4, 5, self.debug):
223 if self.debug:
print (
"runTauID: not is_above_cmssw_version(9, 4, 5). Will update the list of available in DB samples to access 2017v2")
224 self.loadMVA_WPs_run2_2017()
226 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
227 PATTauProducer = cms.InputTag(
'slimmedTaus'),
228 Prediscriminants = noPrediscriminants,
229 loadMVAfromDB = cms.bool(
True),
230 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),
231 mvaOpt = cms.string(
"DBoldDMwLTwGJ"),
232 verbosity = cms.int32(0)
235 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2 = patDiscriminationByIsolationMVArun2v1.clone(
236 PATTauProducer = cms.InputTag(
'slimmedTaus'),
237 Prediscriminants = noPrediscriminants,
238 toMultiplex = cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2raw'),
239 loadMVAfromDB = cms.bool(
True),
240 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"),
243 category = cms.uint32(0),
244 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),
245 variable = cms.string(
"pt"),
248 workingPoints = cms.vstring(
257 verbosity = cms.int32(0)
260 self.rerunIsolationOldDMMVArun2017v2Task = cms.Task(
261 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw,
262 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2
264 self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMMVArun2017v2Task)
265 self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationOldDMMVArun2017v2Task)
267 tauIDSources.byIsolationMVArun2017v2DBoldDMwLTraw2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v2",
"raw")
268 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v2",
"_WPEff95")
269 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v2",
"_WPEff90")
270 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v2",
"_WPEff80")
271 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v2",
"_WPEff70")
272 tauIDSources.byTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v2",
"_WPEff60")
273 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v2",
"_WPEff50")
274 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2017v2",
"_WPEff40")
276 if "newDM2017v2" in self.toKeep:
277 self.tauIdDiscrMVA_2017_version =
"v2"
278 self.tauIdDiscrMVA_trainings_run2_2017 = {
279 'tauIdMVAIsoDBnewDMwLT2017' :
"tauIdMVAIsoDBnewDMwLT2017",
281 self.tauIdDiscrMVA_WPs_run2_2017 = {
282 'tauIdMVAIsoDBnewDMwLT2017' : {
283 'Eff95' :
"DBnewDMwLTEff95",
284 'Eff90' :
"DBnewDMwLTEff90",
285 'Eff80' :
"DBnewDMwLTEff80",
286 'Eff70' :
"DBnewDMwLTEff70",
287 'Eff60' :
"DBnewDMwLTEff60",
288 'Eff50' :
"DBnewDMwLTEff50",
289 'Eff40' :
"DBnewDMwLTEff40"
293 if not self.is_above_cmssw_version(9, 4, 5, self.debug):
294 if self.debug:
print (
"runTauID: not is_above_cmssw_version(9, 4, 5). Will update the list of available in DB samples to access newDM2017v2")
295 self.loadMVA_WPs_run2_2017()
297 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
298 PATTauProducer = cms.InputTag(
'slimmedTaus'),
299 Prediscriminants = noPrediscriminants,
300 loadMVAfromDB = cms.bool(
True),
301 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),
302 mvaOpt = cms.string(
"DBnewDMwLTwGJ"),
303 verbosity = cms.int32(0)
306 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2 = patDiscriminationByIsolationMVArun2v1.clone(
307 PATTauProducer = cms.InputTag(
'slimmedTaus'),
308 Prediscriminants = noPrediscriminants,
309 toMultiplex = cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2raw'),
310 loadMVAfromDB = cms.bool(
True),
311 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"),
314 category = cms.uint32(0),
315 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),
316 variable = cms.string(
"pt"),
319 workingPoints = cms.vstring(
328 verbosity = cms.int32(0)
331 self.rerunIsolationNewDMMVArun2017v2Task = cms.Task(
332 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw,
333 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2
335 self.process.rerunMvaIsolationTask.add(self.rerunIsolationNewDMMVArun2017v2Task)
336 self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationNewDMMVArun2017v2Task)
338 tauIDSources.byIsolationMVArun2017v2DBnewDMwLTraw2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2017v2",
"raw")
339 tauIDSources.byVVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2017v2",
"_WPEff95")
340 tauIDSources.byVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2017v2",
"_WPEff90")
341 tauIDSources.byLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2017v2",
"_WPEff80")
342 tauIDSources.byMediumIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2017v2",
"_WPEff70")
343 tauIDSources.byTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2017v2",
"_WPEff60")
344 tauIDSources.byVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2017v2",
"_WPEff50")
345 tauIDSources.byVVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2017v2",
"_WPEff40")
347 if "dR0p32017v2" in self.toKeep:
348 self.tauIdDiscrMVA_2017_version =
"v2"
349 self.tauIdDiscrMVA_trainings_run2_2017 = {
350 'tauIdMVAIsoDBoldDMdR0p3wLT2017' :
"tauIdMVAIsoDBoldDMdR0p3wLT2017",
352 self.tauIdDiscrMVA_WPs_run2_2017 = {
353 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : {
354 'Eff95' :
"DBoldDMdR0p3wLTEff95",
355 'Eff90' :
"DBoldDMdR0p3wLTEff90",
356 'Eff80' :
"DBoldDMdR0p3wLTEff80",
357 'Eff70' :
"DBoldDMdR0p3wLTEff70",
358 'Eff60' :
"DBoldDMdR0p3wLTEff60",
359 'Eff50' :
"DBoldDMdR0p3wLTEff50",
360 'Eff40' :
"DBoldDMdR0p3wLTEff40"
364 if not self.is_above_cmssw_version(9, 4, 5, self.debug):
365 if self.debug:
print (
"runTauID: not is_above_cmssw_version(9, 4, 5). Will update the list of available in DB samples to access dR0p32017v2")
366 self.loadMVA_WPs_run2_2017()
368 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
369 PATTauProducer = cms.InputTag(
'slimmedTaus'),
370 Prediscriminants = noPrediscriminants,
371 loadMVAfromDB = cms.bool(
True),
372 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
373 mvaOpt = cms.string(
"DBoldDMwLTwGJ"),
374 srcChargedIsoPtSum = cms.string(
'chargedIsoPtSumdR03'),
375 srcFootprintCorrection = cms.string(
'footprintCorrectiondR03'),
376 srcNeutralIsoPtSum = cms.string(
'neutralIsoPtSumdR03'),
377 srcPhotonPtSumOutsideSignalCone = cms.string(
'photonPtSumOutsideSignalConedR03'),
378 verbosity = cms.int32(0)
381 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2= patDiscriminationByIsolationMVArun2v1.clone(
382 PATTauProducer = cms.InputTag(
'slimmedTaus'),
383 Prediscriminants = noPrediscriminants,
384 toMultiplex = cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw'),
385 loadMVAfromDB = cms.bool(
True),
386 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"),
389 category = cms.uint32(0),
390 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
391 variable = cms.string(
"pt"),
394 workingPoints = cms.vstring(
403 verbosity = cms.int32(0)
406 self.rerunIsolationOldDMdR0p3MVArun2017v2Task = cms.Task(
407 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw,
408 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2
410 self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMdR0p3MVArun2017v2Task)
411 self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationOldDMdR0p3MVArun2017v2Task)
413 tauIDSources.byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2",
"raw")
414 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2",
"_WPEff95")
415 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2",
"_WPEff90")
416 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2",
"_WPEff80")
417 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2",
"_WPEff70")
418 tauIDSources.byTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2",
"_WPEff60")
419 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2",
"_WPEff50")
420 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2",
"_WPEff40")
449 if "2016v1" in self.toKeep:
450 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
451 PATTauProducer = cms.InputTag(
'slimmedTaus'),
452 Prediscriminants = noPrediscriminants,
453 loadMVAfromDB = cms.bool(
True),
454 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
455 mvaOpt = cms.string(
"DBoldDMwLT"),
456 verbosity = cms.int32(0)
459 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1 = patDiscriminationByIsolationMVArun2v1.clone(
460 PATTauProducer = cms.InputTag(
'slimmedTaus'),
461 Prediscriminants = noPrediscriminants,
462 toMultiplex = cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1raw'),
463 loadMVAfromDB = cms.bool(
True),
464 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_mvaOutput_normalization"),
467 category = cms.uint32(0),
468 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
469 variable = cms.string(
"pt"),
472 workingPoints = cms.vstring(
482 self.rerunIsolationOldDMMVArun2016v1Task = cms.Task(
483 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw,
484 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1
486 self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMMVArun2016v1Task)
487 self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationOldDMMVArun2016v1Task)
489 tauIDSources.byIsolationMVArun2v1DBoldDMwLTraw2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2v1",
"raw")
490 tauIDSources.byVLooseIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2v1",
"_WPEff90")
491 tauIDSources.byLooseIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2v1",
"_WPEff80")
492 tauIDSources.byMediumIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2v1",
"_WPEff70")
493 tauIDSources.byTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2v1",
"_WPEff60")
494 tauIDSources.byVTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2v1",
"_WPEff50")
495 tauIDSources.byVVTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationOldDMMVArun2v1",
"_WPEff40")
498 if "newDM2016v1" in self.toKeep:
499 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
500 PATTauProducer = cms.InputTag(
'slimmedTaus'),
501 Prediscriminants = noPrediscriminants,
502 loadMVAfromDB = cms.bool(
True),
503 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1"),
504 mvaOpt = cms.string(
"DBnewDMwLT"),
505 verbosity = cms.int32(0)
508 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1 = patDiscriminationByIsolationMVArun2v1.clone(
509 PATTauProducer = cms.InputTag(
'slimmedTaus'),
510 Prediscriminants = noPrediscriminants,
511 toMultiplex = cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1raw'),
512 loadMVAfromDB = cms.bool(
True),
513 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_mvaOutput_normalization"),
516 category = cms.uint32(0),
517 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff90"),
518 variable = cms.string(
"pt"),
521 workingPoints = cms.vstring(
531 self.rerunIsolationNewDMMVArun2016v1Task = cms.Task(
532 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw,
533 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1
535 self.process.rerunMvaIsolationTask.add(self.rerunIsolationNewDMMVArun2016v1Task)
536 self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationNewDMMVArun2016v1Task)
538 tauIDSources.byIsolationMVArun2v1DBnewDMwLTraw2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2v1",
"raw")
539 tauIDSources.byVLooseIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2v1",
"_WPEff90")
540 tauIDSources.byLooseIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2v1",
"_WPEff80")
541 tauIDSources.byMediumIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2v1",
"_WPEff70")
542 tauIDSources.byTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2v1",
"_WPEff60")
543 tauIDSources.byVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2v1",
"_WPEff50")
544 tauIDSources.byVVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(
"rerunDiscriminationByIsolationNewDMMVArun2v1",
"_WPEff40")
546 if "deepTau2017v1" in self.toKeep:
547 if self.debug:
print (
"Adding DeepTau IDs")
551 "VVVLoose" : 0.96424,
561 "VVVLoose" : 0.959619,
562 "VVLoose" : 0.997687,
582 file_names = [
'RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v1_20L1024N_quantized.pb']
583 self.process.deepTau2017v1 = cms.EDProducer(
"DeepTauId",
584 electrons = cms.InputTag(
'slimmedElectrons'),
585 muons = cms.InputTag(
'slimmedMuons'),
586 taus = cms.InputTag(
'slimmedTaus'),
587 pfcands = cms.InputTag(
'packedPFCandidates'),
588 vertices = cms.InputTag(
'offlineSlimmedPrimaryVertices'),
589 rho = cms.InputTag(
'fixedGridRhoAll'),
590 graph_file = cms.vstring(file_names),
591 mem_mapped = cms.bool(
False),
592 version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]),
593 debug_level = cms.int32(0),
594 disable_dxy_pca = cms.bool(
False)
597 self.processDeepProducer(
'deepTau2017v1', tauIDSources, workingPoints_)
599 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v1)
600 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v1
602 if "deepTau2017v2" in self.toKeep:
603 if self.debug:
print (
"Adding DeepTau IDs")
607 "VVVLoose": 0.0630386,
608 "VVLoose": 0.1686942,
614 "VVTight": 0.9928449,
623 "VVVLoose": 0.2599605,
624 "VVLoose": 0.4249705,
630 "VVTight": 0.9733927,
635 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
636 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
637 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
639 self.process.deepTau2017v2 = cms.EDProducer(
"DeepTauId",
640 electrons = cms.InputTag(
'slimmedElectrons'),
641 muons = cms.InputTag(
'slimmedMuons'),
642 taus = cms.InputTag(
'slimmedTaus'),
643 pfcands = cms.InputTag(
'packedPFCandidates'),
644 vertices = cms.InputTag(
'offlineSlimmedPrimaryVertices'),
645 rho = cms.InputTag(
'fixedGridRhoAll'),
646 graph_file = cms.vstring(file_names),
647 mem_mapped = cms.bool(
False),
648 version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]),
649 debug_level = cms.int32(0),
650 disable_dxy_pca = cms.bool(
False)
653 self.processDeepProducer(
'deepTau2017v2', tauIDSources, workingPoints_)
655 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v2)
656 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v2
658 if "deepTau2017v2p1" in self.toKeep:
659 if self.debug:
print (
"Adding DeepTau IDs")
663 "VVVLoose": 0.0630386,
664 "VVLoose": 0.1686942,
670 "VVTight": 0.9928449,
679 "VVVLoose": 0.2599605,
680 "VVLoose": 0.4249705,
686 "VVTight": 0.9733927,
691 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
692 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
693 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
695 self.process.deepTau2017v2p1 = cms.EDProducer(
"DeepTauId",
696 electrons = cms.InputTag(
'slimmedElectrons'),
697 muons = cms.InputTag(
'slimmedMuons'),
698 taus = cms.InputTag(
'slimmedTaus'),
699 pfcands = cms.InputTag(
'packedPFCandidates'),
700 vertices = cms.InputTag(
'offlineSlimmedPrimaryVertices'),
701 rho = cms.InputTag(
'fixedGridRhoAll'),
702 graph_file = cms.vstring(file_names),
703 mem_mapped = cms.bool(
False),
704 version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]),
705 debug_level = cms.int32(0),
706 disable_dxy_pca = cms.bool(
True),
707 is_online = cms.bool(
False)
710 self.processDeepProducer(
'deepTau2017v2p1', tauIDSources, workingPoints_)
712 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v2p1)
713 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v2p1
715 if "DPFTau_2016_v0" in self.toKeep:
716 if self.debug:
print (
"Adding DPFTau isolation (v0)")
720 "Tight" :
"if(decayMode == 0) return (0.898328 - 0.000160992 * pt);" + \
721 "if(decayMode == 1) return (0.910138 - 0.000229923 * pt);" + \
722 "if(decayMode == 10) return (0.873958 - 0.0002328 * pt);" + \
732 file_names = [
'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb' ]
733 self.process.dpfTau2016v0 = cms.EDProducer(
"DPFIsolation",
734 pfcands = cms.InputTag(
'packedPFCandidates'),
735 taus = cms.InputTag(
'slimmedTaus'),
736 vertices = cms.InputTag(
'offlineSlimmedPrimaryVertices'),
737 graph_file = cms.vstring(file_names),
738 version = cms.uint32(self.getDpfTauVersion(file_names[0])),
739 mem_mapped = cms.bool(
False)
742 self.processDeepProducer(
'dpfTau2016v0', tauIDSources, workingPoints_)
744 self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v0)
745 self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v0
748 if "DPFTau_2016_v1" in self.toKeep:
749 print (
"Adding DPFTau isolation (v1)")
750 print (
"WARNING: WPs are not defined for DPFTau_2016_v1")
751 print (
"WARNING: The score of DPFTau_2016_v1 is inverted: i.e. for Sig->0, for Bkg->1 with -1 for undefined input (preselection not passed).")
754 "all": {
"Tight" : 0.123}
757 file_names = [
'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v1_quantized.pb' ]
758 self.process.dpfTau2016v1 = cms.EDProducer(
"DPFIsolation",
759 pfcands = cms.InputTag(
'packedPFCandidates'),
760 taus = cms.InputTag(
'slimmedTaus'),
761 vertices = cms.InputTag(
'offlineSlimmedPrimaryVertices'),
762 graph_file = cms.vstring(file_names),
763 version = cms.uint32(self.getDpfTauVersion(file_names[0])),
764 mem_mapped = cms.bool(
False)
767 self.processDeepProducer(
'dpfTau2016v1', tauIDSources, workingPoints_)
769 self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v1)
770 self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v1
772 if "againstEle2018" in self.toKeep:
773 antiElectronDiscrMVA6_version =
"MVA6v3_noeveto"
777 self.process.patTauDiscriminationByElectronRejectionMVA62018Raw = patTauDiscriminationAgainstElectronMVA6.clone(
778 PATTauProducer = cms.InputTag(
'slimmedTaus'),
779 Prediscriminants = noPrediscriminants,
780 srcElectrons = cms.InputTag(
'slimmedElectrons'),
781 vetoEcalCracks = cms.bool(
False),
782 mvaName_NoEleMatch_wGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL',
783 mvaName_NoEleMatch_wGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC',
784 mvaName_NoEleMatch_woGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL',
785 mvaName_NoEleMatch_woGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC',
786 mvaName_wGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL',
787 mvaName_wGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC',
788 mvaName_woGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL',
789 mvaName_woGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC'
793 self.process.patTauDiscriminationByElectronRejectionMVA62018 = patTauDiscriminantCutMultiplexer.clone(
794 PATTauProducer = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.PATTauProducer,
795 Prediscriminants = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.Prediscriminants,
796 toMultiplex = cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw"),
799 category = cms.uint32(0),
800 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL'),
801 variable = cms.string(
'pt')
804 category = cms.uint32(2),
805 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL'),
806 variable = cms.string(
'pt')
809 category = cms.uint32(5),
810 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL'),
811 variable = cms.string(
'pt')
814 category = cms.uint32(7),
815 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL'),
816 variable = cms.string(
'pt')
819 category = cms.uint32(8),
820 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC'),
821 variable = cms.string(
'pt')
824 category = cms.uint32(10),
825 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC'),
826 variable = cms.string(
'pt')
829 category = cms.uint32(13),
830 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC'),
831 variable = cms.string(
'pt')
834 category = cms.uint32(15),
835 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC'),
836 variable = cms.string(
'pt')
839 workingPoints = cms.vstring(
848 self.process.patTauDiscriminationByElectronRejectionMVA62018Task = cms.Task(
849 self.process.patTauDiscriminationByElectronRejectionMVA62018Raw,
850 self.process.patTauDiscriminationByElectronRejectionMVA62018
852 self.process.patTauDiscriminationByElectronRejectionMVA62018Seq = cms.Sequence(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
853 self.process.rerunMvaIsolationTask.add(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
854 self.process.rerunMvaIsolationSequence += self.process.patTauDiscriminationByElectronRejectionMVA62018Seq
856 _againstElectronTauIDSources = cms.PSet(
857 againstElectronMVA6Raw2018 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA62018",
"raw"),
858 againstElectronMVA6category2018 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA62018",
"category"),
859 againstElectronVLooseMVA62018 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA62018",
"_WPeff98"),
860 againstElectronLooseMVA62018 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA62018",
"_WPeff90"),
861 againstElectronMediumMVA62018 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA62018",
"_WPeff80"),
862 againstElectronTightMVA62018 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA62018",
"_WPeff70"),
863 againstElectronVTightMVA62018 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA62018",
"_WPeff60")
865 _tauIDSourcesWithAgainistEle = cms.PSet(
866 tauIDSources.clone(),
867 _againstElectronTauIDSources
869 tauIDSources =_tauIDSourcesWithAgainistEle.clone()
871 if "newDMPhase2v1" in self.toKeep:
872 if self.debug:
print (
"Adding newDMPhase2v1 ID")
874 return cms.PSet(inputTag = cms.InputTag(module), workingPointIndex = cms.int32(-1
if wp==
"raw" else -2
if wp==
"category" else getattr(self.process, module).workingPoints.index(wp)))
875 self.process.rerunDiscriminationByIsolationMVADBnewDMwLTPhase2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
876 PATTauProducer =
'slimmedTaus',
877 Prediscriminants = noPrediscriminants,
878 loadMVAfromDB =
True,
879 mvaName =
'RecoTauTag_tauIdMVAIsoPhase2',
880 mvaOpt =
'DBnewDMwLTwGJPhase2',
884 self.process.rerunDiscriminationByIsolationMVADBnewDMwLTPhase2 = patDiscriminationByIsolationMVArun2v1.clone(
885 PATTauProducer =
'slimmedTaus',
886 Prediscriminants = noPrediscriminants,
887 toMultiplex =
'rerunDiscriminationByIsolationMVADBnewDMwLTPhase2raw',
888 loadMVAfromDB =
True,
889 mvaOutput_normalization =
'RecoTauTag_tauIdMVAIsoPhase2_mvaOutput_normalization',
892 category = cms.uint32(0),
893 cut = cms.string(
"RecoTauTag_tauIdMVAIsoPhase2"),
894 variable = cms.string(
"pt"),
897 workingPoints = cms.vstring(
907 self.process.rerunIsolationMVADBnewDMwLTPhase2Task = cms.Task(
908 self.process.rerunDiscriminationByIsolationMVADBnewDMwLTPhase2raw,
909 self.process.rerunDiscriminationByIsolationMVADBnewDMwLTPhase2
911 self.process.rerunMvaIsolationTask.add(self.process.rerunIsolationMVADBnewDMwLTPhase2Task)
912 self.process.rerunMvaIsolationSequence += cms.Sequence(self.process.rerunIsolationMVADBnewDMwLTPhase2Task)
914 tauIDSources.byIsolationMVADBnewDMwLTPhase2raw =
tauIDMVAinputs(
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2",
"raw")
915 tauIDSources.byVVLooseIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2",
"_VVLoose")
916 tauIDSources.byVLooseIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2",
"_VLoose")
917 tauIDSources.byLooseIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2",
"_Loose")
918 tauIDSources.byMediumIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2",
"_Medium")
919 tauIDSources.byTightIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2",
"_Tight")
920 tauIDSources.byVTightIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2",
"_VTight")
921 tauIDSources.byVVTightIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2",
"_VVTight")
923 if "againstElePhase2v1" in self.toKeep:
924 if self.debug:
print (
"Adding anti-e Phase2v1 ID")
927 from RecoTauTag.RecoTau.PATTauDiscriminationAgainstElectronMVA6Phase2_cff
import patTauDiscriminationAgainstElectronMVA6Phase2Raw, patTauDiscriminationAgainstElectronMVA6Phase2, mergedSlimmedElectronsForTauId
928 self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw = patTauDiscriminationAgainstElectronMVA6Phase2Raw.clone(
929 PATTauProducer =
'slimmedTaus',
930 Prediscriminants = noPrediscriminants
933 self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1 = patTauDiscriminationAgainstElectronMVA6Phase2.clone(
934 PATTauProducer = self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw.PATTauProducer,
935 Prediscriminants = self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw.Prediscriminants,
936 toMultiplex =
'patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw'
939 self.process.mergedSlimmedElectronsForTauId = mergedSlimmedElectronsForTauId
940 self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Task = cms.Task(
941 self.process.mergedSlimmedElectronsForTauId,
942 self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw,
943 self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1
945 self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Seq = cms.Sequence(self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Task)
946 self.process.rerunMvaIsolationTask.add(self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Task)
947 self.process.rerunMvaIsolationSequence += self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Seq
949 _againstElectronTauIDPhase2v1Sources = cms.PSet(
950 againstElectronMVA6RawPhase2v1 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA6Phase2v1",
"raw"),
951 againstElectronMVA6categoryPhase2v1 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA6Phase2v1",
"category"),
952 againstElectronVLooseMVA6Phase2v1 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA6Phase2v1",
"_VLoose"),
953 againstElectronLooseMVA6Phase2v1 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA6Phase2v1",
"_Loose"),
954 againstElectronMediumMVA6Phase2v1 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA6Phase2v1",
"_Medium"),
955 againstElectronTightMVA6Phase2v1 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA6Phase2v1",
"_Tight"),
956 againstElectronVTightMVA6Phase2v1 = self.tauIDMVAinputs(
"patTauDiscriminationByElectronRejectionMVA6Phase2v1",
"_VTight")
958 _tauIDSourcesWithAgainistElePhase2v1 = cms.PSet(
959 tauIDSources.clone(),
960 _againstElectronTauIDPhase2v1Sources
962 tauIDSources =_tauIDSourcesWithAgainistElePhase2v1.clone()
964 if self.debug:
print(
'Embedding new TauIDs into \"'+self.updatedTauName+
'\"')
965 if not hasattr(self.process, self.updatedTauName):
966 embedID = cms.EDProducer(
"PATTauIDEmbedder",
967 src = cms.InputTag(
'slimmedTaus'),
968 tauIDSources = tauIDSources
970 setattr(self.process, self.updatedTauName, embedID)
972 tauIDSources = cms.PSet(
973 getattr(self.process, self.updatedTauName).tauIDSources,
975 getattr(self.process, self.updatedTauName).tauIDSources = tauIDSources