1 from __future__
import print_function
2 import FWCore.ParameterSet.Config
as cms
10 """class to rerun the tau seq and acces trainings from the database"""
11 availableDiscriminators = [
12 "2017v1",
"2017v2",
"newDM2017v2",
"dR0p32017v2",
"2016v1",
"newDM2016v1",
13 "deepTau2017v1",
"deepTau2017v2",
"deepTau2017v2p1",
14 "DPFTau_2016_v0",
"DPFTau_2016_v1",
21 updatedTauName = "slimmedTausNewID",
22 toKeep = ["deepTau2017v2p1"],
23 tauIdDiscrMVA_trainings_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017", },
24 tauIdDiscrMVA_WPs_run2_2017 = {
25 'tauIdMVAIsoDBoldDMwLT2017' : {
26 'Eff95' :
"DBoldDMwLTEff95",
27 'Eff90' :
"DBoldDMwLTEff90",
28 'Eff80' :
"DBoldDMwLTEff80",
29 'Eff70' :
"DBoldDMwLTEff70",
30 'Eff60' :
"DBoldDMwLTEff60",
31 'Eff50' :
"DBoldDMwLTEff50",
32 'Eff40' :
"DBoldDMwLTEff40"
35 tauIdDiscrMVA_2017_version =
"v1",
38 super(TauIDEmbedder, self).
__init__()
42 self.
process.
load(
'RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi')
43 if len(conditionDB) != 0:
44 self.
process.CondDBTauConnection.connect = cms.string(conditionDB)
45 self.
process.loadRecoTauTagMVAsFromPrepDB.connect = cms.string(conditionDB)
55 if discr
not in TauIDEmbedder.availableDiscriminators:
56 raise RuntimeError(
'TauIDEmbedder: discriminator "{}" is not supported'.
format(discr))
62 """returns 'CMSSW_X_Y_Z'"""
63 cmssw_version = os.environ[
"CMSSW_VERSION"]
64 if debug:
print (
"get_cmssw_version:", cmssw_version)
69 """returns '(release, subversion, patch)' (without 'CMSSW_')"""
70 v = klass.get_cmssw_version().
split(
"CMSSW_")[1].
split(
"_")[0:3]
71 if debug:
print (
"get_cmssw_version_number:", v)
76 return int(v[0]),
int(v[1]), patch
80 version = release * 10000 + subversion * 100 + patch + 1
81 if debug:
print (
"versionToInt:", version)
87 split_cmssw_version = klass.get_cmssw_version_number()
88 if klass.versionToInt(release, subversion, patch) > klass.versionToInt(split_cmssw_version[0], split_cmssw_version[1], split_cmssw_version[2]):
89 if debug:
print (
"is_above_cmssw_version:",
False)
92 if debug:
print (
"is_above_cmssw_version:",
True)
96 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)))
99 if self.
debug:
print (
"loadMVA_WPs_run2_2017: performed")
103 self.
process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
105 record = cms.string(
'GBRWrapperRcd'),
112 self.
process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
114 record = cms.string(
'PhysicsTGraphPayloadRcd'),
120 self.
process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
122 record = cms.string(
'PhysicsTFormulaPayloadRcd'),
129 self.
process.rerunMvaIsolationTask = cms.Task()
130 self.
process.rerunMvaIsolationSequence = cms.Sequence()
131 tauIDSources = cms.PSet()
134 if "2017v1" in self.
toKeep:
137 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
140 'tauIdMVAIsoDBoldDMwLT2017' : {
141 'Eff95' :
"DBoldDMwLTEff95",
142 'Eff90' :
"DBoldDMwLTEff90",
143 'Eff80' :
"DBoldDMwLTEff80",
144 'Eff70' :
"DBoldDMwLTEff70",
145 'Eff60' :
"DBoldDMwLTEff60",
146 'Eff50' :
"DBoldDMwLTEff50",
147 'Eff40' :
"DBoldDMwLTEff40"
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")
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(
189 self.
process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw,
190 self.
process.rerunDiscriminationByIsolationOldDMMVArun2017v1
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:
208 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
211 'tauIdMVAIsoDBoldDMwLT2017' : {
212 'Eff95' :
"DBoldDMwLTEff95",
213 'Eff90' :
"DBoldDMwLTEff90",
214 'Eff80' :
"DBoldDMwLTEff80",
215 'Eff70' :
"DBoldDMwLTEff70",
216 'Eff60' :
"DBoldDMwLTEff60",
217 'Eff50' :
"DBoldDMwLTEff50",
218 'Eff40' :
"DBoldDMwLTEff40"
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")
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)
261 self.
process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw,
262 self.
process.rerunDiscriminationByIsolationOldDMMVArun2017v2
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:
279 'tauIdMVAIsoDBnewDMwLT2017' :
"tauIdMVAIsoDBnewDMwLT2017",
282 'tauIdMVAIsoDBnewDMwLT2017' : {
283 'Eff95' :
"DBnewDMwLTEff95",
284 'Eff90' :
"DBnewDMwLTEff90",
285 'Eff80' :
"DBnewDMwLTEff80",
286 'Eff70' :
"DBnewDMwLTEff70",
287 'Eff60' :
"DBnewDMwLTEff60",
288 'Eff50' :
"DBnewDMwLTEff50",
289 'Eff40' :
"DBnewDMwLTEff40"
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")
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)
332 self.
process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw,
333 self.
process.rerunDiscriminationByIsolationNewDMMVArun2017v2
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:
350 'tauIdMVAIsoDBoldDMdR0p3wLT2017' :
"tauIdMVAIsoDBoldDMdR0p3wLT2017",
353 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : {
354 'Eff95' :
"DBoldDMdR0p3wLTEff95",
355 'Eff90' :
"DBoldDMdR0p3wLTEff90",
356 'Eff80' :
"DBoldDMdR0p3wLTEff80",
357 'Eff70' :
"DBoldDMdR0p3wLTEff70",
358 'Eff60' :
"DBoldDMdR0p3wLTEff60",
359 'Eff50' :
"DBoldDMdR0p3wLTEff50",
360 'Eff40' :
"DBoldDMdR0p3wLTEff40"
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")
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)
407 self.
process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw,
408 self.
process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2
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(
483 self.
process.rerunDiscriminationByIsolationOldDMMVArun2v1raw,
484 self.
process.rerunDiscriminationByIsolationOldDMMVArun2v1
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(
532 self.
process.rerunDiscriminationByIsolationNewDMMVArun2v1raw,
533 self.
process.rerunDiscriminationByIsolationNewDMMVArun2v1
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),
593 debug_level = cms.int32(0),
594 disable_dxy_pca = cms.bool(
False)
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),
649 debug_level = cms.int32(0),
650 disable_dxy_pca = cms.bool(
False)
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),
705 debug_level = cms.int32(0),
706 disable_dxy_pca = cms.bool(
True),
707 is_online = cms.bool(
False)
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),
739 mem_mapped = cms.bool(
False)
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),
764 mem_mapped = cms.bool(
False)
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()
966 embedID = cms.EDProducer(
"PATTauIDEmbedder",
967 src = cms.InputTag(
'slimmedTaus'),
968 tauIDSources = tauIDSources
972 tauIDSources = cms.PSet(
979 for target,points
in six.iteritems(workingPoints_):
980 setattr(tauIDSources,
'by{}VS{}raw'.
format(producer_name[0].
upper()+producer_name[1:], target),
981 cms.PSet(inputTag = cms.InputTag(producer_name,
'VS{}'.
format(target)), workingPointIndex = cms.int32(-1)))
984 for index, (point,cut)
in enumerate(six.iteritems(points)):
985 cut_expressions.append(
str(cut))
987 setattr(tauIDSources,
'by{}{}VS{}'.
format(point, producer_name[0].
upper()+producer_name[1:], target),
988 cms.PSet(inputTag = cms.InputTag(producer_name,
'VS{}'.
format(target)), workingPointIndex = cms.int32(index)))
990 setattr(getattr(self.
process, producer_name),
'VS{}WP'.
format(target), cms.vstring(*cut_expressions))
994 """returns the DNN version. File name should contain a version label with data takig year (2011-2, 2015-8) and \
995 version number (vX), e.g. 2017v0, in general the following format: {year}v{version}"""
996 version_search = re.search(
'201[125678]v([0-9]+)[\._]', file_name)
997 if not version_search:
998 raise RuntimeError(
'File "{}" has an invalid name pattern, should be in the format "{year}v{version}". \
999 Unable to extract version number.'.
format(file_name))
1000 version = version_search.group(1)
1004 """returns the DeepTau year, version, subversion. File name should contain a version label with data takig year \
1005 (2011-2, 2015-8), version number (vX) and subversion (pX), e.g. 2017v0p6, in general the following format: \
1006 {year}v{version}p{subversion}"""
1007 version_search = re.search(
'(201[125678])v([0-9]+)(p[0-9]+|)[\._]', file_name)
1008 if not version_search:
1009 raise RuntimeError(
'File "{}" has an invalid name pattern, should be in the format "{year}v{version}p{subversion}". \
1010 Unable to extract version number.'.
format(file_name))
1011 year = version_search.group(1)
1012 version = version_search.group(2)
1013 subversion = version_search.group(3)
1014 if len(subversion) > 0:
1015 subversion = subversion[1:]
1018 return int(year),
int(version),
int(subversion)