133 _rerunMvaIsolationTask = cms.Task()
134 _rerunMvaIsolationSequence = cms.Sequence()
135 tauIDSources = cms.PSet()
138 if "2017v1" in self.toKeep:
139 self.tauIdDiscrMVA_2017_version =
"v1" 140 self.tauIdDiscrMVA_trainings_run2_2017 = {
141 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
143 self.tauIdDiscrMVA_WPs_run2_2017 = {
144 'tauIdMVAIsoDBoldDMwLT2017' : {
145 'Eff95' :
"DBoldDMwLTEff95",
146 'Eff90' :
"DBoldDMwLTEff90",
147 'Eff80' :
"DBoldDMwLTEff80",
148 'Eff70' :
"DBoldDMwLTEff70",
149 'Eff60' :
"DBoldDMwLTEff60",
150 'Eff50' :
"DBoldDMwLTEff50",
151 'Eff40' :
"DBoldDMwLTEff40" 155 if not self.is_above_cmssw_version(9, 4, 4, self.debug):
156 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")
157 self.loadMVA_WPs_run2_2017()
159 _byIsolationOldDMMVArun2017v1raw =
"rerunDiscriminationByIsolationOldDMMVArun2017v1raw"+self.postfix
160 setattr(self.process,_byIsolationOldDMMVArun2017v1raw,patDiscriminationByIsolationMVArun2v1raw.clone(
161 PATTauProducer = self.originalTauName,
162 Prediscriminants = noPrediscriminants,
163 loadMVAfromDB = cms.bool(
True),
164 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),
165 mvaOpt = cms.string(
"DBoldDMwLTwGJ"),
166 verbosity = cms.int32(0)
169 _byIsolationOldDMMVArun2017v1 =
"rerunDiscriminationByIsolationOldDMMVArun2017v1"+self.postfix
170 setattr(self.process,_byIsolationOldDMMVArun2017v1,patDiscriminationByIsolationMVArun2v1.clone(
171 PATTauProducer = self.originalTauName,
172 Prediscriminants = noPrediscriminants,
173 toMultiplex = _byIsolationOldDMMVArun2017v1raw,
174 loadMVAfromDB = cms.bool(
True),
175 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"),
178 category = cms.uint32(0),
179 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),
180 variable = cms.string(
"pt"),
183 workingPoints = cms.vstring(
194 _rerunIsolationOldDMMVArun2017v1Task = cms.Task(
195 getattr(self.process,_byIsolationOldDMMVArun2017v1raw),
196 getattr(self.process,_byIsolationOldDMMVArun2017v1)
198 _rerunMvaIsolationTask.add(_rerunIsolationOldDMMVArun2017v1Task)
199 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMMVArun2017v1Task)
201 tauIDSources.byIsolationMVArun2017v1DBoldDMwLTraw2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"raw")
202 tauIDSources.byVVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff95")
203 tauIDSources.byVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff90")
204 tauIDSources.byLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff80")
205 tauIDSources.byMediumIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff70")
206 tauIDSources.byTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff60")
207 tauIDSources.byVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff50")
208 tauIDSources.byVVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff40")
211 if "2017v2" in self.toKeep:
212 self.tauIdDiscrMVA_2017_version =
"v2" 213 self.tauIdDiscrMVA_trainings_run2_2017 = {
214 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
216 self.tauIdDiscrMVA_WPs_run2_2017 = {
217 'tauIdMVAIsoDBoldDMwLT2017' : {
218 'Eff95' :
"DBoldDMwLTEff95",
219 'Eff90' :
"DBoldDMwLTEff90",
220 'Eff80' :
"DBoldDMwLTEff80",
221 'Eff70' :
"DBoldDMwLTEff70",
222 'Eff60' :
"DBoldDMwLTEff60",
223 'Eff50' :
"DBoldDMwLTEff50",
224 'Eff40' :
"DBoldDMwLTEff40" 228 if not self.is_above_cmssw_version(9, 4, 5, self.debug):
229 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")
230 self.loadMVA_WPs_run2_2017()
232 _byIsolationOldDMMVArun2017v2raw =
"rerunDiscriminationByIsolationOldDMMVArun2017v2raw"+self.postfix
233 setattr(self.process,_byIsolationOldDMMVArun2017v2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
234 PATTauProducer = self.originalTauName,
235 Prediscriminants = noPrediscriminants,
236 loadMVAfromDB = cms.bool(
True),
237 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),
238 mvaOpt = cms.string(
"DBoldDMwLTwGJ"),
239 verbosity = cms.int32(0)
242 _byIsolationOldDMMVArun2017v2 =
"rerunDiscriminationByIsolationOldDMMVArun2017v2"+self.postfix
243 setattr(self.process,_byIsolationOldDMMVArun2017v2,patDiscriminationByIsolationMVArun2v1.clone(
244 PATTauProducer = self.originalTauName,
245 Prediscriminants = noPrediscriminants,
246 toMultiplex = _byIsolationOldDMMVArun2017v2raw,
247 loadMVAfromDB = cms.bool(
True),
248 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"),
251 category = cms.uint32(0),
252 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),
253 variable = cms.string(
"pt"),
256 workingPoints = cms.vstring(
265 verbosity = cms.int32(0)
268 _rerunIsolationOldDMMVArun2017v2Task = cms.Task(
269 getattr(self.process,_byIsolationOldDMMVArun2017v2raw),
270 getattr(self.process,_byIsolationOldDMMVArun2017v2)
272 _rerunMvaIsolationTask.add(_rerunIsolationOldDMMVArun2017v2Task)
273 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMMVArun2017v2Task)
275 tauIDSources.byIsolationMVArun2017v2DBoldDMwLTraw2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"raw")
276 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff95")
277 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff90")
278 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff80")
279 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff70")
280 tauIDSources.byTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff60")
281 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff50")
282 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff40")
284 if "newDM2017v2" in self.toKeep:
285 self.tauIdDiscrMVA_2017_version =
"v2" 286 self.tauIdDiscrMVA_trainings_run2_2017 = {
287 'tauIdMVAIsoDBnewDMwLT2017' :
"tauIdMVAIsoDBnewDMwLT2017",
289 self.tauIdDiscrMVA_WPs_run2_2017 = {
290 'tauIdMVAIsoDBnewDMwLT2017' : {
291 'Eff95' :
"DBnewDMwLTEff95",
292 'Eff90' :
"DBnewDMwLTEff90",
293 'Eff80' :
"DBnewDMwLTEff80",
294 'Eff70' :
"DBnewDMwLTEff70",
295 'Eff60' :
"DBnewDMwLTEff60",
296 'Eff50' :
"DBnewDMwLTEff50",
297 'Eff40' :
"DBnewDMwLTEff40" 301 if not self.is_above_cmssw_version(9, 4, 5, self.debug):
302 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")
303 self.loadMVA_WPs_run2_2017()
305 _byIsolationNewDMMVArun2017v2raw =
"rerunDiscriminationByIsolationNewDMMVArun2017v2raw"+self.postfix
306 setattr(self.process,_byIsolationNewDMMVArun2017v2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
307 PATTauProducer = self.originalTauName,
308 Prediscriminants = noPrediscriminants,
309 loadMVAfromDB = cms.bool(
True),
310 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),
311 mvaOpt = cms.string(
"DBnewDMwLTwGJ"),
312 verbosity = cms.int32(0)
315 _byIsolationNewDMMVArun2017v2 =
"rerunDiscriminationByIsolationNewDMMVArun2017v2"+self.postfix
316 setattr(self.process,_byIsolationNewDMMVArun2017v2,patDiscriminationByIsolationMVArun2v1.clone(
317 PATTauProducer = self.originalTauName,
318 Prediscriminants = noPrediscriminants,
319 toMultiplex = _byIsolationNewDMMVArun2017v2raw,
320 loadMVAfromDB = cms.bool(
True),
321 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"),
324 category = cms.uint32(0),
325 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),
326 variable = cms.string(
"pt"),
329 workingPoints = cms.vstring(
338 verbosity = cms.int32(0)
341 _rerunIsolationNewDMMVArun2017v2Task = cms.Task(
342 getattr(self.process,_byIsolationNewDMMVArun2017v2raw),
343 getattr(self.process,_byIsolationNewDMMVArun2017v2)
345 _rerunMvaIsolationTask.add(_rerunIsolationNewDMMVArun2017v2Task)
346 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationNewDMMVArun2017v2Task)
348 tauIDSources.byIsolationMVArun2017v2DBnewDMwLTraw2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"raw")
349 tauIDSources.byVVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff95")
350 tauIDSources.byVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff90")
351 tauIDSources.byLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff80")
352 tauIDSources.byMediumIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff70")
353 tauIDSources.byTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff60")
354 tauIDSources.byVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff50")
355 tauIDSources.byVVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff40")
357 if "dR0p32017v2" in self.toKeep:
358 self.tauIdDiscrMVA_2017_version =
"v2" 359 self.tauIdDiscrMVA_trainings_run2_2017 = {
360 'tauIdMVAIsoDBoldDMdR0p3wLT2017' :
"tauIdMVAIsoDBoldDMdR0p3wLT2017",
362 self.tauIdDiscrMVA_WPs_run2_2017 = {
363 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : {
364 'Eff95' :
"DBoldDMdR0p3wLTEff95",
365 'Eff90' :
"DBoldDMdR0p3wLTEff90",
366 'Eff80' :
"DBoldDMdR0p3wLTEff80",
367 'Eff70' :
"DBoldDMdR0p3wLTEff70",
368 'Eff60' :
"DBoldDMdR0p3wLTEff60",
369 'Eff50' :
"DBoldDMdR0p3wLTEff50",
370 'Eff40' :
"DBoldDMdR0p3wLTEff40" 374 if not self.is_above_cmssw_version(9, 4, 5, self.debug):
375 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")
376 self.loadMVA_WPs_run2_2017()
378 _byIsolationOldDMdR0p3MVArun2017v2raw =
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw"+self.postfix
379 setattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
380 PATTauProducer = self.originalTauName,
381 Prediscriminants = noPrediscriminants,
382 loadMVAfromDB = cms.bool(
True),
383 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
384 mvaOpt = cms.string(
"DBoldDMwLTwGJ"),
385 srcChargedIsoPtSum = cms.string(
'chargedIsoPtSumdR03'),
386 srcFootprintCorrection = cms.string(
'footprintCorrectiondR03'),
387 srcNeutralIsoPtSum = cms.string(
'neutralIsoPtSumdR03'),
388 srcPhotonPtSumOutsideSignalCone = cms.string(
'photonPtSumOutsideSignalConedR03'),
389 verbosity = cms.int32(0)
392 _byIsolationOldDMdR0p3MVArun2017v2 =
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2"+self.postfix
393 setattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2,patDiscriminationByIsolationMVArun2v1.clone(
394 PATTauProducer = self.originalTauName,
395 Prediscriminants = noPrediscriminants,
396 toMultiplex = _byIsolationOldDMdR0p3MVArun2017v2raw,
397 loadMVAfromDB = cms.bool(
True),
398 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"),
401 category = cms.uint32(0),
402 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
403 variable = cms.string(
"pt"),
406 workingPoints = cms.vstring(
415 verbosity = cms.int32(0)
418 _rerunIsolationOldDMdR0p3MVArun2017v2Task = cms.Task(
419 getattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2raw),
420 getattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2)
422 _rerunMvaIsolationTask.add(_rerunIsolationOldDMdR0p3MVArun2017v2Task)
423 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMdR0p3MVArun2017v2Task)
425 tauIDSources.byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"raw")
426 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff95")
427 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff90")
428 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff80")
429 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff70")
430 tauIDSources.byTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff60")
431 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff50")
432 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff40")
461 if "2016v1" in self.toKeep:
462 _byIsolationOldDMMVArun2016v1raw =
"rerunDiscriminationByIsolationOldDMMVArun2v1raw"+self.postfix
463 setattr(self.process,_byIsolationOldDMMVArun2016v1raw,patDiscriminationByIsolationMVArun2v1raw.clone(
464 PATTauProducer = self.originalTauName,
465 Prediscriminants = noPrediscriminants,
466 loadMVAfromDB = cms.bool(
True),
467 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
468 mvaOpt = cms.string(
"DBoldDMwLT"),
469 verbosity = cms.int32(0)
472 _byIsolationOldDMMVArun2016v1 =
"rerunDiscriminationByIsolationOldDMMVArun2v1"+self.postfix
473 setattr(self.process,_byIsolationOldDMMVArun2016v1,patDiscriminationByIsolationMVArun2v1.clone(
474 PATTauProducer = self.originalTauName,
475 Prediscriminants = noPrediscriminants,
476 toMultiplex = _byIsolationOldDMMVArun2016v1raw,
477 loadMVAfromDB = cms.bool(
True),
478 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_mvaOutput_normalization"),
481 category = cms.uint32(0),
482 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
483 variable = cms.string(
"pt"),
486 workingPoints = cms.vstring(
496 _rerunIsolationOldDMMVArun2016v1Task = cms.Task(
497 getattr(self.process,_byIsolationOldDMMVArun2016v1raw),
498 getattr(self.process,_byIsolationOldDMMVArun2016v1)
500 _rerunMvaIsolationTask.add(_rerunIsolationOldDMMVArun2016v1Task)
501 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMMVArun2016v1Task)
503 tauIDSources.byIsolationMVArun2v1DBoldDMwLTraw2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"raw")
504 tauIDSources.byVLooseIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff90")
505 tauIDSources.byLooseIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff80")
506 tauIDSources.byMediumIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff70")
507 tauIDSources.byTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff60")
508 tauIDSources.byVTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff50")
509 tauIDSources.byVVTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff40")
512 if "newDM2016v1" in self.toKeep:
513 _byIsolationNewDMMVArun2016v1raw =
"rerunDiscriminationByIsolationNewDMMVArun2v1raw"+self.postfix
514 setattr(self.process,_byIsolationNewDMMVArun2016v1raw,patDiscriminationByIsolationMVArun2v1raw.clone(
515 PATTauProducer = self.originalTauName,
516 Prediscriminants = noPrediscriminants,
517 loadMVAfromDB = cms.bool(
True),
518 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1"),
519 mvaOpt = cms.string(
"DBnewDMwLT"),
520 verbosity = cms.int32(0)
523 _byIsolationNewDMMVArun2016v1 =
"rerunDiscriminationByIsolationNewDMMVArun2v1"+self.postfix
524 setattr(self.process,_byIsolationNewDMMVArun2016v1,patDiscriminationByIsolationMVArun2v1.clone(
525 PATTauProducer = self.originalTauName,
526 Prediscriminants = noPrediscriminants,
527 toMultiplex = _byIsolationNewDMMVArun2016v1raw,
528 loadMVAfromDB = cms.bool(
True),
529 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_mvaOutput_normalization"),
532 category = cms.uint32(0),
533 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff90"),
534 variable = cms.string(
"pt"),
537 workingPoints = cms.vstring(
547 _rerunIsolationNewDMMVArun2016v1Task = cms.Task(
548 getattr(self.process,_byIsolationNewDMMVArun2016v1raw),
549 getattr(self.process,_byIsolationNewDMMVArun2016v1)
551 _rerunMvaIsolationTask.add(_rerunIsolationNewDMMVArun2016v1Task)
552 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationNewDMMVArun2016v1Task)
554 tauIDSources.byIsolationMVArun2v1DBnewDMwLTraw2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"raw")
555 tauIDSources.byVLooseIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff90")
556 tauIDSources.byLooseIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff80")
557 tauIDSources.byMediumIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff70")
558 tauIDSources.byTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff60")
559 tauIDSources.byVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff50")
560 tauIDSources.byVVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff40")
562 if "deepTau2017v2" in self.toKeep:
563 if self.debug:
print (
"Adding DeepTau v2 IDs")
565 _deepTauName =
"deepTau2017v2" 566 workingPoints_ = WORKING_POINTS_v2p1
569 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
570 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
571 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
573 full_version = self.getDeepTauVersion(file_names[0])
574 setattr(self.process,_deepTauName+self.postfix,DeepTau.clone(
575 Prediscriminants = noPrediscriminants,
576 taus = self.originalTauName,
577 graph_file = file_names,
578 year = full_version[0],
579 version = full_version[1],
583 self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
585 _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
586 _rerunMvaIsolationTask.add(_deepTauProducer)
587 _rerunMvaIsolationSequence += _deepTauProducer
590 if "deepTau2017v2p1" in self.toKeep:
591 if self.debug:
print (
"Adding DeepTau v2p1 IDs")
593 _deepTauName =
"deepTau2017v2p1" 594 workingPoints_ = WORKING_POINTS_v2p1
597 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
598 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
599 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
601 full_version = self.getDeepTauVersion(file_names[0])
602 setattr(self.process,_deepTauName+self.postfix,DeepTau.clone(
603 Prediscriminants = noPrediscriminants,
604 taus = self.originalTauName,
605 graph_file = file_names,
606 year = full_version[0],
607 version = full_version[1],
609 disable_dxy_pca =
True 612 self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
614 _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
615 _rerunMvaIsolationTask.add(_deepTauProducer)
616 _rerunMvaIsolationSequence += _deepTauProducer
618 if "deepTau2018v2p5" in self.toKeep:
619 if self.debug:
print (
"Adding DeepTau v2p5 IDs")
621 _deepTauName =
"deepTau2018v2p5" 622 workingPoints_ = WORKING_POINTS_v2p5
625 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_core.pb',
626 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_inner.pb',
627 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_outer.pb',
629 full_version = self.getDeepTauVersion(file_names[0])
630 setattr(self.process,_deepTauName+self.postfix,DeepTau.clone(
631 Prediscriminants = noPrediscriminants,
632 taus = self.originalTauName,
633 graph_file = file_names,
634 year = full_version[0],
635 version = full_version[1],
636 sub_version = full_version[2],
637 disable_dxy_pca =
True,
638 disable_hcalFraction_workaround =
True,
639 disable_CellIndex_workaround =
True 642 self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
644 _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
645 _rerunMvaIsolationTask.add(_deepTauProducer)
646 _rerunMvaIsolationSequence += _deepTauProducer
648 if "deepTau2026v2p5" in self.toKeep:
649 if self.debug:
print (
"Adding Phase2 DeepTau v2p5 IDs")
651 _deepTauName =
"deepTau2026v2p5" 652 workingPoints_ = WORKING_POINTS_PHASEII_v2p5
655 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2026v2p5_core.pb',
656 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2026v2p5_inner.pb',
657 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2026v2p5_outer.pb',
659 full_version = self.getDeepTauVersion(file_names[0])
660 setattr(self.process,_deepTauName+self.postfix,DeepTau.clone(
661 Prediscriminants = noPrediscriminants,
662 taus = self.originalTauName,
663 graph_file = file_names,
664 year = full_version[0],
665 version = full_version[1],
666 sub_version = full_version[2],
667 disable_dxy_pca =
True,
668 disable_hcalFraction_workaround =
True,
669 disable_CellIndex_workaround =
True 672 from RecoTauTag.RecoTau.mergedPhase2SlimmedElectronsForTauId_cff
import mergedSlimmedElectronsForTauId
673 if not hasattr(self.process,
"mergedSlimmedElectronsForTauId"):
674 self.process.mergedSlimmedElectronsForTauId = mergedSlimmedElectronsForTauId
675 setattr(getattr(self.process, _deepTauName+self.postfix),
"electrons", cms.InputTag(
"mergedSlimmedElectronsForTauId"))
676 setattr(getattr(self.process, _deepTauName+self.postfix),
"vertices", cms.InputTag(
"offlineSlimmedPrimaryVertices4D"))
678 self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
680 _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
681 _rerunMvaIsolationTask.add(self.process.mergedSlimmedElectronsForTauId)
682 _rerunMvaIsolationTask.add(_deepTauProducer)
683 _rerunMvaIsolationSequence += self.process.mergedSlimmedElectronsForTauId
684 _rerunMvaIsolationSequence += _deepTauProducer
686 if "againstEle2018" in self.toKeep:
687 antiElectronDiscrMVA6_version =
"MVA6v3_noeveto" 691 _byElectronRejectionMVA62018Raw =
"patTauDiscriminationByElectronRejectionMVA62018Raw"+self.postfix
692 setattr(self.process,_byElectronRejectionMVA62018Raw,patTauDiscriminationAgainstElectronMVA6.clone(
693 PATTauProducer = self.originalTauName,
694 Prediscriminants = noPrediscriminants,
695 srcElectrons = cms.InputTag(
'slimmedElectrons'),
696 vetoEcalCracks = cms.bool(
False),
697 mvaName_NoEleMatch_wGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL',
698 mvaName_NoEleMatch_wGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC',
699 mvaName_NoEleMatch_woGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL',
700 mvaName_NoEleMatch_woGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC',
701 mvaName_wGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL',
702 mvaName_wGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC',
703 mvaName_woGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL',
704 mvaName_woGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC' 708 _byElectronRejectionMVA62018 =
"patTauDiscriminationByElectronRejectionMVA62018"+self.postfix
709 setattr(self.process,
"patTauDiscriminationByElectronRejectionMVA62018"+self.postfix,patTauDiscriminantCutMultiplexer.clone(
710 PATTauProducer = self.originalTauName,
711 Prediscriminants = noPrediscriminants,
712 toMultiplex = _byElectronRejectionMVA62018Raw,
715 category = cms.uint32(0),
716 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL'),
717 variable = cms.string(
'pt')
720 category = cms.uint32(2),
721 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL'),
722 variable = cms.string(
'pt')
725 category = cms.uint32(5),
726 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL'),
727 variable = cms.string(
'pt')
730 category = cms.uint32(7),
731 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL'),
732 variable = cms.string(
'pt')
735 category = cms.uint32(8),
736 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC'),
737 variable = cms.string(
'pt')
740 category = cms.uint32(10),
741 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC'),
742 variable = cms.string(
'pt')
745 category = cms.uint32(13),
746 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC'),
747 variable = cms.string(
'pt')
750 category = cms.uint32(15),
751 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC'),
752 variable = cms.string(
'pt')
755 workingPoints = cms.vstring(
764 _patTauDiscriminationByElectronRejectionMVA62018Task = cms.Task(
765 getattr(self.process,_byElectronRejectionMVA62018Raw),
766 getattr(self.process,_byElectronRejectionMVA62018)
768 _rerunMvaIsolationTask.add(_patTauDiscriminationByElectronRejectionMVA62018Task)
769 _rerunMvaIsolationSequence += cms.Sequence(_patTauDiscriminationByElectronRejectionMVA62018Task)
771 _againstElectronTauIDSources = cms.PSet(
772 againstElectronMVA6Raw2018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"raw"),
773 againstElectronMVA6category2018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"category"),
774 againstElectronVLooseMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"_WPeff98"),
775 againstElectronLooseMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"_WPeff90"),
776 againstElectronMediumMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"_WPeff80"),
777 againstElectronTightMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"_WPeff70"),
778 againstElectronVTightMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"_WPeff60")
780 _tauIDSourcesWithAgainistEle = cms.PSet(
781 tauIDSources.clone(),
782 _againstElectronTauIDSources
784 tauIDSources =_tauIDSourcesWithAgainistEle.clone()
786 if "newDMPhase2v1" in self.toKeep:
787 if self.debug:
print (
"Adding newDMPhase2v1 ID")
789 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)))
790 _byIsolationNewDMMVAPhase2raw =
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2raw"+self.postfix
791 setattr(self.process,_byIsolationNewDMMVAPhase2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
792 PATTauProducer = self.originalTauName,
793 Prediscriminants = noPrediscriminants,
794 loadMVAfromDB =
True,
795 mvaName =
'RecoTauTag_tauIdMVAIsoPhase2',
796 mvaOpt =
'DBnewDMwLTwGJPhase2',
800 _byIsolationNewDMMVAPhase2 =
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2"+self.postfix
801 setattr(self.process,_byIsolationNewDMMVAPhase2,patDiscriminationByIsolationMVArun2v1.clone(
802 PATTauProducer = self.originalTauName,
803 Prediscriminants = noPrediscriminants,
804 toMultiplex = _byIsolationNewDMMVAPhase2raw,
805 loadMVAfromDB =
True,
806 mvaOutput_normalization =
'RecoTauTag_tauIdMVAIsoPhase2_mvaOutput_normalization',
809 category = cms.uint32(0),
810 cut = cms.string(
"RecoTauTag_tauIdMVAIsoPhase2"),
811 variable = cms.string(
"pt"),
814 workingPoints = cms.vstring(
824 _rerunIsolationMVADBnewDMwLTPhase2Task = cms.Task(
825 getattr(self.process,_byIsolationNewDMMVAPhase2raw),
826 getattr(self.process,_byIsolationNewDMMVAPhase2)
828 _rerunMvaIsolationTask.add(_rerunIsolationMVADBnewDMwLTPhase2Task)
829 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationMVADBnewDMwLTPhase2Task)
831 tauIDSources.byIsolationMVADBnewDMwLTPhase2raw =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"raw")
832 tauIDSources.byVVLooseIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_VVLoose")
833 tauIDSources.byVLooseIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_VLoose")
834 tauIDSources.byLooseIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_Loose")
835 tauIDSources.byMediumIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_Medium")
836 tauIDSources.byTightIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_Tight")
837 tauIDSources.byVTightIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_VTight")
838 tauIDSources.byVVTightIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_VVTight")
840 if "againstElePhase2v1" in self.toKeep:
841 if self.debug:
print (
"Adding anti-e Phase2v1 ID")
844 from RecoTauTag.RecoTau.PATTauDiscriminationAgainstElectronMVA6Phase2_cff
import patTauDiscriminationAgainstElectronMVA6Phase2Raw, patTauDiscriminationAgainstElectronMVA6Phase2, mergedSlimmedElectronsForTauId
845 _byElectronRejectionMVA6Phase2v1Raw =
"patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw"+self.postfix
846 setattr(self.process,_byElectronRejectionMVA6Phase2v1Raw,patTauDiscriminationAgainstElectronMVA6Phase2Raw.clone(
847 PATTauProducer = self.originalTauName,
848 Prediscriminants = noPrediscriminants
851 _byElectronRejectionMVA6Phase2v1 =
"patTauDiscriminationByElectronRejectionMVA6Phase2v1"+self.postfix
852 setattr(self.process,_byElectronRejectionMVA6Phase2v1,patTauDiscriminationAgainstElectronMVA6Phase2.clone(
853 PATTauProducer = self.originalTauName,
854 Prediscriminants = noPrediscriminants,
855 toMultiplex = _byElectronRejectionMVA6Phase2v1Raw
858 if not hasattr(self.process,
"mergedSlimmedElectronsForTauId"):
859 self.process.mergedSlimmedElectronsForTauId = mergedSlimmedElectronsForTauId
860 _patTauDiscriminationByElectronRejectionMVA6Phase2v1Task = cms.Task(
861 self.process.mergedSlimmedElectronsForTauId,
862 getattr(self.process,_byElectronRejectionMVA6Phase2v1Raw),
863 getattr(self.process,_byElectronRejectionMVA6Phase2v1)
865 _rerunMvaIsolationTask.add(_patTauDiscriminationByElectronRejectionMVA6Phase2v1Task)
866 _rerunMvaIsolationSequence += cms.Sequence(_patTauDiscriminationByElectronRejectionMVA6Phase2v1Task)
868 _againstElectronTauIDPhase2v1Sources = cms.PSet(
869 againstElectronMVA6RawPhase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"raw"),
870 againstElectronMVA6categoryPhase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"category"),
871 againstElectronVLooseMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"_VLoose"),
872 againstElectronLooseMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"_Loose"),
873 againstElectronMediumMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"_Medium"),
874 againstElectronTightMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"_Tight"),
875 againstElectronVTightMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"_VTight")
877 _tauIDSourcesWithAgainistElePhase2v1 = cms.PSet(
878 tauIDSources.clone(),
879 _againstElectronTauIDPhase2v1Sources
881 tauIDSources =_tauIDSourcesWithAgainistElePhase2v1.clone()
883 if self.debug:
print(
'Embedding new TauIDs into \"'+self.updatedTauName+
'\"')
884 if not hasattr(self.process, self.updatedTauName):
885 embedID = cms.EDProducer(
"PATTauIDEmbedder",
886 src = cms.InputTag(self.originalTauName),
887 tauIDSources = tauIDSources
889 setattr(self.process, self.updatedTauName, embedID)
891 tauIDSources = cms.PSet(
892 getattr(self.process, self.updatedTauName).tauIDSources,
894 getattr(self.process, self.updatedTauName).tauIDSources = tauIDSources
895 if not hasattr(self.process,
"rerunMvaIsolationTask"+self.postfix):
896 setattr(self.process,
"rerunMvaIsolationTask"+self.postfix,_rerunMvaIsolationTask)
898 _updatedRerunMvaIsolationTask = getattr(self.process,
"rerunMvaIsolationTask"+self.postfix)
899 _updatedRerunMvaIsolationTask.add(_rerunMvaIsolationTask)
900 setattr(self.process,
"rerunMvaIsolationTask"+self.postfix,_updatedRerunMvaIsolationTask)
901 if not hasattr(self.process,
"rerunMvaIsolationSequence"+self.postfix):
902 setattr(self.process,
"rerunMvaIsolationSequence"+self.postfix,_rerunMvaIsolationSequence)
904 _updatedRerunMvaIsolationSequence = getattr(self.process,
"rerunMvaIsolationSequence"+self.postfix)
905 _updatedRerunMvaIsolationSequence += _rerunMvaIsolationSequence
906 setattr(self.process,
"rerunMvaIsolationSequence"+self.postfix,_updatedRerunMvaIsolationSequence)
def tauIDMVAinputs(module, wp)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)