CMS 3D CMS Logo

taus_updatedMVAIds_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 
7 from RecoTauTag.RecoTau.TauDiscriminatorTools import noPrediscriminants
8 
10 
11 
14 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw = patDiscriminationByIsolationMVArun2v1raw.clone(
15  PATTauProducer = cms.InputTag('slimmedTaus'),
16  Prediscriminants = noPrediscriminants,
17  loadMVAfromDB = cms.bool(True),
18  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT"), # name of the training you want to use
19  mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score)
20  verbosity = cms.int32(0)
21 )
22 # WPs
23 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT = patDiscriminationByIsolationMVArun2v1.clone(
24  PATTauProducer = cms.InputTag('slimmedTaus'),
25  Prediscriminants = noPrediscriminants,
26  toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw'),
27  loadMVAfromDB = cms.bool(True),
28  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT_mvaOutput_normalization"), # normalization fo the training you want to use
29  mapping = cms.VPSet(
30  cms.PSet(
31  category = cms.uint32(0),
32  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT"), # this is the name of the working point you want to use
33  variable = cms.string("pt"),
34  )
35  ),
36  workingPoints = cms.vstring(
37  "_VVLoose",
38  "_VLoose",
39  "_Loose",
40  "_Medium",
41  "_Tight",
42  "_VTight",
43  "_VVTight"
44  )
45 )
46 # MVAIso DBoldDM Seqeunce
47 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTSeq = cms.Sequence(
48  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw
49  + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT
50 )
51 
53 patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw.clone(
54  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT"), # name of the training you want to use
55  mvaOpt = cms.string("DBnewDMwLTwGJ") # option you want to use for your training (i.e., which variables are used to compute the BDT score)
56 )
57 # WPs
58 patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT.clone(
59  toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw'),
60  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT_mvaOutput_normalization"), # normalization fo the training you want to use
61  mapping = cms.VPSet(
62  cms.PSet(
63  category = cms.uint32(0),
64  cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT"), # this is the name of the working point you want to use
65  variable = cms.string("pt"),
66  )
67  )
68 )
69 # MVAIso DBnewDM Seqeunce
70 patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTSeq = cms.Sequence(
71  patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw
72  + patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT
73 )
74 
76 patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw.clone(
77  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT"), # name of the training you want to use
78  mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score)
79  srcChargedIsoPtSum = cms.string('chargedIsoPtSumdR03'),
80  srcFootprintCorrection = cms.string('footprintCorrectiondR03'),
81  srcNeutralIsoPtSum = cms.string('neutralIsoPtSumdR03'),
82  srcPUcorrPtSum = cms.string('puCorrPtSum'),
83  srcPhotonPtSumOutsideSignalCone = cms.string('photonPtSumOutsideSignalConedR03')
84 )
85 # WPs
86 patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT.clone(
87  toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw'),
88  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT_mvaOutput_normalization"), # normalization fo the training you want to use
89  mapping = cms.VPSet(
90  cms.PSet(
91  category = cms.uint32(0),
92  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT"), # this is the name of the working point you want to use
93  variable = cms.string("pt"),
94  )
95  )
96 )
97 # MVAIso DBoldDMdR0p3 Seqeunce
98 patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTSeq = cms.Sequence(
99  patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw
100  + patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT
101 )
102 
105 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1 = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw.clone(
106  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"), # name of the training you want to use
107  mvaOpt = cms.string("DBoldDMwLTwGJ") # option you want to use for your training (i.e., which variables are used to compute the BDT score)
108 )
109 # WPs
110 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT.clone(
111  toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1'),
112  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"), # normalization fo the training you want to use
113  mapping = cms.VPSet(
114  cms.PSet(
115  category = cms.uint32(0),
116  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"), # this is the name of the working point you want to use
117  variable = cms.string("pt"),
118  )
119  ),
120  workingPoints = cms.vstring(
121  "_WPEff95",
122  "_WPEff90",
123  "_WPEff80",
124  "_WPEff70",
125  "_WPEff60",
126  "_WPEff50",
127  "_WPEff40"
128  )
129 )
130 # MVAIso DBoldDM Seqeunce
131 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Seq = cms.Sequence(
132  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1
133  + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1
134 )
135 
138 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015 = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw.clone(
139  mvaName = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1"), # name of the training you want to use
140  mvaOpt = cms.string("DBoldDMwLT") # option you want to use for your training (i.e., which variables are used to compute the BDT score)
141 )
142 # WPs
143 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT.clone(
144  toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015'),
145  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_mvaOutput_normalization"), # normalization fo the training you want to use
146  mapping = cms.VPSet(
147  cms.PSet(
148  category = cms.uint32(0),
149  cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1"), # this is the name of the working point you want to use
150  variable = cms.string("pt"),
151  )
152  ),
153  workingPoints = cms.vstring(
154  "_WPEff90",
155  "_WPEff80",
156  "_WPEff70",
157  "_WPEff60",
158  "_WPEff50",
159  "_WPEff40"
160  )
161 )
162 # MVAIso DBoldDM Seqeunce
163 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015Seq = cms.Sequence(
164  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015
165  + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015
166 )
167 
168 
169 
170 antiElectronDiscrMVA6_version = "MVA"
171 
172 from RecoTauTag.RecoTau.patTauDiscriminationAgainstElectronMVA6_cfi import patTauDiscriminationAgainstElectronMVA6
173 patTauDiscriminationByElectronRejectionMVA62018Raw = patTauDiscriminationAgainstElectronMVA6.clone(
174  PATTauProducer = 'slimmedTaus',
175  Prediscriminants = noPrediscriminants, #already selected for MiniAOD
176  srcElectrons = 'slimmedElectrons',
177  vetoEcalCracks = False, #keep tau candidates in EB-EE cracks
178  mvaName_NoEleMatch_wGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_wGwoGSF_BL',
179  mvaName_NoEleMatch_wGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_wGwoGSF_EC',
180  mvaName_NoEleMatch_woGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_woGwoGSF_BL',
181  mvaName_NoEleMatch_woGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_woGwoGSF_EC',
182  mvaName_wGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_wGwGSF_BL',
183  mvaName_wGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_wGwGSF_EC',
184  mvaName_woGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_woGwGSF_BL',
185  mvaName_woGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_woGwGSF_EC'
186 )
187 
188 from RecoTauTag.RecoTau.PATTauDiscriminantCutMultiplexer_cfi import patTauDiscriminantCutMultiplexer
189 # VLoose
190 patTauDiscriminationByElectronRejectionMVA62018 = patTauDiscriminantCutMultiplexer.clone(
191  PATTauProducer = patTauDiscriminationByElectronRejectionMVA62018Raw.PATTauProducer,
192  Prediscriminants = patTauDiscriminationByElectronRejectionMVA62018Raw.Prediscriminants,
193  toMultiplex = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62018Raw"),
194  mapping = cms.VPSet(
195  cms.PSet(
196  category = cms.uint32(0),
197  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_woGwoGSF_BL'),
198  variable = cms.string('pt')
199  ),
200  cms.PSet(
201  category = cms.uint32(2),
202  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_wGwoGSF_BL'),
203  variable = cms.string('pt')
204  ),
205  cms.PSet(
206  category = cms.uint32(5),
207  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_woGwGSF_BL'),
208  variable = cms.string('pt')
209  ),
210  cms.PSet(
211  category = cms.uint32(7),
212  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_wGwGSF_BL'),
213  variable = cms.string('pt')
214  ),
215  cms.PSet(
216  category = cms.uint32(8),
217  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_woGwoGSF_EC'),
218  variable = cms.string('pt')
219  ),
220  cms.PSet(
221  category = cms.uint32(10),
222  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_wGwoGSF_EC'),
223  variable = cms.string('pt')
224  ),
225  cms.PSet(
226  category = cms.uint32(13),
227  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_woGwGSF_EC'),
228  variable = cms.string('pt')
229  ),
230  cms.PSet(
231  category = cms.uint32(15),
232  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_wGwGSF_EC'),
233  variable = cms.string('pt')
234  )
235  ),
236  rawValues = cms.vstring(
237  "discriminator",
238  "category"
239  ),
240  workingPoints = cms.vstring(
241  "_VLoose",
242  "_Loose",
243  "_Medium",
244  "_Tight",
245  "_VTight"
246  )
247 )
248 
249 antiElectronDiscrMVA6v1_version = "MVA6v1"
250 
251 patTauDiscriminationByElectronRejectionMVA62015Raw = patTauDiscriminationAgainstElectronMVA6.clone(
252  PATTauProducer = 'slimmedTaus',
253  Prediscriminants = noPrediscriminants, #already selected for MiniAOD
254  srcElectrons = 'slimmedElectrons',
255  vetoEcalCracks = True, #don't keep tau candidates in EB-EE cracks for v1
256  mvaName_NoEleMatch_wGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_wGwoGSF_BL',
257  mvaName_NoEleMatch_wGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_wGwoGSF_EC',
258  mvaName_NoEleMatch_woGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_woGwoGSF_BL',
259  mvaName_NoEleMatch_woGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_woGwoGSF_EC',
260  mvaName_wGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_wGwGSF_BL',
261  mvaName_wGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_wGwGSF_EC',
262  mvaName_woGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_woGwGSF_BL',
263  mvaName_woGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_woGwGSF_EC'
264 )
265 
266 patTauDiscriminationByElectronRejectionMVA62015 = patTauDiscriminationByElectronRejectionMVA62018.clone(
267  PATTauProducer = patTauDiscriminationByElectronRejectionMVA62015Raw.PATTauProducer,
268  Prediscriminants = patTauDiscriminationByElectronRejectionMVA62015Raw.Prediscriminants,
269  toMultiplex = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62015Raw"),
270  rawValues = cms.vstring(
271  "discriminator",
272  "category"
273  ),
274  workingPoints = cms.vstring(
275  "_WPEff99",
276  "_WPEff96",
277  "_WPEff91",
278  "_WPEff85",
279  "_WPEff79"
280  )
281 )
282 for m in patTauDiscriminationByElectronRejectionMVA62015.mapping:
283  m.cut = m.cut.value().replace(antiElectronDiscrMVA6_version, antiElectronDiscrMVA6v1_version + "_gbr")
284 
285 _patTauDiscriminationByElectronRejection2018Seq = cms.Sequence(
286  patTauDiscriminationByElectronRejectionMVA62018Raw
287  +patTauDiscriminationByElectronRejectionMVA62018
288 )
289 _patTauDiscriminationByElectronRejection2015Seq = cms.Sequence(
290  patTauDiscriminationByElectronRejectionMVA62015Raw
291  +patTauDiscriminationByElectronRejectionMVA62015
292 )
293 patTauDiscriminationByElectronRejectionSeq = _patTauDiscriminationByElectronRejection2015Seq.copy()
294 for era in [run2_nanoAOD_92X,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,\
295  run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1]:
296  era.toReplaceWith(patTauDiscriminationByElectronRejectionSeq,
297  _patTauDiscriminationByElectronRejection2018Seq)
298 
299 
300 
301 _patTauMVAIDsSeq2017v2 = cms.Sequence(
302  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTSeq
303  +patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTSeq
304  +patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTSeq
305  +patTauDiscriminationByElectronRejectionSeq
306 )
307 patTauMVAIDsSeq = _patTauMVAIDsSeq2017v2.copy()
308 patTauMVAIDsSeq += patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015Seq
309 
310 _patTauMVAIDsSeqWith2017v1 = _patTauMVAIDsSeq2017v2.copy()
311 _patTauMVAIDsSeqWith2017v1 += patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Seq
312 for era in [run2_nanoAOD_94XMiniAODv1,]:
313  era.toReplaceWith(patTauMVAIDsSeq,_patTauMVAIDsSeqWith2017v1)
314 
315 # embed new MVA tau-Ids into new tau collection
316 def tauIDMVAinputs(module, wp):
317  return cms.PSet(inputTag = cms.InputTag(module), workingPointIndex = cms.int32(-1 if wp=="raw" else -2 if wp=="category" else globals()[module].workingPoints.index(wp)))
318 slimmedTausUpdated = cms.EDProducer("PATTauIDEmbedder",
319  src = cms.InputTag('slimmedTaus'),
320  tauIDSources = cms.PSet() # PSet defined below in era dependent way
321 )
322 _tauIDSources2017v2 = cms.PSet(
323  #oldDM
324  byIsolationMVArun2v1DBoldDMwLTraw2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT", "raw"),
325  byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT", "_VVLoose"),
326  byVLooseIsolationMVArun2v1DBoldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT", "_VLoose"),
327  byLooseIsolationMVArun2v1DBoldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT", "_Loose"),
328  byMediumIsolationMVArun2v1DBoldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT", "_Medium"),
329  byTightIsolationMVArun2v1DBoldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT", "_Tight"),
330  byVTightIsolationMVArun2v1DBoldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT", "_VTight"),
331  byVVTightIsolationMVArun2v1DBoldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT", "_VVTight"),
332  #newDM
333  byIsolationMVArun2v1DBnewDMwLTraw2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT", "raw"),
334  byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT", "_VVLoose"),
335  byVLooseIsolationMVArun2v1DBnewDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT", "_VLoose"),
336  byLooseIsolationMVArun2v1DBnewDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT", "_Loose"),
337  byMediumIsolationMVArun2v1DBnewDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT", "_Medium"),
338  byTightIsolationMVArun2v1DBnewDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT", "_Tight"),
339  byVTightIsolationMVArun2v1DBnewDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT", "_VTight"),
340  byVVTightIsolationMVArun2v1DBnewDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT", "_VVTight"),
341  #oldDMdR0p3
342  byIsolationMVArun2v1DBdR03oldDMwLTraw2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT", "raw"),
343  byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT", "_VVLoose"),
344  byVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT", "_VLoose"),
345  byLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT", "_Loose"),
346  byMediumIsolationMVArun2v1DBdR03oldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT", "_Medium"),
347  byTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT", "_Tight"),
348  byVTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT", "_VTight"),
349  byVVTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT", "_VVTight")
350 )
351 _tauIDSources2017v1 = cms.PSet(
352  byIsolationMVArun2v1DBoldDMwLTraw2017v1 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1", "raw"),
353  byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1", "_WPEff95"),
354  byVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1", "_WPEff90"),
355  byLooseIsolationMVArun2v1DBoldDMwLT2017v1 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1", "_WPEff80"),
356  byMediumIsolationMVArun2v1DBoldDMwLT2017v1 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1", "_WPEff70"),
357  byTightIsolationMVArun2v1DBoldDMwLT2017v1 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1", "_WPEff60"),
358  byVTightIsolationMVArun2v1DBoldDMwLT2017v1 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1", "_WPEff50"),
359  byVVTightIsolationMVArun2v1DBoldDMwLT2017v1 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1", "_WPEff40")
360 )
361 _tauIDSourcesWith2017v1 = cms.PSet(
362  _tauIDSources2017v2.clone(),
363  _tauIDSources2017v1
364 )
365 _tauIDSources2015 = cms.PSet(
366  byIsolationMVArun2v1DBoldDMwLTraw2015 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015", "raw"),
367  byVLooseIsolationMVArun2v1DBoldDMwLT2015 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015", "_WPEff90"),
368  byLooseIsolationMVArun2v1DBoldDMwLT2015 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015", "_WPEff80"),
369  byMediumIsolationMVArun2v1DBoldDMwLT2015 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015", "_WPEff70"),
370  byTightIsolationMVArun2v1DBoldDMwLT2015 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015", "_WPEff60"),
371  byVTightIsolationMVArun2v1DBoldDMwLT2015 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015", "_WPEff50"),
372  byVVTightIsolationMVArun2v1DBoldDMwLT2015 = tauIDMVAinputs("patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015", "_WPEff40")
373 )
374 _tauIDSourcesWith2015 = cms.PSet(
375  _tauIDSources2017v2.clone(),
376  _tauIDSources2015
377 )
378 slimmedTausUpdated.tauIDSources=_tauIDSourcesWith2015
379 
380 for era in [run2_nanoAOD_94XMiniAODv1,]:
381  era.toModify(slimmedTausUpdated,
382  tauIDSources = _tauIDSourcesWith2017v1
383  )
384 
385 _antiETauIDSources2018 = cms.PSet(
386  againstElectronMVA6Raw2018 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "raw"),
387  againstElectronMVA6category2018 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "category"),
388  againstElectronVLooseMVA62018 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "_VLoose"),
389  againstElectronLooseMVA62018 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "_Loose"),
390  againstElectronMediumMVA62018 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "_Medium"),
391  againstElectronTightMVA62018 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "_Tight"),
392  againstElectronVTightMVA62018 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "_VTight")
393 )
394 _tauIDSourcesWithAntiE2018 = cms.PSet(
395  slimmedTausUpdated.tauIDSources.clone(),
396  _antiETauIDSources2018
397 )
398 _antiETauIDSources2015 = cms.PSet(
399  againstElectronMVA6Raw2015 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62015", "raw"),
400  againstElectronMVA6category2015 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62015", "category"),
401  againstElectronVLooseMVA62015 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62015", "_WPEff99"),
402  againstElectronLooseMVA62015 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62015", "_WPEff96"),
403  againstElectronMediumMVA62015 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62015", "_WPEff91"),
404  againstElectronTightMVA62015 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62015", "_WPEff85"),
405  againstElectronVTightMVA62015 = tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62015", "_WPEff79")
406 )
407 _tauIDSourcesWithAntiE2015 = cms.PSet(
408  slimmedTausUpdated.tauIDSources.clone(),
409  _antiETauIDSources2015
410 )
411 slimmedTausUpdated.tauIDSources=_tauIDSourcesWithAntiE2015
412 for era in [run2_nanoAOD_92X,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,\
413  run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1]:
414  era.toModify(slimmedTausUpdated,
415  tauIDSources = _tauIDSourcesWithAntiE2018
416  )
417 
418 
419 from RecoTauTag.RecoTau.patTauDiscriminationAgainstElectronDeadECAL_cfi import patTauDiscriminationAgainstElectronDeadECAL
420 patTauDiscriminationAgainstElectronDeadECALForNano = patTauDiscriminationAgainstElectronDeadECAL.clone(
421  PATTauProducer = 'slimmedTaus',
422  Prediscriminants = noPrediscriminants
423 )
424 _patTauMVAIDsSeqWithAntiEdeadECal = patTauMVAIDsSeq.copy()
425 _patTauMVAIDsSeqWithAntiEdeadECal += patTauDiscriminationAgainstElectronDeadECALForNano
426 _tauIDSourcesWithAntiEdeadECal = cms.PSet(
427  slimmedTausUpdated.tauIDSources.clone(),
428  againstElectronDeadECALForNano = cms.PSet(
429  inputTag = cms.InputTag("patTauDiscriminationAgainstElectronDeadECALForNano"),
430  workingPointIndex = cms.int32(-99)
431  )
432 )
433 for era in [run2_miniAOD_80XLegacy,run2_nanoAOD_92X,run2_nanoAOD_94XMiniAODv1,\
434  run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,\
435  run2_nanoAOD_106Xv1]:
436  era.toReplaceWith(patTauMVAIDsSeq,_patTauMVAIDsSeqWithAntiEdeadECal)
437  era.toModify(slimmedTausUpdated,
438  tauIDSources = _tauIDSourcesWithAntiEdeadECal
439  )
440 
441 
442 patTauMVAIDsSeq += slimmedTausUpdated
443 
taus_updatedMVAIds_cff.tauIDMVAinputs
def tauIDMVAinputs(module, wp)
Definition: taus_updatedMVAIds_cff.py:316
PATTauDiscriminantCutMultiplexer_cfi
loadRecoTauTagMVAsFromPrepDB_cfi
Updated tau collection with MVA-based tau-Ids rerun ####### Used only in some eras.
patTauDiscriminationAgainstElectronMVA6_cfi
TauDiscriminatorTools
nano_eras_cff
PATTauDiscriminationByMVAIsolationRun2_cff
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444