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 
9 
12 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw = patDiscriminationByIsolationMVArun2v1raw.clone(
13  PATTauProducer = cms.InputTag('slimmedTaus'),
14  Prediscriminants = noPrediscriminants,
15  loadMVAfromDB = cms.bool(True),
16  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT"), # name of the training you want to use
17  mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score)
18  verbosity = cms.int32(0)
19 )
20 # WPs
21 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT = patDiscriminationByIsolationMVArun2v1.clone(
22  PATTauProducer = cms.InputTag('slimmedTaus'),
23  Prediscriminants = noPrediscriminants,
24  toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw'),
25  loadMVAfromDB = cms.bool(True),
26  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT_mvaOutput_normalization"), # normalization fo the training you want to use
27  mapping = cms.VPSet(
28  cms.PSet(
29  category = cms.uint32(0),
30  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT"), # this is the name of the working point you want to use
31  variable = cms.string("pt"),
32  )
33  ),
34  workingPoints = cms.vstring(
35  "_VVLoose",
36  "_VLoose",
37  "_Loose",
38  "_Medium",
39  "_Tight",
40  "_VTight",
41  "_VVTight"
42  )
43 )
44 # MVAIso DBoldDM Seqeunce
45 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTTask = cms.Task(
46  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw,
47  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT
48 )
49 
51 patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw.clone(
52  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT"), # name of the training you want to use
53  mvaOpt = cms.string("DBnewDMwLTwGJ") # option you want to use for your training (i.e., which variables are used to compute the BDT score)
54 )
55 # WPs
56 patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT.clone(
57  toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw'),
58  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT_mvaOutput_normalization"), # normalization fo the training you want to use
59  mapping = cms.VPSet(
60  cms.PSet(
61  category = cms.uint32(0),
62  cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT"), # this is the name of the working point you want to use
63  variable = cms.string("pt"),
64  )
65  )
66 )
67 # MVAIso DBnewDM Seqeunce
68 patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTTask = cms.Task(
69  patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw,
70  patTauDiscriminationByIsolationMVArun2v1DBnewDMwLT
71 )
72 
74 patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw.clone(
75  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT"), # name of the training you want to use
76  mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score)
77  srcChargedIsoPtSum = cms.string('chargedIsoPtSumdR03'),
78  srcFootprintCorrection = cms.string('footprintCorrectiondR03'),
79  srcNeutralIsoPtSum = cms.string('neutralIsoPtSumdR03'),
80  srcPUcorrPtSum = cms.string('puCorrPtSum'),
81  srcPhotonPtSumOutsideSignalCone = cms.string('photonPtSumOutsideSignalConedR03')
82 )
83 # WPs
84 patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT.clone(
85  toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw'),
86  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT_mvaOutput_normalization"), # normalization fo the training you want to use
87  mapping = cms.VPSet(
88  cms.PSet(
89  category = cms.uint32(0),
90  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT"), # this is the name of the working point you want to use
91  variable = cms.string("pt"),
92  )
93  )
94 )
95 # MVAIso DBoldDMdR0p3 Seqeunce
96 patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTTask = cms.Task(
97  patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw,
98  patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLT
99 )
100 
103 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1 = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw.clone(
104  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"), # name of the training you want to use
105  mvaOpt = cms.string("DBoldDMwLTwGJ") # option you want to use for your training (i.e., which variables are used to compute the BDT score)
106 )
107 # WPs
108 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT.clone(
109  toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1'),
110  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"), # normalization fo the training you want to use
111  mapping = cms.VPSet(
112  cms.PSet(
113  category = cms.uint32(0),
114  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"), # this is the name of the working point you want to use
115  variable = cms.string("pt"),
116  )
117  ),
118  workingPoints = cms.vstring(
119  "_WPEff95",
120  "_WPEff90",
121  "_WPEff80",
122  "_WPEff70",
123  "_WPEff60",
124  "_WPEff50",
125  "_WPEff40"
126  )
127 )
128 # MVAIso DBoldDM Seqeunce
129 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Task = cms.Task(
130  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1,
131  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1
132 )
133 
136 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015 = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw.clone(
137  mvaName = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1"), # name of the training you want to use
138  mvaOpt = cms.string("DBoldDMwLT") # option you want to use for your training (i.e., which variables are used to compute the BDT score)
139 )
140 # WPs
141 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT.clone(
142  toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015'),
143  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_mvaOutput_normalization"), # normalization fo the training you want to use
144  mapping = cms.VPSet(
145  cms.PSet(
146  category = cms.uint32(0),
147  cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1"), # this is the name of the working point you want to use
148  variable = cms.string("pt"),
149  )
150  ),
151  workingPoints = cms.vstring(
152  "_WPEff90",
153  "_WPEff80",
154  "_WPEff70",
155  "_WPEff60",
156  "_WPEff50",
157  "_WPEff40"
158  )
159 )
160 # MVAIso DBoldDM Seqeunce
161 patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015Task = cms.Task(
162  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015,
163  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015
164 )
165 
166 
167 
168 antiElectronDiscrMVA6_version = "MVA"
169 
170 from RecoTauTag.RecoTau.patTauDiscriminationAgainstElectronMVA6_cfi import patTauDiscriminationAgainstElectronMVA6
171 patTauDiscriminationByElectronRejectionMVA62018Raw = patTauDiscriminationAgainstElectronMVA6.clone(
172  PATTauProducer = 'slimmedTaus',
173  Prediscriminants = noPrediscriminants, #already selected for MiniAOD
174  srcElectrons = 'slimmedElectrons',
175  vetoEcalCracks = False, #keep tau candidates in EB-EE cracks
176  mvaName_NoEleMatch_wGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_wGwoGSF_BL',
177  mvaName_NoEleMatch_wGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_wGwoGSF_EC',
178  mvaName_NoEleMatch_woGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_woGwoGSF_BL',
179  mvaName_NoEleMatch_woGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_woGwoGSF_EC',
180  mvaName_wGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_wGwGSF_BL',
181  mvaName_wGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_wGwGSF_EC',
182  mvaName_woGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_woGwGSF_BL',
183  mvaName_woGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_woGwGSF_EC'
184 )
185 
186 from RecoTauTag.RecoTau.PATTauDiscriminantCutMultiplexer_cfi import patTauDiscriminantCutMultiplexer
187 # VLoose
188 patTauDiscriminationByElectronRejectionMVA62018 = patTauDiscriminantCutMultiplexer.clone(
189  PATTauProducer = patTauDiscriminationByElectronRejectionMVA62018Raw.PATTauProducer,
190  Prediscriminants = patTauDiscriminationByElectronRejectionMVA62018Raw.Prediscriminants,
191  toMultiplex = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62018Raw"),
192  mapping = cms.VPSet(
193  cms.PSet(
194  category = cms.uint32(0),
195  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_woGwoGSF_BL'),
196  variable = cms.string('pt')
197  ),
198  cms.PSet(
199  category = cms.uint32(2),
200  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_wGwoGSF_BL'),
201  variable = cms.string('pt')
202  ),
203  cms.PSet(
204  category = cms.uint32(5),
205  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_woGwGSF_BL'),
206  variable = cms.string('pt')
207  ),
208  cms.PSet(
209  category = cms.uint32(7),
210  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_wGwGSF_BL'),
211  variable = cms.string('pt')
212  ),
213  cms.PSet(
214  category = cms.uint32(8),
215  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_woGwoGSF_EC'),
216  variable = cms.string('pt')
217  ),
218  cms.PSet(
219  category = cms.uint32(10),
220  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_NoEleMatch_wGwoGSF_EC'),
221  variable = cms.string('pt')
222  ),
223  cms.PSet(
224  category = cms.uint32(13),
225  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_woGwGSF_EC'),
226  variable = cms.string('pt')
227  ),
228  cms.PSet(
229  category = cms.uint32(15),
230  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_wGwGSF_EC'),
231  variable = cms.string('pt')
232  )
233  ),
234  rawValues = cms.vstring(
235  "discriminator",
236  "category"
237  ),
238  workingPoints = cms.vstring(
239  "_VLoose",
240  "_Loose",
241  "_Medium",
242  "_Tight",
243  "_VTight"
244  )
245 )
246 
247 antiElectronDiscrMVA6v1_version = "MVA6v1"
248 
249 patTauDiscriminationByElectronRejectionMVA62015Raw = patTauDiscriminationAgainstElectronMVA6.clone(
250  PATTauProducer = 'slimmedTaus',
251  Prediscriminants = noPrediscriminants, #already selected for MiniAOD
252  srcElectrons = 'slimmedElectrons',
253  vetoEcalCracks = True, #don't keep tau candidates in EB-EE cracks for v1
254  mvaName_NoEleMatch_wGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_wGwoGSF_BL',
255  mvaName_NoEleMatch_wGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_wGwoGSF_EC',
256  mvaName_NoEleMatch_woGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_woGwoGSF_BL',
257  mvaName_NoEleMatch_woGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_woGwoGSF_EC',
258  mvaName_wGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_wGwGSF_BL',
259  mvaName_wGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_wGwGSF_EC',
260  mvaName_woGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_woGwGSF_BL',
261  mvaName_woGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_woGwGSF_EC'
262 )
263 
264 patTauDiscriminationByElectronRejectionMVA62015 = patTauDiscriminationByElectronRejectionMVA62018.clone(
265  PATTauProducer = patTauDiscriminationByElectronRejectionMVA62015Raw.PATTauProducer,
266  Prediscriminants = patTauDiscriminationByElectronRejectionMVA62015Raw.Prediscriminants,
267  toMultiplex = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62015Raw"),
268  rawValues = cms.vstring(
269  "discriminator",
270  "category"
271  ),
272  workingPoints = cms.vstring(
273  "_WPEff99",
274  "_WPEff96",
275  "_WPEff91",
276  "_WPEff85",
277  "_WPEff79"
278  )
279 )
280 for m in patTauDiscriminationByElectronRejectionMVA62015.mapping:
281  m.cut = m.cut.value().replace(antiElectronDiscrMVA6_version, antiElectronDiscrMVA6v1_version + "_gbr")
282 
283 patTauDiscriminationByElectronRejectionTask = cms.Task(
284  patTauDiscriminationByElectronRejectionMVA62015Raw,
285  patTauDiscriminationByElectronRejectionMVA62015
286 )
287 
288 
289 
290 patTauMVAIDsTask = cms.Task(
291  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTTask,
292  patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTTask,
293  patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTTask,
294  patTauDiscriminationByElectronRejectionTask,
295  patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015Task
296 )
297 
298 slimmedTausUpdated = cms.EDProducer("PATTauIDEmbedder",
299  src = cms.InputTag('slimmedTaus'),
300  tauIDSources = cms.PSet() # PSet defined below in era dependent way
301 )
302 
303 patTauMVAIDsTask.add(slimmedTausUpdated)
def replace(string, replacements)
Updated tau collection with MVA-based tau-Ids rerun ####### Used only in some eras.