7 """class to rerun the tau seq and acces trainings from the database""" 8 availableDiscriminators = [
9 "2017v1",
"2017v2",
"newDM2017v2",
"dR0p32017v2",
"2016v1",
"newDM2016v1",
10 "deepTau2017v1",
"deepTau2017v2",
"deepTau2017v2p1",
11 "DPFTau_2016_v0",
"DPFTau_2016_v1",
15 def __init__(self, process, cms, debug = False,
16 updatedTauName =
"slimmedTausNewID",
17 toKeep = [
"deepTau2017v2p1"],
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 requireDecayMode = self.cms.bool(
True),
155 verbosity = self.cms.int32(0)
158 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
159 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
160 Prediscriminants = noPrediscriminants,
161 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1raw'),
162 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1raw:category'),
163 loadMVAfromDB = self.cms.bool(
True),
164 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"),
165 mapping = self.cms.VPSet(
167 category = self.cms.uint32(0),
168 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff90"),
169 variable = self.cms.string(
"pt"),
174 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
175 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff95")
176 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
177 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff80")
178 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
179 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff70")
180 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
181 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff60")
182 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
183 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff50")
184 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
185 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff40")
188 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw,
189 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose,
190 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose,
191 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose,
192 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium,
193 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight,
194 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight,
195 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight
200 tauIDSources.byIsolationMVArun2017v1DBoldDMwLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1raw')
201 tauIDSources.byVVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose')
202 tauIDSources.byVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose')
203 tauIDSources.byLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1Loose')
204 tauIDSources.byMediumIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1Medium')
205 tauIDSources.byTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1Tight')
206 tauIDSources.byVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VTight')
207 tauIDSources.byVVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight')
210 if "2017v2" in self.
toKeep:
213 'tauIdMVAIsoDBoldDMwLT2017' :
"tauIdMVAIsoDBoldDMwLT2017",
216 'tauIdMVAIsoDBoldDMwLT2017' : {
217 'Eff95' :
"DBoldDMwLTEff95",
218 'Eff90' :
"DBoldDMwLTEff90",
219 'Eff80' :
"DBoldDMwLTEff80",
220 'Eff70' :
"DBoldDMwLTEff70",
221 'Eff60' :
"DBoldDMwLTEff60",
222 'Eff50' :
"DBoldDMwLTEff50",
223 'Eff40' :
"DBoldDMwLTEff40" 228 if self.
debug:
print "runTauID: not is_above_cmssw_version(9, 4, 5). Will update the list of available in DB samples to access 2017v2" 231 self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
232 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
233 Prediscriminants = noPrediscriminants,
234 loadMVAfromDB = self.cms.bool(
True),
235 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),
236 mvaOpt = self.cms.string(
"DBoldDMwLTwGJ"),
237 requireDecayMode = self.cms.bool(
True),
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 requireDecayMode = self.cms.bool(
True),
321 verbosity = self.cms.int32(0)
324 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
325 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
326 Prediscriminants = noPrediscriminants,
327 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2raw'),
328 key = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2raw:category'),
329 loadMVAfromDB = self.cms.bool(
True),
330 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"),
331 mapping = self.cms.VPSet(
333 category = self.cms.uint32(0),
334 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff90"),
335 variable = self.cms.string(
"pt"),
338 verbosity = self.cms.int32(0)
341 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
342 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff95")
343 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
344 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff80")
345 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
346 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff70")
347 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
348 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff60")
349 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
350 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff50")
351 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
352 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff40")
355 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw,
356 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose,
357 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose,
358 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose,
359 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium,
360 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight,
361 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight,
362 self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight
367 tauIDSources.byIsolationMVArun2017v2DBnewDMwLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2raw')
368 tauIDSources.byVVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose')
369 tauIDSources.byVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose')
370 tauIDSources.byLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2Loose')
371 tauIDSources.byMediumIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2Medium')
372 tauIDSources.byTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2Tight')
373 tauIDSources.byVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VTight')
374 tauIDSources.byVVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight')
376 if "dR0p32017v2" in self.
toKeep:
379 'tauIdMVAIsoDBoldDMdR0p3wLT2017' :
"tauIdMVAIsoDBoldDMdR0p3wLT2017",
382 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : {
383 'Eff95' :
"DBoldDMdR0p3wLTEff95",
384 'Eff90' :
"DBoldDMdR0p3wLTEff90",
385 'Eff80' :
"DBoldDMdR0p3wLTEff80",
386 'Eff70' :
"DBoldDMdR0p3wLTEff70",
387 'Eff60' :
"DBoldDMdR0p3wLTEff60",
388 'Eff50' :
"DBoldDMdR0p3wLTEff50",
389 'Eff40' :
"DBoldDMdR0p3wLTEff40" 394 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" 397 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
398 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
399 Prediscriminants = noPrediscriminants,
400 loadMVAfromDB = self.cms.bool(
True),
401 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
402 mvaOpt = self.cms.string(
"DBoldDMwLTwGJ"),
403 requireDecayMode = self.cms.bool(
True),
404 srcChargedIsoPtSum = self.cms.string(
'chargedIsoPtSumdR03'),
405 srcFootprintCorrection = self.cms.string(
'footprintCorrectiondR03'),
406 srcNeutralIsoPtSum = self.cms.string(
'neutralIsoPtSumdR03'),
407 srcPhotonPtSumOutsideSignalCone = self.cms.string(
'photonPtSumOutsideSignalConedR03'),
408 verbosity = self.cms.int32(0)
411 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
412 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
413 Prediscriminants = noPrediscriminants,
414 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw'),
415 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw:category'),
416 loadMVAfromDB = self.cms.bool(
True),
417 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"),
418 mapping = self.cms.VPSet(
420 category = self.cms.uint32(0),
421 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff90"),
422 variable = self.cms.string(
"pt"),
425 verbosity = self.cms.int32(0)
428 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
429 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff95")
430 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
431 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff80")
432 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
433 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff70")
434 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
435 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff60")
436 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
437 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff50")
438 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
439 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff40")
442 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw,
443 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose,
444 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose,
445 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose,
446 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium,
447 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight,
448 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight,
449 self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight
454 tauIDSources.byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw')
455 tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose')
456 tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose')
457 tauIDSources.byLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose')
458 tauIDSources.byMediumIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium')
459 tauIDSources.byTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight')
460 tauIDSources.byVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight')
461 tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight')
491 if "2016v1" in self.
toKeep:
492 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
493 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
494 Prediscriminants = noPrediscriminants,
495 loadMVAfromDB = self.cms.bool(
True),
496 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
497 mvaOpt = self.cms.string(
"DBoldDMwLT"),
498 requireDecayMode = self.cms.bool(
True),
499 verbosity = self.cms.int32(0)
502 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
503 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
504 Prediscriminants = noPrediscriminants,
505 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1raw'),
506 key = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1raw:category'),
507 loadMVAfromDB = self.cms.bool(
True),
508 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_mvaOutput_normalization"),
509 mapping = self.cms.VPSet(
511 category = self.cms.uint32(0),
512 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff90"),
513 variable = self.cms.string(
"pt"),
518 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
519 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff80")
520 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
521 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff70")
522 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
523 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff60")
524 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
525 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff50")
526 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
527 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff40")
530 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw,
531 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose,
532 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose,
533 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium,
534 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight,
535 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight,
536 self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight
541 tauIDSources.byIsolationMVArun2v1DBoldDMwLTraw2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1raw')
542 tauIDSources.byVLooseIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1VLoose')
543 tauIDSources.byLooseIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1Loose')
544 tauIDSources.byMediumIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1Medium')
545 tauIDSources.byTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1Tight')
546 tauIDSources.byVTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1VTight')
547 tauIDSources.byVVTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationOldDMMVArun2v1VVTight')
550 if "newDM2016v1" in self.
toKeep:
551 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
552 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
553 Prediscriminants = noPrediscriminants,
554 loadMVAfromDB = self.cms.bool(
True),
555 mvaName = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1"),
556 mvaOpt = self.cms.string(
"DBnewDMwLT"),
557 requireDecayMode = self.cms.bool(
True),
558 verbosity = self.cms.int32(0)
561 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
562 PATTauProducer = self.cms.InputTag(
'slimmedTaus'),
563 Prediscriminants = noPrediscriminants,
564 toMultiplex = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1raw'),
565 key = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1raw:category'),
566 loadMVAfromDB = self.cms.bool(
True),
567 mvaOutput_normalization = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_mvaOutput_normalization"),
568 mapping = self.cms.VPSet(
570 category = self.cms.uint32(0),
571 cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff90"),
572 variable = self.cms.string(
"pt"),
577 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
578 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff80")
579 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
580 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff70")
581 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
582 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff60")
583 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
584 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff50")
585 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
586 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight.mapping[0].cut = self.cms.string(
"RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff40")
589 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw,
590 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose,
591 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose,
592 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium,
593 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight,
594 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight,
595 self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight
600 tauIDSources.byIsolationMVArun2v1DBnewDMwLTraw2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1raw')
601 tauIDSources.byVLooseIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1VLoose')
602 tauIDSources.byLooseIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1Loose')
603 tauIDSources.byMediumIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1Medium')
604 tauIDSources.byTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1Tight')
605 tauIDSources.byVTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1VTight')
606 tauIDSources.byVVTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag(
'rerunDiscriminationByIsolationNewDMMVArun2v1VVTight')
608 if "deepTau2017v1" in self.
toKeep:
609 if self.
debug:
print "Adding DeepTau IDs" 614 "VVVLoose" : 0.96424,
624 "VVVLoose" : 0.959619,
625 "VVLoose" : 0.997687,
645 file_names = [
'RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v1_20L1024N_quantized.pb']
646 self.process.deepTau2017v1 = self.cms.EDProducer(
"DeepTauId",
647 electrons = self.cms.InputTag(
'slimmedElectrons'),
648 muons = self.cms.InputTag(
'slimmedMuons'),
649 taus = self.cms.InputTag(
'slimmedTaus'),
650 pfcands = self.cms.InputTag(
'packedPFCandidates'),
651 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
652 rho = self.cms.InputTag(
'fixedGridRhoAll'),
653 graph_file = self.cms.vstring(file_names),
654 mem_mapped = self.cms.bool(
False),
656 debug_level = self.cms.int32(0),
657 disable_dxy_pca = self.cms.bool(
False)
662 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v1)
663 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v1
665 if "deepTau2017v2" in self.
toKeep:
666 if self.
debug:
print "Adding DeepTau IDs" 670 "VVVLoose": 0.0630386,
671 "VVLoose": 0.1686942,
677 "VVTight": 0.9928449,
686 "VVVLoose": 0.2599605,
687 "VVLoose": 0.4249705,
693 "VVTight": 0.9733927,
698 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
699 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
700 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
702 self.process.deepTau2017v2 = self.cms.EDProducer(
"DeepTauId",
703 electrons = self.cms.InputTag(
'slimmedElectrons'),
704 muons = self.cms.InputTag(
'slimmedMuons'),
705 taus = self.cms.InputTag(
'slimmedTaus'),
706 pfcands = self.cms.InputTag(
'packedPFCandidates'),
707 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
708 rho = self.cms.InputTag(
'fixedGridRhoAll'),
709 graph_file = self.cms.vstring(file_names),
710 mem_mapped = self.cms.bool(
True),
712 debug_level = self.cms.int32(0),
713 disable_dxy_pca = self.cms.bool(
False)
719 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v2)
720 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v2
722 if "deepTau2017v2p1" in self.
toKeep:
723 if self.
debug:
print "Adding DeepTau IDs" 727 "VVVLoose": 0.0630386,
728 "VVLoose": 0.1686942,
734 "VVTight": 0.9928449,
743 "VVVLoose": 0.2599605,
744 "VVLoose": 0.4249705,
750 "VVTight": 0.9733927,
755 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
756 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
757 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
759 self.process.deepTau2017v2p1 = self.cms.EDProducer(
"DeepTauId",
760 electrons = self.cms.InputTag(
'slimmedElectrons'),
761 muons = self.cms.InputTag(
'slimmedMuons'),
762 taus = self.cms.InputTag(
'slimmedTaus'),
763 pfcands = self.cms.InputTag(
'packedPFCandidates'),
764 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
765 rho = self.cms.InputTag(
'fixedGridRhoAll'),
766 graph_file = self.cms.vstring(file_names),
767 mem_mapped = self.cms.bool(
True),
769 debug_level = self.cms.int32(0),
770 disable_dxy_pca = self.cms.bool(
True)
776 self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v2p1)
777 self.process.rerunMvaIsolationSequence += self.process.deepTau2017v2p1
779 if "DPFTau_2016_v0" in self.
toKeep:
780 if self.
debug:
print "Adding DPFTau isolation (v0)" 785 "Tight" :
"if(decayMode == 0) return (0.898328 - 0.000160992 * pt);" + \
786 "if(decayMode == 1) return (0.910138 - 0.000229923 * pt);" + \
787 "if(decayMode == 10) return (0.873958 - 0.0002328 * pt);" + \
797 file_names = [
'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb' ]
798 self.process.dpfTau2016v0 = self.cms.EDProducer(
"DPFIsolation",
799 pfcands = self.cms.InputTag(
'packedPFCandidates'),
800 taus = self.cms.InputTag(
'slimmedTaus'),
801 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
802 graph_file = self.cms.vstring(file_names),
804 mem_mapped = self.cms.bool(
False)
809 self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v0)
810 self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v0
813 if "DPFTau_2016_v1" in self.
toKeep:
814 print "Adding DPFTau isolation (v1)" 815 print "WARNING: WPs are not defined for DPFTau_2016_v1" 816 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)." 819 "all": {
"Tight" : 0.123}
822 file_names = [
'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v1_quantized.pb' ]
823 self.process.dpfTau2016v1 = self.cms.EDProducer(
"DPFIsolation",
824 pfcands = self.cms.InputTag(
'packedPFCandidates'),
825 taus = self.cms.InputTag(
'slimmedTaus'),
826 vertices = self.cms.InputTag(
'offlineSlimmedPrimaryVertices'),
827 graph_file = self.cms.vstring(file_names),
829 mem_mapped = self.cms.bool(
False)
834 self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v1)
835 self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v1
837 if "againstEle2018" in self.
toKeep:
838 antiElectronDiscrMVA6_version =
"MVA6v3_noeveto" 841 from RecoTauTag.RecoTau.PATTauDiscriminationAgainstElectronMVA6_cfi
import patTauDiscriminationAgainstElectronMVA6
842 self.process.patTauDiscriminationByElectronRejectionMVA62018Raw = patTauDiscriminationAgainstElectronMVA6.clone(
843 Prediscriminants = noPrediscriminants,
844 vetoEcalCracks = self.cms.bool(
False),
845 mvaName_NoEleMatch_wGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL',
846 mvaName_NoEleMatch_wGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC',
847 mvaName_NoEleMatch_woGwoGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL',
848 mvaName_NoEleMatch_woGwoGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC',
849 mvaName_wGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL',
850 mvaName_wGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC',
851 mvaName_woGwGSF_BL =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL',
852 mvaName_woGwGSF_EC =
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC' 857 self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018 = patTauDiscriminantCutMultiplexer.clone(
858 PATTauProducer = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.PATTauProducer,
859 Prediscriminants = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.Prediscriminants,
860 toMultiplex = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw"),
861 key = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw",
"category"),
862 mapping = self.cms.VPSet(
864 category = self.cms.uint32(0),
865 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff98'),
866 variable = self.cms.string(
'pt')
869 category = self.cms.uint32(2),
870 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff98'),
871 variable = self.cms.string(
'pt')
874 category = self.cms.uint32(5),
875 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff98'),
876 variable = self.cms.string(
'pt')
879 category = self.cms.uint32(7),
880 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff98'),
881 variable = self.cms.string(
'pt')
884 category = self.cms.uint32(8),
885 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff98'),
886 variable = self.cms.string(
'pt')
889 category = self.cms.uint32(10),
890 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff98'),
891 variable = self.cms.string(
'pt')
894 category = self.cms.uint32(13),
895 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff98'),
896 variable = self.cms.string(
'pt')
899 category = self.cms.uint32(15),
900 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff98'),
901 variable = self.cms.string(
'pt')
906 self.process.patTauDiscriminationByLooseElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
907 mapping = self.cms.VPSet(
909 category = self.cms.uint32(0),
910 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff90'),
911 variable = self.cms.string(
'pt')
914 category = self.cms.uint32(2),
915 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff90'),
916 variable = self.cms.string(
'pt')
919 category = self.cms.uint32(5),
920 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff90'),
921 variable = self.cms.string(
'pt')
924 category = self.cms.uint32(7),
925 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff90'),
926 variable = self.cms.string(
'pt')
929 category = self.cms.uint32(8),
930 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff90'),
931 variable = self.cms.string(
'pt')
934 category = self.cms.uint32(10),
935 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff90'),
936 variable = self.cms.string(
'pt')
939 category = self.cms.uint32(13),
940 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff90'),
941 variable = self.cms.string(
'pt')
944 category = self.cms.uint32(15),
945 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff90'),
946 variable = self.cms.string(
'pt')
951 self.process.patTauDiscriminationByMediumElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
952 mapping = self.cms.VPSet(
954 category = self.cms.uint32(0),
955 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff80'),
956 variable = self.cms.string(
'pt')
959 category = self.cms.uint32(2),
960 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff80'),
961 variable = self.cms.string(
'pt')
964 category = self.cms.uint32(5),
965 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff80'),
966 variable = self.cms.string(
'pt')
969 category = self.cms.uint32(7),
970 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff80'),
971 variable = self.cms.string(
'pt')
974 category = self.cms.uint32(8),
975 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff80'),
976 variable = self.cms.string(
'pt')
979 category = self.cms.uint32(10),
980 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff80'),
981 variable = self.cms.string(
'pt')
984 category = self.cms.uint32(13),
985 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff80'),
986 variable = self.cms.string(
'pt')
989 category = self.cms.uint32(15),
990 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff80'),
991 variable = self.cms.string(
'pt')
996 self.process.patTauDiscriminationByTightElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
997 mapping = self.cms.VPSet(
999 category = self.cms.uint32(0),
1000 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff70'),
1001 variable = self.cms.string(
'pt')
1004 category = self.cms.uint32(2),
1005 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff70'),
1006 variable = self.cms.string(
'pt')
1009 category = self.cms.uint32(5),
1010 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff70'),
1011 variable = self.cms.string(
'pt')
1014 category = self.cms.uint32(7),
1015 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff70'),
1016 variable = self.cms.string(
'pt')
1019 category = self.cms.uint32(8),
1020 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff70'),
1021 variable = self.cms.string(
'pt')
1024 category = self.cms.uint32(10),
1025 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff70'),
1026 variable = self.cms.string(
'pt')
1029 category = self.cms.uint32(13),
1030 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff70'),
1031 variable = self.cms.string(
'pt')
1034 category = self.cms.uint32(15),
1035 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff70'),
1036 variable = self.cms.string(
'pt')
1041 self.process.patTauDiscriminationByVTightElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
1042 mapping = self.cms.VPSet(
1044 category = self.cms.uint32(0),
1045 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_BL_WPeff60'),
1046 variable = self.cms.string(
'pt')
1049 category = self.cms.uint32(2),
1050 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_BL_WPeff60'),
1051 variable = self.cms.string(
'pt')
1054 category = self.cms.uint32(5),
1055 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_BL_WPeff60'),
1056 variable = self.cms.string(
'pt')
1059 category = self.cms.uint32(7),
1060 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_BL_WPeff60'),
1061 variable = self.cms.string(
'pt')
1064 category = self.cms.uint32(8),
1065 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_woGwoGSF_EC_WPeff60'),
1066 variable = self.cms.string(
'pt')
1069 category = self.cms.uint32(10),
1070 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_NoEleMatch_wGwoGSF_EC_WPeff60'),
1071 variable = self.cms.string(
'pt')
1074 category = self.cms.uint32(13),
1075 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_woGwGSF_EC_WPeff60'),
1076 variable = self.cms.string(
'pt')
1079 category = self.cms.uint32(15),
1080 cut = self.cms.string(
'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+
'_gbr_wGwGSF_EC_WPeff60'),
1081 variable = self.cms.string(
'pt')
1086 self.process.patTauDiscriminationByElectronRejectionMVA62018Task = self.cms.Task(
1087 self.process.patTauDiscriminationByElectronRejectionMVA62018Raw,
1088 self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018,
1089 self.process.patTauDiscriminationByLooseElectronRejectionMVA62018,
1090 self.process.patTauDiscriminationByMediumElectronRejectionMVA62018,
1091 self.process.patTauDiscriminationByTightElectronRejectionMVA62018,
1092 self.process.patTauDiscriminationByVTightElectronRejectionMVA62018
1094 self.process.patTauDiscriminationByElectronRejectionMVA62018Seq = self.cms.Sequence(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
1095 self.process.rerunMvaIsolationTask.add(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
1096 self.process.rerunMvaIsolationSequence += self.process.patTauDiscriminationByElectronRejectionMVA62018Seq
1098 _againstElectronTauIDSources = self.cms.PSet(
1099 againstElectronMVA6Raw2018 = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw"),
1100 againstElectronMVA6category2018 = self.cms.InputTag(
"patTauDiscriminationByElectronRejectionMVA62018Raw",
"category"),
1101 againstElectronVLooseMVA62018 = self.cms.InputTag(
"patTauDiscriminationByVLooseElectronRejectionMVA62018"),
1102 againstElectronLooseMVA62018 = self.cms.InputTag(
"patTauDiscriminationByLooseElectronRejectionMVA62018"),
1103 againstElectronMediumMVA62018 = self.cms.InputTag(
"patTauDiscriminationByMediumElectronRejectionMVA62018"),
1104 againstElectronTightMVA62018 = self.cms.InputTag(
"patTauDiscriminationByTightElectronRejectionMVA62018"),
1105 againstElectronVTightMVA62018 = self.cms.InputTag(
"patTauDiscriminationByVTightElectronRejectionMVA62018")
1107 _tauIDSourcesWithAgainistEle = self.cms.PSet(
1108 tauIDSources.clone(),
1109 _againstElectronTauIDSources
1111 tauIDSources =_tauIDSourcesWithAgainistEle.clone()
1116 embedID = self.cms.EDProducer(
"PATTauIDEmbedder",
1117 src = self.cms.InputTag(
'slimmedTaus'),
1118 tauIDSources = tauIDSources
1122 tauIDSources = self.cms.PSet(
1129 for target,points
in workingPoints_.iteritems():
1130 cuts = self.cms.PSet()
1131 setattr(tauIDSources,
'by{}VS{}raw'.
format(producer_name[0].
upper()+producer_name[1:], target),
1132 self.cms.InputTag(producer_name,
'VS{}'.
format(target)))
1133 for point,cut
in points.iteritems():
1134 setattr(cuts, point, self.cms.string(
str(cut)))
1136 setattr(tauIDSources,
'by{}{}VS{}'.
format(point, producer_name[0].
upper()+producer_name[1:], target),
1137 self.cms.InputTag(producer_name,
'VS{}{}'.
format(target, point)))
1139 setattr(getattr(self.
process, producer_name),
'VS{}WP'.
format(target), cuts)
1143 """returns the DNN version. File name should contain a version label with data takig year (2011-2, 2015-8) and \ 1144 version number (vX), e.g. 2017v0, in general the following format: {year}v{version}""" 1145 version_search = re.search(
'201[125678]v([0-9]+)[\._]', file_name)
1146 if not version_search:
1147 raise RuntimeError(
'File "{}" has an invalid name pattern, should be in the format "{year}v{version}". \ 1148 Unable to extract version number.'.
format(file_name))
1149 version = version_search.group(1)
1153 """returns the DeepTau year, version, subversion. File name should contain a version label with data takig year \ 1154 (2011-2, 2015-8), version number (vX) and subversion (pX), e.g. 2017v0p6, in general the following format: \ 1155 {year}v{version}p{subversion}""" 1156 version_search = re.search(
'(201[125678])v([0-9]+)(p[0-9]+|)[\._]', file_name)
1157 if not version_search:
1158 raise RuntimeError(
'File "{}" has an invalid name pattern, should be in the format "{year}v{version}p{subversion}". \ 1159 Unable to extract version number.'.
format(file_name))
1160 year = version_search.group(1)
1161 version = version_search.group(2)
1162 subversion = version_search.group(3)
1163 if len(subversion) > 0:
1164 subversion = subversion[1:]
1167 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)
rerunIsolationOldDMMVArun2016v1Task
def processDeepProducer(self, producer_name, tauIDSources, workingPoints_)
rerunIsolationNewDMMVArun2017v2Task
rerunIsolationOldDMdR0p3MVArun2017v2Task
rerunIsolationOldDMMVArun2017v2Task
rerunIsolationOldDMMVArun2017v1Task
rerunIsolationNewDMMVArun2016v1Task
def versionToInt(release=9, subversion=4, patch=0, debug=False)