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",
"DPFTau_2016_v0",
"DPFTau_2016_v1",
"againstEle2018" 15 def __init__(self, process, cms, debug = False,
16 updatedTauName =
"slimmedTausNewID",
17 toKeep = [
"deepTau2017v2"],
18 tauIdDiscrMVA_trainings_run2_2017 = {
'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017", },
19 tauIdDiscrMVA_WPs_run2_2017 = {
20 'tauIdMVAIsoDBoldDMwLT2017' : {
21 'Eff95' :
"DBoldDMwLTEff95",
22 'Eff90' :
"DBoldDMwLTEff90",
23 'Eff80' :
"DBoldDMwLTEff80",
24 'Eff70' :
"DBoldDMwLTEff70",
25 'Eff60' :
"DBoldDMwLTEff60",
26 'Eff50' :
"DBoldDMwLTEff50",
27 'Eff40' :
"DBoldDMwLTEff40" 30 tauIdDiscrMVA_2017_version =
"v1",
33 super(TauIDEmbedder, self).
__init__()
38 self.process.load(
'RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi')
39 if len(conditionDB) != 0:
40 self.process.CondDBTauConnection.connect = cms.string(conditionDB)
41 self.process.loadRecoTauTagMVAsFromPrepDB.connect = cms.string(conditionDB)
51 if discr
not in TauIDEmbedder.availableDiscriminators:
52 raise RuntimeError(
'TauIDEmbedder: discriminator "{}" is not supported'.
format(discr))
58 """returns 'CMSSW_X_Y_Z'""" 59 cmssw_version = os.environ[
"CMSSW_VERSION"]
60 if debug:
print (
"get_cmssw_version:", cmssw_version)
65 """returns '(release, subversion, patch)' (without 'CMSSW_')""" 66 v = klass.get_cmssw_version().
split(
"CMSSW_")[1].
split(
"_")[0:3]
67 if debug:
print (
"get_cmssw_version_number:", v)
72 return int(v[0]),
int(v[1]), patch
76 version = release * 10000 + subversion * 100 + patch + 1
77 if debug:
print (
"versionToInt:", version)
83 split_cmssw_version = klass.get_cmssw_version_number()
84 if klass.versionToInt(release, subversion, patch) > klass.versionToInt(split_cmssw_version[0], split_cmssw_version[1], split_cmssw_version[2]):
85 if debug:
print (
"is_above_cmssw_version:",
False)
88 if debug:
print (
"is_above_cmssw_version:",
True)
92 if self.
debug:
print (
"loadMVA_WPs_run2_2017: performed")
94 for training, gbrForestName
in self.tauIdDiscrMVA_trainings_run2_2017.items():
96 self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
98 record = self.cms.string(
'GBRWrapperRcd'),
105 self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
107 record = self.cms.string(
'PhysicsTGraphPayloadRcd'),
113 self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
115 record = self.cms.string(
'PhysicsTFormulaPayloadRcd'),
117 label = self.cms.untracked.string(
"RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, self.
tauIdDiscrMVA_2017_version))
122 self.process.rerunMvaIsolationTask = self.cms.Task()
123 self.process.rerunMvaIsolationSequence = self.cms.Sequence()
124 tauIDSources = self.cms.PSet()
127 if "2017v1" in self.
toKeep:
130 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
133 'tauIdMVAIsoDBoldDMwLT2017' : {
134 'Eff95' :
"DBoldDMwLTEff95",
135 'Eff90' :
"DBoldDMwLTEff90",
136 'Eff80' :
"DBoldDMwLTEff80",
137 'Eff70' :
"DBoldDMwLTEff70",
138 'Eff60' :
"DBoldDMwLTEff60",
139 'Eff50' :
"DBoldDMwLTEff50",
140 'Eff40' :
"DBoldDMwLTEff40" 145 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")
148 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
149 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
150 Prediscriminants = noPrediscriminants,
151 loadMVAfromDB = self.cms.bool(
True),
152 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),
153 mvaOpt = self.cms.string(
"DBoldDMwLTwGJ"),
154 verbosity = self.cms.int32(0)
157 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
158 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
159 Prediscriminants = noPrediscriminants,
160 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1raw'),
161 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1raw:category'),
162 loadMVAfromDB = self.cms.bool(
True),
163 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"),
164 mapping = self.cms.VPSet(
166 category = self.cms.uint32(0),
167 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff90"),
168 variable = self.cms.string(
"pt"),
173 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
174 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff95")
175 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
176 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff80")
177 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
178 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff70")
179 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
180 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff60")
181 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
182 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff50")
183 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
184 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff40")
187 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw,
188 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose,
189 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose,
190 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose,
191 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium,
192 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight,
193 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight,
194 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight
199 tauIDSources.byIsolationMVArun2017v1DBoldDMwLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1raw')
200 tauIDSources.byVVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose')
201 tauIDSources.byVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose')
202 tauIDSources.byLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1Loose')
203 tauIDSources.byMediumIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1Medium')
204 tauIDSources.byTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1Tight')
205 tauIDSources.byVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VTight')
206 tauIDSources.byVVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight')
209 if "2017v2" in self.
toKeep:
212 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
215 'tauIdMVAIsoDBoldDMwLT2017' : {
216 'Eff95' :
"DBoldDMwLTEff95",
217 'Eff90' :
"DBoldDMwLTEff90",
218 'Eff80' :
"DBoldDMwLTEff80",
219 'Eff70' :
"DBoldDMwLTEff70",
220 'Eff60' :
"DBoldDMwLTEff60",
221 'Eff50' :
"DBoldDMwLTEff50",
222 'Eff40' :
"DBoldDMwLTEff40" 227 if self.
debug:
print (
"runTauID: not is_above_cmssw_version(9, 4, 5). Will update the list of available in DB samples to access 2017v2")
230 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
231 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
232 Prediscriminants = noPrediscriminants,
233 loadMVAfromDB = self.cms.bool(
True),
234 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),
235 mvaOpt = self.cms.string(
"DBoldDMwLTwGJ"),
236 verbosity = self.cms.int32(0)
239 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
240 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
241 Prediscriminants = noPrediscriminants,
242 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2raw'),
243 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2raw:category'),
244 loadMVAfromDB = self.cms.bool(
True),
245 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"),
246 mapping = self.cms.VPSet(
248 category = self.cms.uint32(0),
249 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff90"),
250 variable = self.cms.string(
"pt"),
253 verbosity = self.cms.int32(0)
256 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
257 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff95")
258 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
259 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff80")
260 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
261 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff70")
262 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
263 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff60")
264 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
265 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff50")
266 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
267 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff40")
270 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw,
271 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose,
272 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose,
273 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Loose,
274 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Medium,
275 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Tight,
276 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VTight,
277 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight
282 tauIDSources.byIsolationMVArun2017v2DBoldDMwLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2raw')
283 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose')
284 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose')
285 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2Loose')
286 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2Medium')
287 tauIDSources.byTightIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2Tight')
288 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2VTight')
289 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight')
291 if "newDM2017v2" in self.
toKeep:
294 'tauIdMVAIsoDBnewDMwLT2017' :
"tauIdMVAIsoDBnewDMwLT2017",
297 'tauIdMVAIsoDBnewDMwLT2017' : {
298 'Eff95' :
"DBnewDMwLTEff95",
299 'Eff90' :
"DBnewDMwLTEff90",
300 'Eff80' :
"DBnewDMwLTEff80",
301 'Eff70' :
"DBnewDMwLTEff70",
302 'Eff60' :
"DBnewDMwLTEff60",
303 'Eff50' :
"DBnewDMwLTEff50",
304 'Eff40' :
"DBnewDMwLTEff40" 309 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")
312 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
313 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
314 Prediscriminants = noPrediscriminants,
315 loadMVAfromDB = self.cms.bool(
True),
316 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),
317 mvaOpt = self.cms.string(
"DBnewDMwLTwGJ"),
318 verbosity = self.cms.int32(0)
321 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
322 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
323 Prediscriminants = noPrediscriminants,
324 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2raw'),
325 key = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2raw:category'),
326 loadMVAfromDB = self.cms.bool(
True),
327 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"),
328 mapping = self.cms.VPSet(
330 category = self.cms.uint32(0),
331 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff90"),
332 variable = self.cms.string(
"pt"),
335 verbosity = self.cms.int32(0)
338 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
339 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff95")
340 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
341 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff80")
342 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
343 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff70")
344 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
345 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff60")
346 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
347 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff50")
348 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
349 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff40")
352 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw,
353 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose,
354 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose,
355 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose,
356 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium,
357 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight,
358 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight,
359 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight
364 tauIDSources.byIsolationMVArun2017v2DBnewDMwLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2raw')
365 tauIDSources.byVVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose')
366 tauIDSources.byVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose')
367 tauIDSources.byLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2Loose')
368 tauIDSources.byMediumIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2Medium')
369 tauIDSources.byTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2Tight')
370 tauIDSources.byVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VTight')
371 tauIDSources.byVVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight')
373 if "dR0p32017v2" in self.
toKeep:
376 'tauIdMVAIsoDBoldDMdR0p3wLT2017' :
"tauIdMVAIsoDBoldDMdR0p3wLT2017",
379 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : {
380 'Eff95' :
"DBoldDMdR0p3wLTEff95",
381 'Eff90' :
"DBoldDMdR0p3wLTEff90",
382 'Eff80' :
"DBoldDMdR0p3wLTEff80",
383 'Eff70' :
"DBoldDMdR0p3wLTEff70",
384 'Eff60' :
"DBoldDMdR0p3wLTEff60",
385 'Eff50' :
"DBoldDMdR0p3wLTEff50",
386 'Eff40' :
"DBoldDMdR0p3wLTEff40" 391 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")
394 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
395 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
396 Prediscriminants = noPrediscriminants,
397 loadMVAfromDB = self.cms.bool(
True),
398 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
399 mvaOpt = self.cms.string(
"DBoldDMwLTwGJ"),
400 srcChargedIsoPtSum = self.cms.string(
'chargedIsoPtSumdR03'),
401 srcFootprintCorrection = self.cms.string(
'footprintCorrectiondR03'),
402 srcNeutralIsoPtSum = self.cms.string(
'neutralIsoPtSumdR03'),
403 srcPhotonPtSumOutsideSignalCone = self.cms.string(
'photonPtSumOutsideSignalConedR03'),
404 verbosity = self.cms.int32(0)
407 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
408 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
409 Prediscriminants = noPrediscriminants,
410 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw'),
411 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw:category'),
412 loadMVAfromDB = self.cms.bool(
True),
413 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"),
414 mapping = self.cms.VPSet(
416 category = self.cms.uint32(0),
417 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff90"),
418 variable = self.cms.string(
"pt"),
421 verbosity = self.cms.int32(0)
424 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
425 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff95")
426 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
427 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff80")
428 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
429 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff70")
430 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
431 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff60")
432 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
433 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff50")
434 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
435 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff40")
438 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw,
439 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose,
440 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose,
441 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose,
442 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium,
443 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight,
444 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight,
445 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight
450 tauIDSources.byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw')
451 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose')
452 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose')
453 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose')
454 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium')
455 tauIDSources.byTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight')
456 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight')
457 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight')
486 if "2016v1" in self.
toKeep:
487 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
488 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
489 Prediscriminants = noPrediscriminants,
490 loadMVAfromDB = self.cms.bool(
True),
491 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
492 mvaOpt = self.cms.string(
"DBoldDMwLT"),
493 verbosity = self.cms.int32(0)
496 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
497 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
498 Prediscriminants = noPrediscriminants,
499 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1raw'),
500 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1raw:category'),
501 loadMVAfromDB = self.cms.bool(
True),
502 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_mvaOutput_normalization"),
503 mapping = self.cms.VPSet(
505 category = self.cms.uint32(0),
506 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff90"),
507 variable = self.cms.string(
"pt"),
512 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
513 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff80")
514 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
515 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff70")
516 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
517 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff60")
518 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
519 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff50")
520 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
521 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff40")
524 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw,
525 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose,
526 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose,
527 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium,
528 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight,
529 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight,
530 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight
535 tauIDSources.byIsolationMVArun2v1DBoldDMwLTraw2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1raw')
536 tauIDSources.byVLooseIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1VLoose')
537 tauIDSources.byLooseIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1Loose')
538 tauIDSources.byMediumIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1Medium')
539 tauIDSources.byTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1Tight')
540 tauIDSources.byVTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1VTight')
541 tauIDSources.byVVTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1VVTight')
544 if "newDM2016v1" in self.
toKeep:
545 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
546 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
547 Prediscriminants = noPrediscriminants,
548 loadMVAfromDB = self.cms.bool(
True),
549 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1"),
550 mvaOpt = self.cms.string(
"DBnewDMwLT"),
551 verbosity = self.cms.int32(0)
554 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
555 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
556 Prediscriminants = noPrediscriminants,
557 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1raw'),
558 key = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1raw:category'),
559 loadMVAfromDB = self.cms.bool(
True),
560 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_mvaOutput_normalization"),
561 mapping = self.cms.VPSet(
563 category = self.cms.uint32(0),
564 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff90"),
565 variable = self.cms.string(
"pt"),
570 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
571 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff80")
572 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
573 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff70")
574 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
575 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff60")
576 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
577 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff50")
578 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
579 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff40")
582 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw,
583 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose,
584 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose,
585 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium,
586 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight,
587 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight,
588 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight
593 tauIDSources.byIsolationMVArun2v1DBnewDMwLTraw2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1raw')
594 tauIDSources.byVLooseIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1VLoose')
595 tauIDSources.byLooseIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1Loose')
596 tauIDSources.byMediumIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1Medium')
597 tauIDSources.byTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1Tight')
598 tauIDSources.byVTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1VTight')
599 tauIDSources.byVVTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1VVTight')
601 if "deepTau2017v1" in self.
toKeep:
602 if self.
debug:
print (
"Adding DeepTau IDs")
606 "VVVLoose" : 0.96424,
616 "VVVLoose" : 0.959619,
617 "VVLoose" : 0.997687,
637 file_names = [
'RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v1_20L1024N_quantized.pb']
638 self.process.deepTau2017v1 = self.cms.EDProducer(
"DeepTauId",
639 electrons = self.cms.InputTag(
'slimmedElectrons'),
640 muons = self.cms.InputTag(
'slimmedMuons'),
641 taus = self.cms.InputTag(
'slimmedTaus'),
642 pfcands = self.cms.InputTag(
'packedPFCandidates'),
643 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
644 rho = self.cms.InputTag(
'fixedGridRhoAll'),
645 graph_file = self.cms.vstring(file_names),
646 mem_mapped = self.cms.bool(
False),
652 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v1)
653 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v1
655 if "deepTau2017v2" in self.
toKeep:
656 if self.
debug:
print (
"Adding DeepTau IDs")
660 "VVVLoose": 0.0630386,
661 "VVLoose": 0.1686942,
667 "VVTight": 0.9928449,
676 "VVVLoose": 0.2599605,
677 "VVLoose": 0.4249705,
683 "VVTight": 0.9733927,
688 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
689 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
690 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
692 self.process.deepTau2017v2 = self.cms.EDProducer(
"DeepTauId",
693 electrons = self.cms.InputTag(
'slimmedElectrons'),
694 muons = self.cms.InputTag(
'slimmedMuons'),
695 taus = self.cms.InputTag(
'slimmedTaus'),
696 pfcands = self.cms.InputTag(
'packedPFCandidates'),
697 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
698 rho = self.cms.InputTag(
'fixedGridRhoAll'),
699 graph_file = self.cms.vstring(file_names),
700 mem_mapped = self.cms.bool(
True),
702 debug_level = self.cms.int32(0)
708 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v2)
709 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v2
711 if "DPFTau_2016_v0" in self.
toKeep:
712 if self.
debug:
print (
"Adding DPFTau isolation (v0)")
716 "Tight" :
"if(decayMode == 0) return (0.898328 - 0.000160992 * pt);" + \
717 "if(decayMode == 1) return (0.910138 - 0.000229923 * pt);" + \
718 "if(decayMode == 10) return (0.873958 - 0.0002328 * pt);" + \
728 file_names = [
'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb' ]
729 self.process.dpfTau2016v0 = self.cms.EDProducer(
"DPFIsolation",
730 pfcands = self.cms.InputTag(
'packedPFCandidates'),
731 taus = self.cms.InputTag(
'slimmedTaus'),
732 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
733 graph_file = self.cms.vstring(file_names),
735 mem_mapped = self.cms.bool(
False)
740 self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v0)
741 self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v0
744 if "DPFTau_2016_v1" in self.
toKeep:
745 print (
"Adding DPFTau isolation (v1)")
746 print (
"WARNING: WPs are not defined for DPFTau_2016_v1")
747 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).")
750 "all": {
"Tight" : 0.123}
753 file_names = [
'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v1_quantized.pb' ]
754 self.process.dpfTau2016v1 = self.cms.EDProducer(
"DPFIsolation",
755 pfcands = self.cms.InputTag(
'packedPFCandidates'),
756 taus = self.cms.InputTag(
'slimmedTaus'),
757 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
758 graph_file = self.cms.vstring(file_names),
760 mem_mapped = self.cms.bool(
False)
765 self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v1)
766 self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v1
768 if "againstEle2018" in self.
toKeep:
769 antiElectronDiscrMVA6_version =
"MVA6v3_noeveto" 772 from RecoTauTag.RecoTau.PATTauDiscriminationAgainstElectronMVA6_cfi
import patTauDiscriminationAgainstElectronMVA6
773 self.process.patTauDiscriminationByElectronRejectionMVA62018Raw = patTauDiscriminationAgainstElectronMVA6.clone(
774 Prediscriminants = noPrediscriminants,
775 vetoEcalCracks = self.cms.bool(
False),
776 mvaName_NoEleMatch_wGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL',
777 mvaName_NoEleMatch_wGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC',
778 mvaName_NoEleMatch_woGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL',
779 mvaName_NoEleMatch_woGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC',
780 mvaName_wGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL',
781 mvaName_wGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC',
782 mvaName_woGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL',
783 mvaName_woGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC' 788 self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018 = patTauDiscriminantCutMultiplexer.clone(
789 PATTauProducer = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.PATTauProducer,
790 Prediscriminants = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.Prediscriminants,
791 toMultiplex = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw"),
792 key = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw",
"category"),
793 mapping = self.cms.VPSet(
795 category = self.cms.uint32(0),
796 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff98'),
797 variable = self.cms.string(
'pt')
800 category = self.cms.uint32(2),
801 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff98'),
802 variable = self.cms.string(
'pt')
805 category = self.cms.uint32(5),
806 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff98'),
807 variable = self.cms.string(
'pt')
810 category = self.cms.uint32(7),
811 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff98'),
812 variable = self.cms.string(
'pt')
815 category = self.cms.uint32(8),
816 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff98'),
817 variable = self.cms.string(
'pt')
820 category = self.cms.uint32(10),
821 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff98'),
822 variable = self.cms.string(
'pt')
825 category = self.cms.uint32(13),
826 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff98'),
827 variable = self.cms.string(
'pt')
830 category = self.cms.uint32(15),
831 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff98'),
832 variable = self.cms.string(
'pt')
837 self.process.patTauDiscriminationByLooseElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
838 mapping = self.cms.VPSet(
840 category = self.cms.uint32(0),
841 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff90'),
842 variable = self.cms.string(
'pt')
845 category = self.cms.uint32(2),
846 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff90'),
847 variable = self.cms.string(
'pt')
850 category = self.cms.uint32(5),
851 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff90'),
852 variable = self.cms.string(
'pt')
855 category = self.cms.uint32(7),
856 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff90'),
857 variable = self.cms.string(
'pt')
860 category = self.cms.uint32(8),
861 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff90'),
862 variable = self.cms.string(
'pt')
865 category = self.cms.uint32(10),
866 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff90'),
867 variable = self.cms.string(
'pt')
870 category = self.cms.uint32(13),
871 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff90'),
872 variable = self.cms.string(
'pt')
875 category = self.cms.uint32(15),
876 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff90'),
877 variable = self.cms.string(
'pt')
882 self.process.patTauDiscriminationByMediumElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
883 mapping = self.cms.VPSet(
885 category = self.cms.uint32(0),
886 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff80'),
887 variable = self.cms.string(
'pt')
890 category = self.cms.uint32(2),
891 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff80'),
892 variable = self.cms.string(
'pt')
895 category = self.cms.uint32(5),
896 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff80'),
897 variable = self.cms.string(
'pt')
900 category = self.cms.uint32(7),
901 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff80'),
902 variable = self.cms.string(
'pt')
905 category = self.cms.uint32(8),
906 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff80'),
907 variable = self.cms.string(
'pt')
910 category = self.cms.uint32(10),
911 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff80'),
912 variable = self.cms.string(
'pt')
915 category = self.cms.uint32(13),
916 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff80'),
917 variable = self.cms.string(
'pt')
920 category = self.cms.uint32(15),
921 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff80'),
922 variable = self.cms.string(
'pt')
927 self.process.patTauDiscriminationByTightElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
928 mapping = self.cms.VPSet(
930 category = self.cms.uint32(0),
931 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff70'),
932 variable = self.cms.string(
'pt')
935 category = self.cms.uint32(2),
936 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff70'),
937 variable = self.cms.string(
'pt')
940 category = self.cms.uint32(5),
941 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff70'),
942 variable = self.cms.string(
'pt')
945 category = self.cms.uint32(7),
946 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff70'),
947 variable = self.cms.string(
'pt')
950 category = self.cms.uint32(8),
951 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff70'),
952 variable = self.cms.string(
'pt')
955 category = self.cms.uint32(10),
956 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff70'),
957 variable = self.cms.string(
'pt')
960 category = self.cms.uint32(13),
961 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff70'),
962 variable = self.cms.string(
'pt')
965 category = self.cms.uint32(15),
966 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff70'),
967 variable = self.cms.string(
'pt')
972 self.process.patTauDiscriminationByVTightElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
973 mapping = self.cms.VPSet(
975 category = self.cms.uint32(0),
976 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff60'),
977 variable = self.cms.string(
'pt')
980 category = self.cms.uint32(2),
981 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff60'),
982 variable = self.cms.string(
'pt')
985 category = self.cms.uint32(5),
986 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff60'),
987 variable = self.cms.string(
'pt')
990 category = self.cms.uint32(7),
991 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff60'),
992 variable = self.cms.string(
'pt')
995 category = self.cms.uint32(8),
996 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff60'),
997 variable = self.cms.string(
'pt')
1000 category = self.cms.uint32(10),
1001 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff60'),
1002 variable = self.cms.string(
'pt')
1005 category = self.cms.uint32(13),
1006 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff60'),
1007 variable = self.cms.string(
'pt')
1010 category = self.cms.uint32(15),
1011 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff60'),
1012 variable = self.cms.string(
'pt')
1017 self.process.patTauDiscriminationByElectronRejectionMVA62018Task = self.cms.Task(
1018 self.process.patTauDiscriminationByElectronRejectionMVA62018Raw,
1019 self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018,
1020 self.process.patTauDiscriminationByLooseElectronRejectionMVA62018,
1021 self.process.patTauDiscriminationByMediumElectronRejectionMVA62018,
1022 self.process.patTauDiscriminationByTightElectronRejectionMVA62018,
1023 self.process.patTauDiscriminationByVTightElectronRejectionMVA62018
1025 self.process.patTauDiscriminationByElectronRejectionMVA62018Seq = self.cms.Sequence(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
1026 self.process.rerunMvaIsolationTask.add(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
1027 self.process.rerunMvaIsolationSequence += self.process.patTauDiscriminationByElectronRejectionMVA62018Seq
1029 _againstElectronTauIDSources = self.cms.PSet(
1030 againstElectronMVA6Raw2018 = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw"),
1031 againstElectronMVA6category2018 = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw",
"category"),
1032 againstElectronVLooseMVA62018 = self.cms.InputTag(
"patTauDiscriminationByVLooseElectronRejectionMVA62018"),
1033 againstElectronLooseMVA62018 = self.cms.InputTag(
"patTauDiscriminationByLooseElectronRejectionMVA62018"),
1034 againstElectronMediumMVA62018 = self.cms.InputTag(
"patTauDiscriminationByMediumElectronRejectionMVA62018"),
1035 againstElectronTightMVA62018 = self.cms.InputTag(
"patTauDiscriminationByTightElectronRejectionMVA62018"),
1036 againstElectronVTightMVA62018 = self.cms.InputTag(
"patTauDiscriminationByVTightElectronRejectionMVA62018")
1038 _tauIDSourcesWithAgainistEle = self.cms.PSet(
1039 tauIDSources.clone(),
1040 _againstElectronTauIDSources
1042 tauIDSources =_tauIDSourcesWithAgainistEle.clone()
1047 embedID = self.cms.EDProducer(
"PATTauIDEmbedder",
1048 src = self.cms.InputTag(
'slimmedTaus'),
1049 tauIDSources = tauIDSources
1053 tauIDSources = self.cms.PSet(
1060 for target,points
in six.iteritems(workingPoints_):
1061 cuts = self.cms.PSet()
1062 setattr(tauIDSources,
'by{}VS{}raw'.
format(producer_name[0].
upper()+producer_name[1:], target),
1063 self.cms.InputTag(producer_name,
'VS{}'.
format(target)))
1064 for point,cut
in six.iteritems(points):
1065 setattr(cuts, point, self.cms.string(
str(cut)))
1067 setattr(tauIDSources,
'by{}{}VS{}'.
format(point, producer_name[0].
upper()+producer_name[1:], target),
1068 self.cms.InputTag(producer_name,
'VS{}{}'.
format(target, point)))
1070 setattr(getattr(self.
process, producer_name),
'VS{}WP'.
format(target), cuts)
1074 """returns the DNN version. File name should contain a version label with data takig year (2011-2, 2015-8) and \ 1075 version number (vX), e.g. 2017v0, in general the following format: {year}v{version}""" 1076 version_search = re.search(
'201[125678]v([0-9]+)[\._]', file_name)
1077 if not version_search:
1078 raise RuntimeError(
'File "{}" has an invalid name pattern, should be in the format "{year}v{version}". \ 1079 Unable to extract version number.'.
format(file_name))
1080 version = version_search.group(1)
1084 """returns the DeepTau year, version, subversion. File name should contain a version label with data takig year \ 1085 (2011-2, 2015-8), version number (vX) and subversion (pX), e.g. 2017v0p6, in general the following format: \ 1086 {year}v{version}p{subversion}""" 1087 version_search = re.search(
'(201[125678])v([0-9]+)(p[0-9]+|)[\._]', file_name)
1088 if not version_search:
1089 raise RuntimeError(
'File "{}" has an invalid name pattern, should be in the format "{year}v{version}p{subversion}". \ 1090 Unable to extract version number.'.
format(file_name))
1091 year = version_search.group(1)
1092 version = version_search.group(2)
1093 subversion = version_search.group(3)
1094 if len(subversion) > 0:
1095 subversion = subversion[1:]
1098 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)