132 _rerunMvaIsolationTask = cms.Task()
133 _rerunMvaIsolationSequence = cms.Sequence()
134 tauIDSources = cms.PSet()
137 if "2017v1" in self.toKeep:
138 self.tauIdDiscrMVA_2017_version =
"v1"
139 self.tauIdDiscrMVA_trainings_run2_2017 = {
140 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
142 self.tauIdDiscrMVA_WPs_run2_2017 = {
143 'tauIdMVAIsoDBoldDMwLT2017' : {
144 'Eff95' :
"DBoldDMwLTEff95",
145 'Eff90' :
"DBoldDMwLTEff90",
146 'Eff80' :
"DBoldDMwLTEff80",
147 'Eff70' :
"DBoldDMwLTEff70",
148 'Eff60' :
"DBoldDMwLTEff60",
149 'Eff50' :
"DBoldDMwLTEff50",
150 'Eff40' :
"DBoldDMwLTEff40"
154 if not self.is_above_cmssw_version(9, 4, 4, self.debug):
155 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")
156 self.loadMVA_WPs_run2_2017()
158 _byIsolationOldDMMVArun2017v1raw =
"rerunDiscriminationByIsolationOldDMMVArun2017v1raw"+self.postfix
159 setattr(self.process,_byIsolationOldDMMVArun2017v1raw,patDiscriminationByIsolationMVArun2v1raw.clone(
160 PATTauProducer = self.originalTauName,
161 Prediscriminants = noPrediscriminants,
162 loadMVAfromDB = cms.bool(
True),
163 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),
164 mvaOpt = cms.string(
"DBoldDMwLTwGJ"),
165 verbosity = cms.int32(0)
168 _byIsolationOldDMMVArun2017v1 =
"rerunDiscriminationByIsolationOldDMMVArun2017v1"+self.postfix
169 setattr(self.process,_byIsolationOldDMMVArun2017v1,patDiscriminationByIsolationMVArun2v1.clone(
170 PATTauProducer = self.originalTauName,
171 Prediscriminants = noPrediscriminants,
172 toMultiplex = _byIsolationOldDMMVArun2017v1raw,
173 loadMVAfromDB = cms.bool(
True),
174 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"),
177 category = cms.uint32(0),
178 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),
179 variable = cms.string(
"pt"),
182 workingPoints = cms.vstring(
193 _rerunIsolationOldDMMVArun2017v1Task = cms.Task(
194 getattr(self.process,_byIsolationOldDMMVArun2017v1raw),
195 getattr(self.process,_byIsolationOldDMMVArun2017v1)
197 _rerunMvaIsolationTask.add(_rerunIsolationOldDMMVArun2017v1Task)
198 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMMVArun2017v1Task)
200 tauIDSources.byIsolationMVArun2017v1DBoldDMwLTraw2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"raw")
201 tauIDSources.byVVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff95")
202 tauIDSources.byVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff90")
203 tauIDSources.byLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff80")
204 tauIDSources.byMediumIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff70")
205 tauIDSources.byTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff60")
206 tauIDSources.byVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff50")
207 tauIDSources.byVVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1,
"_WPEff40")
210 if "2017v2" in self.toKeep:
211 self.tauIdDiscrMVA_2017_version =
"v2"
212 self.tauIdDiscrMVA_trainings_run2_2017 = {
213 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
215 self.tauIdDiscrMVA_WPs_run2_2017 = {
216 'tauIdMVAIsoDBoldDMwLT2017' : {
217 'Eff95' :
"DBoldDMwLTEff95",
218 'Eff90' :
"DBoldDMwLTEff90",
219 'Eff80' :
"DBoldDMwLTEff80",
220 'Eff70' :
"DBoldDMwLTEff70",
221 'Eff60' :
"DBoldDMwLTEff60",
222 'Eff50' :
"DBoldDMwLTEff50",
223 'Eff40' :
"DBoldDMwLTEff40"
227 if not self.is_above_cmssw_version(9, 4, 5, self.debug):
228 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")
229 self.loadMVA_WPs_run2_2017()
231 _byIsolationOldDMMVArun2017v2raw =
"rerunDiscriminationByIsolationOldDMMVArun2017v2raw"+self.postfix
232 setattr(self.process,_byIsolationOldDMMVArun2017v2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
233 PATTauProducer = self.originalTauName,
234 Prediscriminants = noPrediscriminants,
235 loadMVAfromDB = cms.bool(
True),
236 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),
237 mvaOpt = cms.string(
"DBoldDMwLTwGJ"),
238 verbosity = cms.int32(0)
241 _byIsolationOldDMMVArun2017v2 =
"rerunDiscriminationByIsolationOldDMMVArun2017v2"+self.postfix
242 setattr(self.process,_byIsolationOldDMMVArun2017v2,patDiscriminationByIsolationMVArun2v1.clone(
243 PATTauProducer = self.originalTauName,
244 Prediscriminants = noPrediscriminants,
245 toMultiplex = _byIsolationOldDMMVArun2017v2raw,
246 loadMVAfromDB = cms.bool(
True),
247 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"),
250 category = cms.uint32(0),
251 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),
252 variable = cms.string(
"pt"),
255 workingPoints = cms.vstring(
264 verbosity = cms.int32(0)
267 _rerunIsolationOldDMMVArun2017v2Task = cms.Task(
268 getattr(self.process,_byIsolationOldDMMVArun2017v2raw),
269 getattr(self.process,_byIsolationOldDMMVArun2017v2)
271 _rerunMvaIsolationTask.add(_rerunIsolationOldDMMVArun2017v2Task)
272 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMMVArun2017v2Task)
274 tauIDSources.byIsolationMVArun2017v2DBoldDMwLTraw2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"raw")
275 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff95")
276 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff90")
277 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff80")
278 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff70")
279 tauIDSources.byTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff60")
280 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff50")
281 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2,
"_WPEff40")
283 if "newDM2017v2" in self.toKeep:
284 self.tauIdDiscrMVA_2017_version =
"v2"
285 self.tauIdDiscrMVA_trainings_run2_2017 = {
286 'tauIdMVAIsoDBnewDMwLT2017' :
"tauIdMVAIsoDBnewDMwLT2017",
288 self.tauIdDiscrMVA_WPs_run2_2017 = {
289 'tauIdMVAIsoDBnewDMwLT2017' : {
290 'Eff95' :
"DBnewDMwLTEff95",
291 'Eff90' :
"DBnewDMwLTEff90",
292 'Eff80' :
"DBnewDMwLTEff80",
293 'Eff70' :
"DBnewDMwLTEff70",
294 'Eff60' :
"DBnewDMwLTEff60",
295 'Eff50' :
"DBnewDMwLTEff50",
296 'Eff40' :
"DBnewDMwLTEff40"
300 if not self.is_above_cmssw_version(9, 4, 5, self.debug):
301 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")
302 self.loadMVA_WPs_run2_2017()
304 _byIsolationNewDMMVArun2017v2raw =
"rerunDiscriminationByIsolationNewDMMVArun2017v2raw"+self.postfix
305 setattr(self.process,_byIsolationNewDMMVArun2017v2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
306 PATTauProducer = self.originalTauName,
307 Prediscriminants = noPrediscriminants,
308 loadMVAfromDB = cms.bool(
True),
309 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),
310 mvaOpt = cms.string(
"DBnewDMwLTwGJ"),
311 verbosity = cms.int32(0)
314 _byIsolationNewDMMVArun2017v2 =
"rerunDiscriminationByIsolationNewDMMVArun2017v2"+self.postfix
315 setattr(self.process,_byIsolationNewDMMVArun2017v2,patDiscriminationByIsolationMVArun2v1.clone(
316 PATTauProducer = self.originalTauName,
317 Prediscriminants = noPrediscriminants,
318 toMultiplex = _byIsolationNewDMMVArun2017v2raw,
319 loadMVAfromDB = cms.bool(
True),
320 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"),
323 category = cms.uint32(0),
324 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),
325 variable = cms.string(
"pt"),
328 workingPoints = cms.vstring(
337 verbosity = cms.int32(0)
340 _rerunIsolationNewDMMVArun2017v2Task = cms.Task(
341 getattr(self.process,_byIsolationNewDMMVArun2017v2raw),
342 getattr(self.process,_byIsolationNewDMMVArun2017v2)
344 _rerunMvaIsolationTask.add(_rerunIsolationNewDMMVArun2017v2Task)
345 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationNewDMMVArun2017v2Task)
347 tauIDSources.byIsolationMVArun2017v2DBnewDMwLTraw2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"raw")
348 tauIDSources.byVVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff95")
349 tauIDSources.byVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff90")
350 tauIDSources.byLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff80")
351 tauIDSources.byMediumIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff70")
352 tauIDSources.byTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff60")
353 tauIDSources.byVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff50")
354 tauIDSources.byVVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2,
"_WPEff40")
356 if "dR0p32017v2" in self.toKeep:
357 self.tauIdDiscrMVA_2017_version =
"v2"
358 self.tauIdDiscrMVA_trainings_run2_2017 = {
359 'tauIdMVAIsoDBoldDMdR0p3wLT2017' :
"tauIdMVAIsoDBoldDMdR0p3wLT2017",
361 self.tauIdDiscrMVA_WPs_run2_2017 = {
362 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : {
363 'Eff95' :
"DBoldDMdR0p3wLTEff95",
364 'Eff90' :
"DBoldDMdR0p3wLTEff90",
365 'Eff80' :
"DBoldDMdR0p3wLTEff80",
366 'Eff70' :
"DBoldDMdR0p3wLTEff70",
367 'Eff60' :
"DBoldDMdR0p3wLTEff60",
368 'Eff50' :
"DBoldDMdR0p3wLTEff50",
369 'Eff40' :
"DBoldDMdR0p3wLTEff40"
373 if not self.is_above_cmssw_version(9, 4, 5, self.debug):
374 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")
375 self.loadMVA_WPs_run2_2017()
377 _byIsolationOldDMdR0p3MVArun2017v2raw =
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw"+self.postfix
378 setattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
379 PATTauProducer = self.originalTauName,
380 Prediscriminants = noPrediscriminants,
381 loadMVAfromDB = cms.bool(
True),
382 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
383 mvaOpt = cms.string(
"DBoldDMwLTwGJ"),
384 srcChargedIsoPtSum = cms.string(
'chargedIsoPtSumdR03'),
385 srcFootprintCorrection = cms.string(
'footprintCorrectiondR03'),
386 srcNeutralIsoPtSum = cms.string(
'neutralIsoPtSumdR03'),
387 srcPhotonPtSumOutsideSignalCone = cms.string(
'photonPtSumOutsideSignalConedR03'),
388 verbosity = cms.int32(0)
391 _byIsolationOldDMdR0p3MVArun2017v2 =
"rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2"+self.postfix
392 setattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2,patDiscriminationByIsolationMVArun2v1.clone(
393 PATTauProducer = self.originalTauName,
394 Prediscriminants = noPrediscriminants,
395 toMultiplex = _byIsolationOldDMdR0p3MVArun2017v2raw,
396 loadMVAfromDB = cms.bool(
True),
397 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"),
400 category = cms.uint32(0),
401 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
402 variable = cms.string(
"pt"),
405 workingPoints = cms.vstring(
414 verbosity = cms.int32(0)
417 _rerunIsolationOldDMdR0p3MVArun2017v2Task = cms.Task(
418 getattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2raw),
419 getattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2)
421 _rerunMvaIsolationTask.add(_rerunIsolationOldDMdR0p3MVArun2017v2Task)
422 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMdR0p3MVArun2017v2Task)
424 tauIDSources.byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"raw")
425 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff95")
426 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff90")
427 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff80")
428 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff70")
429 tauIDSources.byTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff60")
430 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff50")
431 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2,
"_WPEff40")
460 if "2016v1" in self.toKeep:
461 _byIsolationOldDMMVArun2016v1raw =
"rerunDiscriminationByIsolationOldDMMVArun2v1raw"+self.postfix
462 setattr(self.process,_byIsolationOldDMMVArun2016v1raw,patDiscriminationByIsolationMVArun2v1raw.clone(
463 PATTauProducer = self.originalTauName,
464 Prediscriminants = noPrediscriminants,
465 loadMVAfromDB = cms.bool(
True),
466 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
467 mvaOpt = cms.string(
"DBoldDMwLT"),
468 verbosity = cms.int32(0)
471 _byIsolationOldDMMVArun2016v1 =
"rerunDiscriminationByIsolationOldDMMVArun2v1"+self.postfix
472 setattr(self.process,_byIsolationOldDMMVArun2016v1,patDiscriminationByIsolationMVArun2v1.clone(
473 PATTauProducer = self.originalTauName,
474 Prediscriminants = noPrediscriminants,
475 toMultiplex = _byIsolationOldDMMVArun2016v1raw,
476 loadMVAfromDB = cms.bool(
True),
477 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_mvaOutput_normalization"),
480 category = cms.uint32(0),
481 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
482 variable = cms.string(
"pt"),
485 workingPoints = cms.vstring(
495 _rerunIsolationOldDMMVArun2016v1Task = cms.Task(
496 getattr(self.process,_byIsolationOldDMMVArun2016v1raw),
497 getattr(self.process,_byIsolationOldDMMVArun2016v1)
499 _rerunMvaIsolationTask.add(_rerunIsolationOldDMMVArun2016v1Task)
500 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMMVArun2016v1Task)
502 tauIDSources.byIsolationMVArun2v1DBoldDMwLTraw2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"raw")
503 tauIDSources.byVLooseIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff90")
504 tauIDSources.byLooseIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff80")
505 tauIDSources.byMediumIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff70")
506 tauIDSources.byTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff60")
507 tauIDSources.byVTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff50")
508 tauIDSources.byVVTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1,
"_WPEff40")
511 if "newDM2016v1" in self.toKeep:
512 _byIsolationNewDMMVArun2016v1raw =
"rerunDiscriminationByIsolationNewDMMVArun2v1raw"+self.postfix
513 setattr(self.process,_byIsolationNewDMMVArun2016v1raw,patDiscriminationByIsolationMVArun2v1raw.clone(
514 PATTauProducer = self.originalTauName,
515 Prediscriminants = noPrediscriminants,
516 loadMVAfromDB = cms.bool(
True),
517 mvaName = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1"),
518 mvaOpt = cms.string(
"DBnewDMwLT"),
519 verbosity = cms.int32(0)
522 _byIsolationNewDMMVArun2016v1 =
"rerunDiscriminationByIsolationNewDMMVArun2v1"+self.postfix
523 setattr(self.process,_byIsolationNewDMMVArun2016v1,patDiscriminationByIsolationMVArun2v1.clone(
524 PATTauProducer = self.originalTauName,
525 Prediscriminants = noPrediscriminants,
526 toMultiplex = _byIsolationNewDMMVArun2016v1raw,
527 loadMVAfromDB = cms.bool(
True),
528 mvaOutput_normalization = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_mvaOutput_normalization"),
531 category = cms.uint32(0),
532 cut = cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff90"),
533 variable = cms.string(
"pt"),
536 workingPoints = cms.vstring(
546 _rerunIsolationNewDMMVArun2016v1Task = cms.Task(
547 getattr(self.process,_byIsolationNewDMMVArun2016v1raw),
548 getattr(self.process,_byIsolationNewDMMVArun2016v1)
550 _rerunMvaIsolationTask.add(_rerunIsolationNewDMMVArun2016v1Task)
551 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationNewDMMVArun2016v1Task)
553 tauIDSources.byIsolationMVArun2v1DBnewDMwLTraw2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"raw")
554 tauIDSources.byVLooseIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff90")
555 tauIDSources.byLooseIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff80")
556 tauIDSources.byMediumIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff70")
557 tauIDSources.byTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff60")
558 tauIDSources.byVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff50")
559 tauIDSources.byVVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1,
"_WPEff40")
561 if "deepTau2017v1" in self.toKeep:
562 if self.debug:
print (
"Adding DeepTau IDs")
564 _deepTauName =
"deepTau2017v1"
567 "VVVLoose" : 0.96424,
577 "VVVLoose" : 0.959619,
578 "VVLoose" : 0.997687,
598 file_names = [
'RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v1_20L1024N_quantized.pb']
599 setattr(self.process,_deepTauName+self.postfix,cms.EDProducer(
"DeepTauId",
600 electrons = cms.InputTag(
'slimmedElectrons'),
601 muons = cms.InputTag(
'slimmedMuons'),
602 taus = cms.InputTag(self.originalTauName),
603 pfcands = cms.InputTag(
'packedPFCandidates'),
604 vertices = cms.InputTag(
'offlineSlimmedPrimaryVertices'),
605 rho = cms.InputTag(
'fixedGridRhoAll'),
606 graph_file = cms.vstring(file_names),
607 mem_mapped = cms.bool(
False),
608 version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]),
609 debug_level = cms.int32(0),
610 disable_dxy_pca = cms.bool(
False)
613 self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
615 _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
616 _rerunMvaIsolationTask.add(_deepTauProducer)
617 _rerunMvaIsolationSequence += _deepTauProducer
620 if "deepTau2017v2" in self.toKeep:
621 if self.debug:
print (
"Adding DeepTau IDs")
623 _deepTauName =
"deepTau2017v2"
626 "VVVLoose": 0.0630386,
627 "VVLoose": 0.1686942,
633 "VVTight": 0.9928449,
642 "VVVLoose": 0.2599605,
643 "VVLoose": 0.4249705,
649 "VVTight": 0.9733927,
654 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
655 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
656 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
658 setattr(self.process,_deepTauName+self.postfix,cms.EDProducer(
"DeepTauId",
659 electrons = cms.InputTag(
'slimmedElectrons'),
660 muons = cms.InputTag(
'slimmedMuons'),
661 taus = cms.InputTag(self.originalTauName),
662 pfcands = cms.InputTag(
'packedPFCandidates'),
663 vertices = cms.InputTag(
'offlineSlimmedPrimaryVertices'),
664 rho = cms.InputTag(
'fixedGridRhoAll'),
665 graph_file = cms.vstring(file_names),
666 mem_mapped = cms.bool(
False),
667 version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]),
668 debug_level = cms.int32(0),
669 disable_dxy_pca = cms.bool(
False)
672 self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
674 _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
675 _rerunMvaIsolationTask.add(_deepTauProducer)
676 _rerunMvaIsolationSequence += _deepTauProducer
679 if "deepTau2017v2p1" in self.toKeep:
680 if self.debug:
print (
"Adding DeepTau IDs")
682 _deepTauName =
"deepTau2017v2p1"
685 "VVVLoose": 0.0630386,
686 "VVLoose": 0.1686942,
692 "VVTight": 0.9928449,
701 "VVVLoose": 0.2599605,
702 "VVLoose": 0.4249705,
708 "VVTight": 0.9733927,
713 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
714 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
715 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
717 setattr(self.process,_deepTauName+self.postfix,cms.EDProducer(
"DeepTauId",
718 electrons = cms.InputTag(
'slimmedElectrons'),
719 muons = cms.InputTag(
'slimmedMuons'),
720 taus = cms.InputTag(self.originalTauName),
721 pfcands = cms.InputTag(
'packedPFCandidates'),
722 vertices = cms.InputTag(
'offlineSlimmedPrimaryVertices'),
723 rho = cms.InputTag(
'fixedGridRhoAll'),
724 graph_file = cms.vstring(file_names),
725 mem_mapped = cms.bool(
False),
726 version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]),
727 debug_level = cms.int32(0),
728 disable_dxy_pca = cms.bool(
True),
729 is_online = cms.bool(
False)
732 self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
734 _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
735 _rerunMvaIsolationTask.add(_deepTauProducer)
736 _rerunMvaIsolationSequence += _deepTauProducer
739 if "DPFTau_2016_v0" in self.toKeep:
740 if self.debug:
print (
"Adding DPFTau isolation (v0)")
742 _deepTauName =
"DPFTau_2016_v0"
745 "Tight" :
"if(decayMode == 0) return (0.898328 - 0.000160992 * pt);" + \
746 "if(decayMode == 1) return (0.910138 - 0.000229923 * pt);" + \
747 "if(decayMode == 10) return (0.873958 - 0.0002328 * pt);" + \
757 file_names = [
'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb' ]
758 setattr(self.process,_deepTauName+self.postfix,cms.EDProducer(
"DPFIsolation",
759 pfcands = cms.InputTag(
'packedPFCandidates'),
760 taus = cms.InputTag(self.originalTauName),
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(_deepTauName, tauIDSources, workingPoints_)
769 _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
770 _rerunMvaIsolationTask.add(_deepTauProducer)
771 _rerunMvaIsolationSequence += _deepTauProducer
774 if "DPFTau_2016_v1" in self.toKeep:
775 print (
"Adding DPFTau isolation (v1)")
776 print (
"WARNING: WPs are not defined for DPFTau_2016_v1")
777 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).")
779 _deepTauName =
"DPFTau_2016_v1"
781 "all": {
"Tight" : 0.123}
784 file_names = [
'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v1_quantized.pb' ]
785 setattr(self.process,_deepTauName+self.postfix,cms.EDProducer(
"DPFIsolation",
786 pfcands = cms.InputTag(
'packedPFCandidates'),
787 taus = cms.InputTag(self.originalTauName),
788 vertices = cms.InputTag(
'offlineSlimmedPrimaryVertices'),
789 graph_file = cms.vstring(file_names),
790 version = cms.uint32(self.getDpfTauVersion(file_names[0])),
791 mem_mapped = cms.bool(
False)
794 self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
796 _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
797 _rerunMvaIsolationTask.add(_deepTauProducer)
798 _rerunMvaIsolationSequence += _deepTauProducer
801 if "againstEle2018" in self.toKeep:
802 antiElectronDiscrMVA6_version =
"MVA6v3_noeveto"
806 _byElectronRejectionMVA62018Raw =
"patTauDiscriminationByElectronRejectionMVA62018Raw"+self.postfix
807 setattr(self.process,_byElectronRejectionMVA62018Raw,patTauDiscriminationAgainstElectronMVA6.clone(
808 PATTauProducer = self.originalTauName,
809 Prediscriminants = noPrediscriminants,
810 srcElectrons = cms.InputTag(
'slimmedElectrons'),
811 vetoEcalCracks = cms.bool(
False),
812 mvaName_NoEleMatch_wGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL',
813 mvaName_NoEleMatch_wGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC',
814 mvaName_NoEleMatch_woGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL',
815 mvaName_NoEleMatch_woGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC',
816 mvaName_wGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL',
817 mvaName_wGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC',
818 mvaName_woGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL',
819 mvaName_woGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC'
823 _byElectronRejectionMVA62018 =
"patTauDiscriminationByElectronRejectionMVA62018"+self.postfix
824 setattr(self.process,
"patTauDiscriminationByElectronRejectionMVA62018"+self.postfix,patTauDiscriminantCutMultiplexer.clone(
825 PATTauProducer = self.originalTauName,
826 Prediscriminants = noPrediscriminants,
827 toMultiplex = _byElectronRejectionMVA62018Raw,
830 category = cms.uint32(0),
831 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL'),
832 variable = cms.string(
'pt')
835 category = cms.uint32(2),
836 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL'),
837 variable = cms.string(
'pt')
840 category = cms.uint32(5),
841 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL'),
842 variable = cms.string(
'pt')
845 category = cms.uint32(7),
846 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL'),
847 variable = cms.string(
'pt')
850 category = cms.uint32(8),
851 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC'),
852 variable = cms.string(
'pt')
855 category = cms.uint32(10),
856 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC'),
857 variable = cms.string(
'pt')
860 category = cms.uint32(13),
861 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC'),
862 variable = cms.string(
'pt')
865 category = cms.uint32(15),
866 cut = cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC'),
867 variable = cms.string(
'pt')
870 workingPoints = cms.vstring(
879 _patTauDiscriminationByElectronRejectionMVA62018Task = cms.Task(
880 getattr(self.process,_byElectronRejectionMVA62018Raw),
881 getattr(self.process,_byElectronRejectionMVA62018)
883 _rerunMvaIsolationTask.add(_patTauDiscriminationByElectronRejectionMVA62018Task)
884 _rerunMvaIsolationSequence += cms.Sequence(_patTauDiscriminationByElectronRejectionMVA62018Task)
886 _againstElectronTauIDSources = cms.PSet(
887 againstElectronMVA6Raw2018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"raw"),
888 againstElectronMVA6category2018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"category"),
889 againstElectronVLooseMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"_WPeff98"),
890 againstElectronLooseMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"_WPeff90"),
891 againstElectronMediumMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"_WPeff80"),
892 againstElectronTightMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"_WPeff70"),
893 againstElectronVTightMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018,
"_WPeff60")
895 _tauIDSourcesWithAgainistEle = cms.PSet(
896 tauIDSources.clone(),
897 _againstElectronTauIDSources
899 tauIDSources =_tauIDSourcesWithAgainistEle.clone()
901 if "newDMPhase2v1" in self.toKeep:
902 if self.debug:
print (
"Adding newDMPhase2v1 ID")
904 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)))
905 _byIsolationNewDMMVAPhase2raw =
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2raw"+self.postfix
906 setattr(self.process,_byIsolationNewDMMVAPhase2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
907 PATTauProducer = self.originalTauName,
908 Prediscriminants = noPrediscriminants,
909 loadMVAfromDB =
True,
910 mvaName =
'RecoTauTag_tauIdMVAIsoPhase2',
911 mvaOpt =
'DBnewDMwLTwGJPhase2',
915 _byIsolationNewDMMVAPhase2 =
"rerunDiscriminationByIsolationMVADBnewDMwLTPhase2"+self.postfix
916 setattr(self.process,_byIsolationNewDMMVAPhase2,patDiscriminationByIsolationMVArun2v1.clone(
917 PATTauProducer = self.originalTauName,
918 Prediscriminants = noPrediscriminants,
919 toMultiplex = _byIsolationNewDMMVAPhase2raw,
920 loadMVAfromDB =
True,
921 mvaOutput_normalization =
'RecoTauTag_tauIdMVAIsoPhase2_mvaOutput_normalization',
924 category = cms.uint32(0),
925 cut = cms.string(
"RecoTauTag_tauIdMVAIsoPhase2"),
926 variable = cms.string(
"pt"),
929 workingPoints = cms.vstring(
939 _rerunIsolationMVADBnewDMwLTPhase2Task = cms.Task(
940 getattr(self.process,_byIsolationNewDMMVAPhase2raw),
941 getattr(self.process,_byIsolationNewDMMVAPhase2)
943 _rerunMvaIsolationTask.add(_rerunIsolationMVADBnewDMwLTPhase2Task)
944 _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationMVADBnewDMwLTPhase2Task)
946 tauIDSources.byIsolationMVADBnewDMwLTPhase2raw =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"raw")
947 tauIDSources.byVVLooseIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_VVLoose")
948 tauIDSources.byVLooseIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_VLoose")
949 tauIDSources.byLooseIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_Loose")
950 tauIDSources.byMediumIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_Medium")
951 tauIDSources.byTightIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_Tight")
952 tauIDSources.byVTightIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_VTight")
953 tauIDSources.byVVTightIsolationMVADBnewDMwLTPhase2 =
tauIDMVAinputs(_byIsolationNewDMMVAPhase2,
"_VVTight")
955 if "againstElePhase2v1" in self.toKeep:
956 if self.debug:
print (
"Adding anti-e Phase2v1 ID")
959 from RecoTauTag.RecoTau.PATTauDiscriminationAgainstElectronMVA6Phase2_cff
import patTauDiscriminationAgainstElectronMVA6Phase2Raw, patTauDiscriminationAgainstElectronMVA6Phase2, mergedSlimmedElectronsForTauId
960 _byElectronRejectionMVA6Phase2v1Raw =
"patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw"+self.postfix
961 setattr(self.process,_byElectronRejectionMVA6Phase2v1Raw,patTauDiscriminationAgainstElectronMVA6Phase2Raw.clone(
962 PATTauProducer = self.originalTauName,
963 Prediscriminants = noPrediscriminants
966 _byElectronRejectionMVA6Phase2v1 =
"patTauDiscriminationByElectronRejectionMVA6Phase2v1"+self.postfix
967 setattr(self.process,_byElectronRejectionMVA6Phase2v1,patTauDiscriminationAgainstElectronMVA6Phase2.clone(
968 PATTauProducer = self.originalTauName,
969 Prediscriminants = noPrediscriminants,
970 toMultiplex = _byElectronRejectionMVA6Phase2v1Raw
973 if not hasattr(self.process,
"mergedSlimmedElectronsForTauId"):
974 self.process.mergedSlimmedElectronsForTauId = mergedSlimmedElectronsForTauId
975 _patTauDiscriminationByElectronRejectionMVA6Phase2v1Task = cms.Task(
976 self.process.mergedSlimmedElectronsForTauId,
977 getattr(self.process,_byElectronRejectionMVA6Phase2v1Raw),
978 getattr(self.process,_byElectronRejectionMVA6Phase2v1)
980 _rerunMvaIsolationTask.add(_patTauDiscriminationByElectronRejectionMVA6Phase2v1Task)
981 _rerunMvaIsolationSequence += cms.Sequence(_patTauDiscriminationByElectronRejectionMVA6Phase2v1Task)
983 _againstElectronTauIDPhase2v1Sources = cms.PSet(
984 againstElectronMVA6RawPhase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"raw"),
985 againstElectronMVA6categoryPhase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"category"),
986 againstElectronVLooseMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"_VLoose"),
987 againstElectronLooseMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"_Loose"),
988 againstElectronMediumMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"_Medium"),
989 againstElectronTightMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"_Tight"),
990 againstElectronVTightMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1,
"_VTight")
992 _tauIDSourcesWithAgainistElePhase2v1 = cms.PSet(
993 tauIDSources.clone(),
994 _againstElectronTauIDPhase2v1Sources
996 tauIDSources =_tauIDSourcesWithAgainistElePhase2v1.clone()
998 if self.debug:
print(
'Embedding new TauIDs into \"'+self.updatedTauName+
'\"')
999 if not hasattr(self.process, self.updatedTauName):
1000 embedID = cms.EDProducer(
"PATTauIDEmbedder",
1001 src = cms.InputTag(self.originalTauName),
1002 tauIDSources = tauIDSources
1004 setattr(self.process, self.updatedTauName, embedID)
1006 tauIDSources = cms.PSet(
1007 getattr(self.process, self.updatedTauName).tauIDSources,
1009 getattr(self.process, self.updatedTauName).tauIDSources = tauIDSources
1010 setattr(self.process,
"rerunMvaIsolationTask"+self.postfix,_rerunMvaIsolationTask)
1011 setattr(self.process,
"rerunMvaIsolationSequence"+self.postfix,_rerunMvaIsolationSequence)