1 from __future__
import print_function
9 """class to rerun the tau seq and acces trainings from the database""" 10 availableDiscriminators = [
11 "2017v1",
"2017v2",
"newDM2017v2",
"dR0p32017v2",
"2016v1",
"newDM2016v1",
12 "deepTau2017v1",
"deepTau2017v2",
"deepTau2017v2p1",
13 "DPFTau_2016_v0",
"DPFTau_2016_v1",
17 def __init__(self, process, cms, debug = False,
18 updatedTauName =
"slimmedTausNewID",
19 toKeep = [
"deepTau2017v2p1"],
20 tauIdDiscrMVA_trainings_run2_2017 = {
'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017", },
21 tauIdDiscrMVA_WPs_run2_2017 = {
22 'tauIdMVAIsoDBoldDMwLT2017' : {
23 'Eff95' :
"DBoldDMwLTEff95",
24 'Eff90' :
"DBoldDMwLTEff90",
25 'Eff80' :
"DBoldDMwLTEff80",
26 'Eff70' :
"DBoldDMwLTEff70",
27 'Eff60' :
"DBoldDMwLTEff60",
28 'Eff50' :
"DBoldDMwLTEff50",
29 'Eff40' :
"DBoldDMwLTEff40" 32 tauIdDiscrMVA_2017_version =
"v1",
35 super(TauIDEmbedder, self).
__init__()
40 self.process.load(
'RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi')
41 if len(conditionDB) != 0:
42 self.process.CondDBTauConnection.connect = cms.string(conditionDB)
43 self.process.loadRecoTauTagMVAsFromPrepDB.connect = cms.string(conditionDB)
53 if discr
not in TauIDEmbedder.availableDiscriminators:
54 raise RuntimeError(
'TauIDEmbedder: discriminator "{}" is not supported'.
format(discr))
60 """returns 'CMSSW_X_Y_Z'""" 61 cmssw_version = os.environ[
"CMSSW_VERSION"]
62 if debug:
print (
"get_cmssw_version:", cmssw_version)
67 """returns '(release, subversion, patch)' (without 'CMSSW_')""" 68 v = klass.get_cmssw_version().
split(
"CMSSW_")[1].
split(
"_")[0:3]
69 if debug:
print (
"get_cmssw_version_number:", v)
74 return int(v[0]),
int(v[1]), patch
78 version = release * 10000 + subversion * 100 + patch + 1
79 if debug:
print (
"versionToInt:", version)
85 split_cmssw_version = klass.get_cmssw_version_number()
86 if klass.versionToInt(release, subversion, patch) > klass.versionToInt(split_cmssw_version[0], split_cmssw_version[1], split_cmssw_version[2]):
87 if debug:
print (
"is_above_cmssw_version:",
False)
90 if debug:
print (
"is_above_cmssw_version:",
True)
94 if self.
debug:
print (
"loadMVA_WPs_run2_2017: performed")
96 for training, gbrForestName
in self.tauIdDiscrMVA_trainings_run2_2017.items():
98 self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
100 record = self.cms.string(
'GBRWrapperRcd'),
107 self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
109 record = self.cms.string(
'PhysicsTGraphPayloadRcd'),
115 self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
117 record = self.cms.string(
'PhysicsTFormulaPayloadRcd'),
119 label = self.cms.untracked.string(
"RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, self.
tauIdDiscrMVA_2017_version))
124 self.process.rerunMvaIsolationTask = self.cms.Task()
125 self.process.rerunMvaIsolationSequence = self.cms.Sequence()
126 tauIDSources = self.cms.PSet()
129 if "2017v1" in self.
toKeep:
132 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
135 'tauIdMVAIsoDBoldDMwLT2017' : {
136 'Eff95' :
"DBoldDMwLTEff95",
137 'Eff90' :
"DBoldDMwLTEff90",
138 'Eff80' :
"DBoldDMwLTEff80",
139 'Eff70' :
"DBoldDMwLTEff70",
140 'Eff60' :
"DBoldDMwLTEff60",
141 'Eff50' :
"DBoldDMwLTEff50",
142 'Eff40' :
"DBoldDMwLTEff40" 147 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")
150 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
151 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
152 Prediscriminants = noPrediscriminants,
153 loadMVAfromDB = self.cms.bool(
True),
154 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),
155 mvaOpt = self.cms.string(
"DBoldDMwLTwGJ"),
156 verbosity = self.cms.int32(0)
159 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
160 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
161 Prediscriminants = noPrediscriminants,
162 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1raw'),
163 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1raw:category'),
164 loadMVAfromDB = self.cms.bool(
True),
165 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"),
166 mapping = self.cms.VPSet(
168 category = self.cms.uint32(0),
169 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff90"),
170 variable = self.cms.string(
"pt"),
175 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
176 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff95")
177 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
178 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff80")
179 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
180 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff70")
181 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
182 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff60")
183 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
184 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff50")
185 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
186 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff40")
189 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw,
190 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose,
191 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose,
192 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose,
193 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium,
194 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight,
195 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight,
196 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight
201 tauIDSources.byIsolationMVArun2017v1DBoldDMwLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1raw')
202 tauIDSources.byVVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose')
203 tauIDSources.byVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose')
204 tauIDSources.byLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1Loose')
205 tauIDSources.byMediumIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1Medium')
206 tauIDSources.byTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1Tight')
207 tauIDSources.byVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VTight')
208 tauIDSources.byVVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight')
211 if "2017v2" in self.
toKeep:
214 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
217 'tauIdMVAIsoDBoldDMwLT2017' : {
218 'Eff95' :
"DBoldDMwLTEff95",
219 'Eff90' :
"DBoldDMwLTEff90",
220 'Eff80' :
"DBoldDMwLTEff80",
221 'Eff70' :
"DBoldDMwLTEff70",
222 'Eff60' :
"DBoldDMwLTEff60",
223 'Eff50' :
"DBoldDMwLTEff50",
224 'Eff40' :
"DBoldDMwLTEff40" 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")
232 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
233 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
234 Prediscriminants = noPrediscriminants,
235 loadMVAfromDB = self.cms.bool(
True),
236 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),
237 mvaOpt = self.cms.string(
"DBoldDMwLTwGJ"),
238 verbosity = self.cms.int32(0)
241 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
242 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
243 Prediscriminants = noPrediscriminants,
244 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2raw'),
245 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2raw:category'),
246 loadMVAfromDB = self.cms.bool(
True),
247 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"),
248 mapping = self.cms.VPSet(
250 category = self.cms.uint32(0),
251 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff90"),
252 variable = self.cms.string(
"pt"),
255 verbosity = self.cms.int32(0)
258 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
259 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff95")
260 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
261 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff80")
262 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
263 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff70")
264 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
265 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff60")
266 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
267 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff50")
268 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
269 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff40")
272 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw,
273 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose,
274 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose,
275 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Loose,
276 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Medium,
277 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Tight,
278 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VTight,
279 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight
284 tauIDSources.byIsolationMVArun2017v2DBoldDMwLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2raw')
285 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose')
286 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose')
287 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2Loose')
288 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2Medium')
289 tauIDSources.byTightIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2Tight')
290 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2VTight')
291 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight')
293 if "newDM2017v2" in self.
toKeep:
296 'tauIdMVAIsoDBnewDMwLT2017' :
"tauIdMVAIsoDBnewDMwLT2017",
299 'tauIdMVAIsoDBnewDMwLT2017' : {
300 'Eff95' :
"DBnewDMwLTEff95",
301 'Eff90' :
"DBnewDMwLTEff90",
302 'Eff80' :
"DBnewDMwLTEff80",
303 'Eff70' :
"DBnewDMwLTEff70",
304 'Eff60' :
"DBnewDMwLTEff60",
305 'Eff50' :
"DBnewDMwLTEff50",
306 'Eff40' :
"DBnewDMwLTEff40" 311 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")
314 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
315 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
316 Prediscriminants = noPrediscriminants,
317 loadMVAfromDB = self.cms.bool(
True),
318 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),
319 mvaOpt = self.cms.string(
"DBnewDMwLTwGJ"),
320 verbosity = self.cms.int32(0)
323 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
324 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
325 Prediscriminants = noPrediscriminants,
326 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2raw'),
327 key = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2raw:category'),
328 loadMVAfromDB = self.cms.bool(
True),
329 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"),
330 mapping = self.cms.VPSet(
332 category = self.cms.uint32(0),
333 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff90"),
334 variable = self.cms.string(
"pt"),
337 verbosity = self.cms.int32(0)
340 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
341 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff95")
342 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
343 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff80")
344 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
345 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff70")
346 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
347 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff60")
348 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
349 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff50")
350 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
351 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff40")
354 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw,
355 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose,
356 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose,
357 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose,
358 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium,
359 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight,
360 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight,
361 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight
366 tauIDSources.byIsolationMVArun2017v2DBnewDMwLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2raw')
367 tauIDSources.byVVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose')
368 tauIDSources.byVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose')
369 tauIDSources.byLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2Loose')
370 tauIDSources.byMediumIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2Medium')
371 tauIDSources.byTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2Tight')
372 tauIDSources.byVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VTight')
373 tauIDSources.byVVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight')
375 if "dR0p32017v2" in self.
toKeep:
378 'tauIdMVAIsoDBoldDMdR0p3wLT2017' :
"tauIdMVAIsoDBoldDMdR0p3wLT2017",
381 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : {
382 'Eff95' :
"DBoldDMdR0p3wLTEff95",
383 'Eff90' :
"DBoldDMdR0p3wLTEff90",
384 'Eff80' :
"DBoldDMdR0p3wLTEff80",
385 'Eff70' :
"DBoldDMdR0p3wLTEff70",
386 'Eff60' :
"DBoldDMdR0p3wLTEff60",
387 'Eff50' :
"DBoldDMdR0p3wLTEff50",
388 'Eff40' :
"DBoldDMdR0p3wLTEff40" 393 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")
396 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
397 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
398 Prediscriminants = noPrediscriminants,
399 loadMVAfromDB = self.cms.bool(
True),
400 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
401 mvaOpt = self.cms.string(
"DBoldDMwLTwGJ"),
402 srcChargedIsoPtSum = self.cms.string(
'chargedIsoPtSumdR03'),
403 srcFootprintCorrection = self.cms.string(
'footprintCorrectiondR03'),
404 srcNeutralIsoPtSum = self.cms.string(
'neutralIsoPtSumdR03'),
405 srcPhotonPtSumOutsideSignalCone = self.cms.string(
'photonPtSumOutsideSignalConedR03'),
406 verbosity = self.cms.int32(0)
409 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
410 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
411 Prediscriminants = noPrediscriminants,
412 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw'),
413 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw:category'),
414 loadMVAfromDB = self.cms.bool(
True),
415 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"),
416 mapping = self.cms.VPSet(
418 category = self.cms.uint32(0),
419 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff90"),
420 variable = self.cms.string(
"pt"),
423 verbosity = self.cms.int32(0)
426 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
427 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff95")
428 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
429 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff80")
430 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
431 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff70")
432 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
433 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff60")
434 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
435 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff50")
436 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
437 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff40")
440 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw,
441 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose,
442 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose,
443 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose,
444 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium,
445 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight,
446 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight,
447 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight
452 tauIDSources.byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw')
453 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose')
454 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose')
455 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose')
456 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium')
457 tauIDSources.byTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight')
458 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight')
459 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight')
488 if "2016v1" in self.
toKeep:
489 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
490 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
491 Prediscriminants = noPrediscriminants,
492 loadMVAfromDB = self.cms.bool(
True),
493 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
494 mvaOpt = self.cms.string(
"DBoldDMwLT"),
495 verbosity = self.cms.int32(0)
498 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
499 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
500 Prediscriminants = noPrediscriminants,
501 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1raw'),
502 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1raw:category'),
503 loadMVAfromDB = self.cms.bool(
True),
504 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_mvaOutput_normalization"),
505 mapping = self.cms.VPSet(
507 category = self.cms.uint32(0),
508 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff90"),
509 variable = self.cms.string(
"pt"),
514 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
515 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff80")
516 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
517 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff70")
518 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
519 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff60")
520 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
521 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff50")
522 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
523 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff40")
526 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw,
527 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose,
528 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose,
529 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium,
530 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight,
531 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight,
532 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight
537 tauIDSources.byIsolationMVArun2v1DBoldDMwLTraw2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1raw')
538 tauIDSources.byVLooseIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1VLoose')
539 tauIDSources.byLooseIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1Loose')
540 tauIDSources.byMediumIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1Medium')
541 tauIDSources.byTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1Tight')
542 tauIDSources.byVTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1VTight')
543 tauIDSources.byVVTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1VVTight')
546 if "newDM2016v1" in self.
toKeep:
547 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
548 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
549 Prediscriminants = noPrediscriminants,
550 loadMVAfromDB = self.cms.bool(
True),
551 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1"),
552 mvaOpt = self.cms.string(
"DBnewDMwLT"),
553 verbosity = self.cms.int32(0)
556 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
557 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
558 Prediscriminants = noPrediscriminants,
559 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1raw'),
560 key = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1raw:category'),
561 loadMVAfromDB = self.cms.bool(
True),
562 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_mvaOutput_normalization"),
563 mapping = self.cms.VPSet(
565 category = self.cms.uint32(0),
566 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff90"),
567 variable = self.cms.string(
"pt"),
572 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
573 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff80")
574 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
575 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff70")
576 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
577 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff60")
578 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
579 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff50")
580 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
581 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff40")
584 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw,
585 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose,
586 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose,
587 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium,
588 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight,
589 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight,
590 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight
595 tauIDSources.byIsolationMVArun2v1DBnewDMwLTraw2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1raw')
596 tauIDSources.byVLooseIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1VLoose')
597 tauIDSources.byLooseIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1Loose')
598 tauIDSources.byMediumIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1Medium')
599 tauIDSources.byTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1Tight')
600 tauIDSources.byVTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1VTight')
601 tauIDSources.byVVTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1VVTight')
603 if "deepTau2017v1" in self.
toKeep:
604 if self.
debug:
print (
"Adding DeepTau IDs")
608 "VVVLoose" : 0.96424,
618 "VVVLoose" : 0.959619,
619 "VVLoose" : 0.997687,
639 file_names = [
'RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v1_20L1024N_quantized.pb']
640 self.process.deepTau2017v1 = self.cms.EDProducer(
"DeepTauId",
641 electrons = self.cms.InputTag(
'slimmedElectrons'),
642 muons = self.cms.InputTag(
'slimmedMuons'),
643 taus = self.cms.InputTag(
'slimmedTaus'),
644 pfcands = self.cms.InputTag(
'packedPFCandidates'),
645 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
646 rho = self.cms.InputTag(
'fixedGridRhoAll'),
647 graph_file = self.cms.vstring(file_names),
648 mem_mapped = self.cms.bool(
False),
650 debug_level = self.cms.int32(0),
651 disable_dxy_pca = self.cms.bool(
False)
657 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v1)
658 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v1
660 if "deepTau2017v2" in self.
toKeep:
661 if self.
debug:
print (
"Adding DeepTau IDs")
665 "VVVLoose": 0.0630386,
666 "VVLoose": 0.1686942,
672 "VVTight": 0.9928449,
681 "VVVLoose": 0.2599605,
682 "VVLoose": 0.4249705,
688 "VVTight": 0.9733927,
693 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
694 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
695 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
697 self.process.deepTau2017v2 = self.cms.EDProducer(
"DeepTauId",
698 electrons = self.cms.InputTag(
'slimmedElectrons'),
699 muons = self.cms.InputTag(
'slimmedMuons'),
700 taus = self.cms.InputTag(
'slimmedTaus'),
701 pfcands = self.cms.InputTag(
'packedPFCandidates'),
702 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
703 rho = self.cms.InputTag(
'fixedGridRhoAll'),
704 graph_file = self.cms.vstring(file_names),
705 mem_mapped = self.cms.bool(
True),
707 debug_level = self.cms.int32(0),
708 disable_dxy_pca = self.cms.bool(
False)
714 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v2)
715 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v2
717 if "deepTau2017v2p1" in self.
toKeep:
718 if self.
debug:
print (
"Adding DeepTau IDs")
722 "VVVLoose": 0.0630386,
723 "VVLoose": 0.1686942,
729 "VVTight": 0.9928449,
738 "VVVLoose": 0.2599605,
739 "VVLoose": 0.4249705,
745 "VVTight": 0.9733927,
750 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
751 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
752 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
754 self.process.deepTau2017v2p1 = self.cms.EDProducer(
"DeepTauId",
755 electrons = self.cms.InputTag(
'slimmedElectrons'),
756 muons = self.cms.InputTag(
'slimmedMuons'),
757 taus = self.cms.InputTag(
'slimmedTaus'),
758 pfcands = self.cms.InputTag(
'packedPFCandidates'),
759 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
760 rho = self.cms.InputTag(
'fixedGridRhoAll'),
761 graph_file = self.cms.vstring(file_names),
762 mem_mapped = self.cms.bool(
True),
764 debug_level = self.cms.int32(0),
765 disable_dxy_pca = self.cms.bool(
True)
771 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v2p1)
772 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v2p1
774 if "DPFTau_2016_v0" in self.
toKeep:
775 if self.
debug:
print (
"Adding DPFTau isolation (v0)")
779 "Tight" :
"if(decayMode == 0) return (0.898328 - 0.000160992 * pt);" + \
780 "if(decayMode == 1) return (0.910138 - 0.000229923 * pt);" + \
781 "if(decayMode == 10) return (0.873958 - 0.0002328 * pt);" + \
791 file_names = [
'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb' ]
792 self.process.dpfTau2016v0 = self.cms.EDProducer(
"DPFIsolation",
793 pfcands = self.cms.InputTag(
'packedPFCandidates'),
794 taus = self.cms.InputTag(
'slimmedTaus'),
795 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
796 graph_file = self.cms.vstring(file_names),
798 mem_mapped = self.cms.bool(
False)
803 self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v0)
804 self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v0
807 if "DPFTau_2016_v1" in self.
toKeep:
808 print (
"Adding DPFTau isolation (v1)")
809 print (
"WARNING: WPs are not defined for DPFTau_2016_v1")
810 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).")
813 "all": {
"Tight" : 0.123}
816 file_names = [
'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v1_quantized.pb' ]
817 self.process.dpfTau2016v1 = self.cms.EDProducer(
"DPFIsolation",
818 pfcands = self.cms.InputTag(
'packedPFCandidates'),
819 taus = self.cms.InputTag(
'slimmedTaus'),
820 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
821 graph_file = self.cms.vstring(file_names),
823 mem_mapped = self.cms.bool(
False)
828 self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v1)
829 self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v1
831 if "againstEle2018" in self.
toKeep:
832 antiElectronDiscrMVA6_version =
"MVA6v3_noeveto" 835 from RecoTauTag.RecoTau.PATTauDiscriminationAgainstElectronMVA6_cfi
import patTauDiscriminationAgainstElectronMVA6
836 self.process.patTauDiscriminationByElectronRejectionMVA62018Raw = patTauDiscriminationAgainstElectronMVA6.clone(
837 Prediscriminants = noPrediscriminants,
838 vetoEcalCracks = self.cms.bool(
False),
839 mvaName_NoEleMatch_wGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL',
840 mvaName_NoEleMatch_wGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC',
841 mvaName_NoEleMatch_woGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL',
842 mvaName_NoEleMatch_woGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC',
843 mvaName_wGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL',
844 mvaName_wGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC',
845 mvaName_woGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL',
846 mvaName_woGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC' 851 self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018 = patTauDiscriminantCutMultiplexer.clone(
852 PATTauProducer = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.PATTauProducer,
853 Prediscriminants = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.Prediscriminants,
854 toMultiplex = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw"),
855 key = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw",
"category"),
856 mapping = self.cms.VPSet(
858 category = self.cms.uint32(0),
859 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff98'),
860 variable = self.cms.string(
'pt')
863 category = self.cms.uint32(2),
864 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff98'),
865 variable = self.cms.string(
'pt')
868 category = self.cms.uint32(5),
869 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff98'),
870 variable = self.cms.string(
'pt')
873 category = self.cms.uint32(7),
874 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff98'),
875 variable = self.cms.string(
'pt')
878 category = self.cms.uint32(8),
879 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff98'),
880 variable = self.cms.string(
'pt')
883 category = self.cms.uint32(10),
884 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff98'),
885 variable = self.cms.string(
'pt')
888 category = self.cms.uint32(13),
889 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff98'),
890 variable = self.cms.string(
'pt')
893 category = self.cms.uint32(15),
894 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff98'),
895 variable = self.cms.string(
'pt')
900 self.process.patTauDiscriminationByLooseElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
901 mapping = self.cms.VPSet(
903 category = self.cms.uint32(0),
904 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff90'),
905 variable = self.cms.string(
'pt')
908 category = self.cms.uint32(2),
909 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff90'),
910 variable = self.cms.string(
'pt')
913 category = self.cms.uint32(5),
914 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff90'),
915 variable = self.cms.string(
'pt')
918 category = self.cms.uint32(7),
919 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff90'),
920 variable = self.cms.string(
'pt')
923 category = self.cms.uint32(8),
924 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff90'),
925 variable = self.cms.string(
'pt')
928 category = self.cms.uint32(10),
929 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff90'),
930 variable = self.cms.string(
'pt')
933 category = self.cms.uint32(13),
934 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff90'),
935 variable = self.cms.string(
'pt')
938 category = self.cms.uint32(15),
939 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff90'),
940 variable = self.cms.string(
'pt')
945 self.process.patTauDiscriminationByMediumElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
946 mapping = self.cms.VPSet(
948 category = self.cms.uint32(0),
949 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff80'),
950 variable = self.cms.string(
'pt')
953 category = self.cms.uint32(2),
954 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff80'),
955 variable = self.cms.string(
'pt')
958 category = self.cms.uint32(5),
959 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff80'),
960 variable = self.cms.string(
'pt')
963 category = self.cms.uint32(7),
964 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff80'),
965 variable = self.cms.string(
'pt')
968 category = self.cms.uint32(8),
969 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff80'),
970 variable = self.cms.string(
'pt')
973 category = self.cms.uint32(10),
974 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff80'),
975 variable = self.cms.string(
'pt')
978 category = self.cms.uint32(13),
979 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff80'),
980 variable = self.cms.string(
'pt')
983 category = self.cms.uint32(15),
984 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff80'),
985 variable = self.cms.string(
'pt')
990 self.process.patTauDiscriminationByTightElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
991 mapping = self.cms.VPSet(
993 category = self.cms.uint32(0),
994 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff70'),
995 variable = self.cms.string(
'pt')
998 category = self.cms.uint32(2),
999 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff70'),
1000 variable = self.cms.string(
'pt')
1003 category = self.cms.uint32(5),
1004 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff70'),
1005 variable = self.cms.string(
'pt')
1008 category = self.cms.uint32(7),
1009 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff70'),
1010 variable = self.cms.string(
'pt')
1013 category = self.cms.uint32(8),
1014 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff70'),
1015 variable = self.cms.string(
'pt')
1018 category = self.cms.uint32(10),
1019 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff70'),
1020 variable = self.cms.string(
'pt')
1023 category = self.cms.uint32(13),
1024 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff70'),
1025 variable = self.cms.string(
'pt')
1028 category = self.cms.uint32(15),
1029 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff70'),
1030 variable = self.cms.string(
'pt')
1035 self.process.patTauDiscriminationByVTightElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
1036 mapping = self.cms.VPSet(
1038 category = self.cms.uint32(0),
1039 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff60'),
1040 variable = self.cms.string(
'pt')
1043 category = self.cms.uint32(2),
1044 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff60'),
1045 variable = self.cms.string(
'pt')
1048 category = self.cms.uint32(5),
1049 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff60'),
1050 variable = self.cms.string(
'pt')
1053 category = self.cms.uint32(7),
1054 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff60'),
1055 variable = self.cms.string(
'pt')
1058 category = self.cms.uint32(8),
1059 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff60'),
1060 variable = self.cms.string(
'pt')
1063 category = self.cms.uint32(10),
1064 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff60'),
1065 variable = self.cms.string(
'pt')
1068 category = self.cms.uint32(13),
1069 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff60'),
1070 variable = self.cms.string(
'pt')
1073 category = self.cms.uint32(15),
1074 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff60'),
1075 variable = self.cms.string(
'pt')
1080 self.process.patTauDiscriminationByElectronRejectionMVA62018Task = self.cms.Task(
1081 self.process.patTauDiscriminationByElectronRejectionMVA62018Raw,
1082 self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018,
1083 self.process.patTauDiscriminationByLooseElectronRejectionMVA62018,
1084 self.process.patTauDiscriminationByMediumElectronRejectionMVA62018,
1085 self.process.patTauDiscriminationByTightElectronRejectionMVA62018,
1086 self.process.patTauDiscriminationByVTightElectronRejectionMVA62018
1088 self.process.patTauDiscriminationByElectronRejectionMVA62018Seq = self.cms.Sequence(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
1089 self.process.rerunMvaIsolationTask.add(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
1090 self.process.rerunMvaIsolationSequence += self.process.patTauDiscriminationByElectronRejectionMVA62018Seq
1092 _againstElectronTauIDSources = self.cms.PSet(
1093 againstElectronMVA6Raw2018 = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw"),
1094 againstElectronMVA6category2018 = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw",
"category"),
1095 againstElectronVLooseMVA62018 = self.cms.InputTag(
"patTauDiscriminationByVLooseElectronRejectionMVA62018"),
1096 againstElectronLooseMVA62018 = self.cms.InputTag(
"patTauDiscriminationByLooseElectronRejectionMVA62018"),
1097 againstElectronMediumMVA62018 = self.cms.InputTag(
"patTauDiscriminationByMediumElectronRejectionMVA62018"),
1098 againstElectronTightMVA62018 = self.cms.InputTag(
"patTauDiscriminationByTightElectronRejectionMVA62018"),
1099 againstElectronVTightMVA62018 = self.cms.InputTag(
"patTauDiscriminationByVTightElectronRejectionMVA62018")
1101 _tauIDSourcesWithAgainistEle = self.cms.PSet(
1102 tauIDSources.clone(),
1103 _againstElectronTauIDSources
1105 tauIDSources =_tauIDSourcesWithAgainistEle.clone()
1110 embedID = self.cms.EDProducer(
"PATTauIDEmbedder",
1111 src = self.cms.InputTag(
'slimmedTaus'),
1112 tauIDSources = tauIDSources
1116 tauIDSources = self.cms.PSet(
1123 for target,points
in six.iteritems(workingPoints_):
1124 cuts = self.cms.PSet()
1125 setattr(tauIDSources,
'by{}VS{}raw'.
format(producer_name[0].
upper()+producer_name[1:], target),
1126 self.cms.InputTag(producer_name,
'VS{}'.
format(target)))
1127 for point,cut
in six.iteritems(points):
1128 setattr(cuts, point, self.cms.string(
str(cut)))
1130 setattr(tauIDSources,
'by{}{}VS{}'.
format(point, producer_name[0].
upper()+producer_name[1:], target),
1131 self.cms.InputTag(producer_name,
'VS{}{}'.
format(target, point)))
1133 setattr(getattr(self.
process, producer_name),
'VS{}WP'.
format(target), cuts)
1137 """returns the DNN version. File name should contain a version label with data takig year (2011-2, 2015-8) and \ 1138 version number (vX), e.g. 2017v0, in general the following format: {year}v{version}""" 1139 version_search = re.search(
'201[125678]v([0-9]+)[\._]', file_name)
1140 if not version_search:
1141 raise RuntimeError(
'File "{}" has an invalid name pattern, should be in the format "{year}v{version}". \ 1142 Unable to extract version number.'.
format(file_name))
1143 version = version_search.group(1)
1147 """returns the DeepTau year, version, subversion. File name should contain a version label with data takig year \ 1148 (2011-2, 2015-8), version number (vX) and subversion (pX), e.g. 2017v0p6, in general the following format: \ 1149 {year}v{version}p{subversion}""" 1150 version_search = re.search(
'(201[125678])v([0-9]+)(p[0-9]+|)[\._]', file_name)
1151 if not version_search:
1152 raise RuntimeError(
'File "{}" has an invalid name pattern, should be in the format "{year}v{version}p{subversion}". \ 1153 Unable to extract version number.'.
format(file_name))
1154 year = version_search.group(1)
1155 version = version_search.group(2)
1156 subversion = version_search.group(3)
1157 if len(subversion) > 0:
1158 subversion = subversion[1:]
1161 return int(year),
int(version),
int(subversion)
tauIdDiscrMVA_2017_version
def is_above_cmssw_version(klass, release=9, subversion=4, patch=0, debug=False)
def getDeepTauVersion(self, file_name)
def get_cmssw_version_number(klass, debug=False)
tauIdDiscrMVA_WPs_run2_2017
def get_cmssw_version(debug=False)
tauIdDiscrMVA_trainings_run2_2017
def getDpfTauVersion(self, file_name)
def loadMVA_WPs_run2_2017(self)
S & print(S &os, JobReport::InputFile const &f)
rerunIsolationOldDMMVArun2016v1Task
def processDeepProducer(self, producer_name, tauIDSources, workingPoints_)
rerunIsolationNewDMMVArun2017v2Task
rerunIsolationOldDMdR0p3MVArun2017v2Task
rerunIsolationOldDMMVArun2017v2Task
rerunIsolationOldDMMVArun2017v1Task
rerunIsolationNewDMMVArun2016v1Task
def versionToInt(release=9, subversion=4, patch=0, debug=False)