CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HPSPFTaus_cff.py
Go to the documentation of this file.
2 import copy
3 
4 '''
5 
6 Sequences for HPS taus
7 
8 '''
9 
10 # Define the discriminators for this tau
21 
22 # Load helper functions to change the source of the discriminants
24 
25 # Select those taus that pass the HPS selections
26 # - pt > 15, mass cuts, tauCone cut
27 from RecoTauTag.RecoTau.PFRecoTauDiscriminationByHPSSelection_cfi import hpsSelectionDiscriminator
28 hpsPFTauDiscriminationByDecayModeFinding = hpsSelectionDiscriminator.clone(
29  PFTauProducer = cms.InputTag('hpsPFTauProducer')
30  )
31 
32 # Define decay mode prediscriminant
33 requireDecayMode = cms.PSet(
34  BooleanOperator = cms.string("and"),
35  decayMode = cms.PSet(
36  Producer = cms.InputTag('hpsPFTauDiscriminationByDecayModeFinding'),
37  cut = cms.double(0.5)
38  )
39 )
40 
41 
42 #Building the prototype for the Discriminator by Isolation
43 hpsPFTauDiscriminationByLooseIsolation = pfRecoTauDiscriminationByIsolation.clone(
44  PFTauProducer = cms.InputTag("hpsPFTauProducer"),
45  Prediscriminants = requireDecayMode.clone(),
46  ApplyDiscriminationByTrackerIsolation = False,
47  ApplyDiscriminationByECALIsolation = True,
48  applyOccupancyCut = True
49 )
50 hpsPFTauDiscriminationByLooseIsolation.Prediscriminants.preIso = cms.PSet(
51  Producer = cms.InputTag("hpsPFTauDiscriminationByLooseChargedIsolation"),
52  cut = cms.double(0.5))
53 
54 
55 # Make an even looser discriminator
56 
57 
58 hpsPFTauDiscriminationByVLooseIsolation = hpsPFTauDiscriminationByLooseIsolation.clone(
59  customOuterCone = cms.double(0.3),
60  isoConeSizeForDeltaBeta = cms.double(0.3),
61  )
62 hpsPFTauDiscriminationByVLooseIsolation.qualityCuts.isolationQualityCuts.minTrackPt = 1.5
63 hpsPFTauDiscriminationByVLooseIsolation.qualityCuts.isolationQualityCuts.minGammaEt = 2.0
64 hpsPFTauDiscriminationByVLooseIsolation.Prediscriminants.preIso.Producer = cms.InputTag("hpsPFTauDiscriminationByVLooseChargedIsolation")
65 
66 
67 hpsPFTauDiscriminationByMediumIsolation = hpsPFTauDiscriminationByLooseIsolation.clone()
68 hpsPFTauDiscriminationByMediumIsolation.qualityCuts.isolationQualityCuts.minTrackPt = 0.8
69 hpsPFTauDiscriminationByMediumIsolation.qualityCuts.isolationQualityCuts.minGammaEt = 0.8
70 hpsPFTauDiscriminationByMediumIsolation.Prediscriminants.preIso.Producer = cms.InputTag("hpsPFTauDiscriminationByMediumChargedIsolation")
71 
72 
73 hpsPFTauDiscriminationByTightIsolation = hpsPFTauDiscriminationByLooseIsolation.clone()
74 hpsPFTauDiscriminationByTightIsolation.qualityCuts.isolationQualityCuts.minTrackPt = 0.5
75 hpsPFTauDiscriminationByTightIsolation.qualityCuts.isolationQualityCuts.minGammaEt = 0.5
76 hpsPFTauDiscriminationByTightIsolation.Prediscriminants.preIso.Producer = cms.InputTag("hpsPFTauDiscriminationByTightChargedIsolation")
77 
78 hpsPFTauDiscriminationByIsolationSeq = cms.Sequence(
79  hpsPFTauDiscriminationByVLooseIsolation*
80  hpsPFTauDiscriminationByLooseIsolation*
81  hpsPFTauDiscriminationByMediumIsolation*
82  hpsPFTauDiscriminationByTightIsolation
83 )
84 
85 _isolation_types = ['VLoose', 'Loose', 'Medium', 'Tight']
86 # Now build the sequences that apply PU corrections
87 
88 # Make Delta Beta corrections (on SumPt quantity)
89 hpsPFTauDiscriminationByVLooseIsolationDBSumPtCorr = hpsPFTauDiscriminationByVLooseIsolation.clone(
90  deltaBetaPUTrackPtCutOverride = cms.double(0.5),
91  applyDeltaBetaCorrection = True,
92  isoConeSizeForDeltaBeta = 0.8,
93  deltaBetaFactor = "%0.4f"%(0.0123/0.1687),
94  applyOccupancyCut = False,
95  applySumPtCut = True,
96  )
97 
98 hpsPFTauDiscriminationByVLooseIsolationDBSumPtCorr.maximumSumPtCut=hpsPFTauDiscriminationByVLooseIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minGammaEt
99 
100 hpsPFTauDiscriminationByLooseIsolationDBSumPtCorr = hpsPFTauDiscriminationByLooseIsolation.clone(
101  deltaBetaPUTrackPtCutOverride = cms.double(0.5),
102  applyDeltaBetaCorrection = True,
103  isoConeSizeForDeltaBeta = 0.8,
104  deltaBetaFactor = "%0.4f"%(0.0123/0.1687),
105  applyOccupancyCut = False,
106  applySumPtCut = True,
107  )
108 hpsPFTauDiscriminationByLooseIsolationDBSumPtCorr.maximumSumPtCut=hpsPFTauDiscriminationByLooseIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minGammaEt
109 
110 
111 hpsPFTauDiscriminationByMediumIsolationDBSumPtCorr = hpsPFTauDiscriminationByMediumIsolation.clone(
112  deltaBetaPUTrackPtCutOverride = cms.double(0.5),
113  applyDeltaBetaCorrection = True,
114  isoConeSizeForDeltaBeta = 0.8,
115  deltaBetaFactor = "%0.4f"%(0.0462/0.1687),
116  applyOccupancyCut = False,
117  applySumPtCut = True,
118  )
119 hpsPFTauDiscriminationByMediumIsolationDBSumPtCorr.maximumSumPtCut=hpsPFTauDiscriminationByMediumIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minGammaEt
120 
121 
122 hpsPFTauDiscriminationByTightIsolationDBSumPtCorr = hpsPFTauDiscriminationByTightIsolation.clone(
123  deltaBetaPUTrackPtCutOverride = cms.double(0.5),
124  applyDeltaBetaCorrection = True,
125  isoConeSizeForDeltaBeta = 0.8,
126  deltaBetaFactor = "%0.4f"%(0.0772/0.1687),
127  applyOccupancyCut = False,
128  applySumPtCut = True,
129  )
130 hpsPFTauDiscriminationByTightIsolationDBSumPtCorr.maximumSumPtCut=hpsPFTauDiscriminationByTightIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minGammaEt
131 
132 hpsPFTauDiscriminationByIsolationSeqDBSumPtCorr = cms.Sequence(
133  hpsPFTauDiscriminationByVLooseIsolationDBSumPtCorr*
134  hpsPFTauDiscriminationByLooseIsolationDBSumPtCorr*
135  hpsPFTauDiscriminationByMediumIsolationDBSumPtCorr*
136  hpsPFTauDiscriminationByTightIsolationDBSumPtCorr
137  )
138 
139 
140 hpsPFTauDiscriminationByVLooseCombinedIsolationDBSumPtCorr = hpsPFTauDiscriminationByVLooseIsolationDBSumPtCorr.clone(
141  ApplyDiscriminationByTrackerIsolation = True,
142  ApplyDiscriminationByECALIsolation = True,
143  deltaBetaFactor = "%0.4f"%((0.09/0.25)*(0.0772/0.1687)),
144  applyOccupancyCut = False,
145  applySumPtCut = True,
146  maximumSumPtCut = 3.0,
147  Prediscriminants = requireDecayMode.clone()
148  )
149 hpsPFTauDiscriminationByVLooseCombinedIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minTrackPt = 0.5
150 hpsPFTauDiscriminationByVLooseCombinedIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minGammaEt = 0.5
151 
152 hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr = hpsPFTauDiscriminationByLooseIsolationDBSumPtCorr.clone(
153  ApplyDiscriminationByTrackerIsolation = True,
154  ApplyDiscriminationByECALIsolation = True,
155  deltaBetaFactor = "%0.4f"%(0.0772/0.1687),
156  applyOccupancyCut = False,
157  applySumPtCut = True,
158  maximumSumPtCut = 2.0,
159  Prediscriminants = requireDecayMode.clone()
160  )
161 hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minTrackPt = 0.5
162 hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minGammaEt = 0.5
163 
164 
165 hpsPFTauDiscriminationByRawCombinedIsolationDBSumPtCorr = hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr.clone(
166  applySumPtCut = False,
167  storeRawSumPt = cms.bool(True)
168 )
169 
170 hpsPFTauDiscriminationByRawChargedIsolationDBSumPtCorr = hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr.clone(
171  applySumPtCut = False,
172  ApplyDiscriminationByECALIsolation = False,
173  storeRawSumPt = cms.bool(True)
174 )
175 
176 hpsPFTauDiscriminationByRawGammaIsolationDBSumPtCorr = hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr.clone(
177  applySumPtCut = False,
178  ApplyDiscriminationByTrackerIsolation = False,
179  storeRawSumPt = cms.bool(True)
180 )
181 
182 
183 hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr = hpsPFTauDiscriminationByMediumIsolationDBSumPtCorr.clone(
184  ApplyDiscriminationByTrackerIsolation = True,
185  ApplyDiscriminationByECALIsolation = True,
186  deltaBetaFactor = "%0.4f"%(0.0772/0.1687),
187  applyOccupancyCut = False,
188  applySumPtCut = True,
189  maximumSumPtCut = 1.0,
190  Prediscriminants = requireDecayMode.clone()
191  )
192 hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minTrackPt = 0.5
193 hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minGammaEt = 0.5
194 
195 hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr = hpsPFTauDiscriminationByTightIsolationDBSumPtCorr.clone(
196  ApplyDiscriminationByTrackerIsolation = True,
197  ApplyDiscriminationByECALIsolation = True,
198  deltaBetaFactor = "%0.4f"%(0.0772/0.1687),
199  applyOccupancyCut = False,
200  applySumPtCut = True,
201  maximumSumPtCut = 0.8,
202  Prediscriminants = requireDecayMode.clone()
203  )
204 hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minTrackPt = 0.5
205 hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr.qualityCuts.isolationQualityCuts.minGammaEt = 0.5
206 
207 hpsPFTauDiscriminationByCombinedIsolationSeqDBSumPtCorr = cms.Sequence(
208  hpsPFTauDiscriminationByVLooseCombinedIsolationDBSumPtCorr*
209  hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr*
210  hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr*
211  hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr
212  )
213 
214 #Charge isolation based on combined isolation
215 hpsPFTauDiscriminationByVLooseChargedIsolation = hpsPFTauDiscriminationByVLooseCombinedIsolationDBSumPtCorr.clone(
216  ApplyDiscriminationByECALIsolation = False
217  )
218 
219 hpsPFTauDiscriminationByLooseChargedIsolation = hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr.clone(
220  ApplyDiscriminationByECALIsolation = False
221  )
222 
223 hpsPFTauDiscriminationByMediumChargedIsolation = hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr.clone(
224  ApplyDiscriminationByECALIsolation = False
225  )
226 hpsPFTauDiscriminationByTightChargedIsolation = hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr.clone(
227  ApplyDiscriminationByECALIsolation = False
228  )
229 
230 
231 hpsPFTauDiscriminationByChargedIsolationSeq = cms.Sequence(
232  hpsPFTauDiscriminationByVLooseChargedIsolation*
233  hpsPFTauDiscriminationByLooseChargedIsolation*
234  hpsPFTauDiscriminationByMediumChargedIsolation*
235  hpsPFTauDiscriminationByTightChargedIsolation
236  )
237 
238 
239 # Define MVA based isolation discrimators
240 # MVA Isolation Version 1
241 hpsPFTauDiscriminationByIsolationMVAraw = pfRecoTauDiscriminationByMVAIsolation.clone(
242  PFTauProducer = cms.InputTag("hpsPFTauProducer"),
243  Prediscriminants = requireDecayMode.clone(),
244  returnMVA = cms.bool(True),
245  )
246 
247 hpsPFTauDiscriminationByLooseIsolationMVA = hpsPFTauDiscriminationByDecayModeFinding.clone(
248  Prediscriminants = cms.PSet(
249  BooleanOperator = cms.string("and"),
250  mva = cms.PSet(
251  Producer = cms.InputTag('hpsPFTauDiscriminationByIsolationMVAraw'),
252  cut = cms.double(0.795)
253  )
254  ))
255 hpsPFTauDiscriminationByMediumIsolationMVA = copy.deepcopy(hpsPFTauDiscriminationByLooseIsolationMVA)
256 hpsPFTauDiscriminationByMediumIsolationMVA.Prediscriminants.mva.cut = cms.double(0.884)
257 hpsPFTauDiscriminationByTightIsolationMVA = copy.deepcopy(hpsPFTauDiscriminationByLooseIsolationMVA)
258 hpsPFTauDiscriminationByTightIsolationMVA.Prediscriminants.mva.cut = cms.double(0.921)
259 
260 # MVA Isolation Version 2
261 hpsPFTauDiscriminationByIsolationMVA2raw = pfRecoTauDiscriminationByMVAIsolation.clone(
262  PFTauProducer = cms.InputTag("hpsPFTauProducer"),
263  Prediscriminants = requireDecayMode.clone(),
264  returnMVA = cms.bool(True),
265  gbrfFilePath = cms.FileInPath('RecoTauTag/RecoTau/data/gbrfTauIso_v2.root')
266  )
267 
268 hpsPFTauDiscriminationByLooseIsolationMVA2 = hpsPFTauDiscriminationByDecayModeFinding.clone(
269  Prediscriminants = cms.PSet(
270  BooleanOperator = cms.string("and"),
271  mva = cms.PSet(
272  Producer = cms.InputTag('hpsPFTauDiscriminationByIsolationMVA2raw'),
273  cut = cms.double(0.85)
274  )
275  ))
276 hpsPFTauDiscriminationByMediumIsolationMVA2 = copy.deepcopy(hpsPFTauDiscriminationByLooseIsolationMVA2)
277 hpsPFTauDiscriminationByMediumIsolationMVA2.Prediscriminants.mva.cut = cms.double(0.90)
278 hpsPFTauDiscriminationByTightIsolationMVA2 = copy.deepcopy(hpsPFTauDiscriminationByLooseIsolationMVA2)
279 hpsPFTauDiscriminationByTightIsolationMVA2.Prediscriminants.mva.cut = cms.double(0.94)
280 
281 from RecoJets.Configuration.RecoPFJets_cff import kt6PFJets as _dummy
282 kt6PFJetsForRhoComputationVoronoi = _dummy.clone(
283  doRhoFastjet = True,
284  voronoiRfact = 0.9
285 )
286 
287 hpsPFTauDiscriminationByMVAIsolationSeq = cms.Sequence(
288  kt6PFJetsForRhoComputationVoronoi*
289  hpsPFTauDiscriminationByIsolationMVAraw*
290  hpsPFTauDiscriminationByLooseIsolationMVA*
291  hpsPFTauDiscriminationByMediumIsolationMVA*
292  hpsPFTauDiscriminationByTightIsolationMVA*
293  hpsPFTauDiscriminationByIsolationMVA2raw*
294  hpsPFTauDiscriminationByLooseIsolationMVA2*
295  hpsPFTauDiscriminationByMediumIsolationMVA2*
296  hpsPFTauDiscriminationByTightIsolationMVA2
297  )
298 
299 #copying discriminator against electrons and muons
300 hpsPFTauDiscriminationByLooseElectronRejection = pfRecoTauDiscriminationAgainstElectron.clone(
301  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
302  Prediscriminants = noPrediscriminants,
303  PFElectronMVA_maxValue = cms.double(0.6)
304  )
305 
306 hpsPFTauDiscriminationByMediumElectronRejection = pfRecoTauDiscriminationAgainstElectron.clone(
307  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
308  Prediscriminants = noPrediscriminants,
309  ApplyCut_EcalCrackCut = cms.bool(True)
310  )
311 
312 hpsPFTauDiscriminationByTightElectronRejection = pfRecoTauDiscriminationAgainstElectron.clone(
313  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
314  Prediscriminants = noPrediscriminants,
315  ApplyCut_EcalCrackCut = cms.bool(True),
316  ApplyCut_BremCombined = cms.bool(True)
317  )
318 
319 hpsPFTauDiscriminationByLooseMuonRejection = pfRecoTauDiscriminationAgainstMuon.clone(
320  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
321  Prediscriminants = noPrediscriminants
322  )
323 
324 hpsPFTauDiscriminationByMediumMuonRejection = pfRecoTauDiscriminationAgainstMuon.clone(
325  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
326  Prediscriminants = noPrediscriminants,
327  discriminatorOption = cms.string('noAllArbitrated')
328  )
329 
330 hpsPFTauDiscriminationByTightMuonRejection = pfRecoTauDiscriminationAgainstMuon.clone(
331  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
332  Prediscriminants = noPrediscriminants,
333  discriminatorOption = cms.string('noAllArbitratedWithHOP')
334  )
335 
336 hpsPFTauDiscriminationByLooseMuonRejection2 = pfRecoTauDiscriminationAgainstMuon2.clone(
337  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
338  Prediscriminants = noPrediscriminants
339  )
340 
341 hpsPFTauDiscriminationByMediumMuonRejection2 = pfRecoTauDiscriminationAgainstMuon2.clone(
342  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
343  Prediscriminants = noPrediscriminants,
344  discriminatorOption = cms.string('medium')
345  )
346 
347 hpsPFTauDiscriminationByTightMuonRejection2 = pfRecoTauDiscriminationAgainstMuon2.clone(
348  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
349  Prediscriminants = noPrediscriminants,
350  discriminatorOption = cms.string('tight')
351  )
352 
353 hpsPFTauDiscriminationByLooseMuonRejection3 = pfRecoTauDiscriminationAgainstMuon2.clone(
354  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
355  Prediscriminants = noPrediscriminants,
356  discriminatorOption = cms.string('custom'),
357  maxNumberOfMatches = cms.int32(1),
358  doCaloMuonVeto = cms.bool(True),
359  maxNumberOfHitsLast2Stations = cms.int32(-1)
360  )
361 
362 hpsPFTauDiscriminationByTightMuonRejection3 = hpsPFTauDiscriminationByLooseMuonRejection3.clone(
363  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
364  Prediscriminants = noPrediscriminants,
365  maxNumberOfHitsLast2Stations = cms.int32(0)
366  )
367 
368 
369 hpsPFTauDiscriminationByMVAElectronRejection = pfRecoTauDiscriminationAgainstElectronMVA.clone(
370  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
371  Prediscriminants = requireDecayMode.clone(),
372 )
373 
374 # Additionally require that the MVA electrons pass electron medium
375 # (this discriminator was used on the training sample)
376 hpsPFTauDiscriminationByMVAElectronRejection.Prediscriminants.electronMedium = \
377  cms.PSet(
378  Producer = cms.InputTag('hpsPFTauDiscriminationByMediumElectronRejection'),
379  cut = cms.double(0.5)
380  )
381 
382 hpsPFTauDiscriminationByMVA2rawElectronRejection = pfRecoTauDiscriminationAgainstElectronMVA2.clone(
383  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
384  Prediscriminants = requireDecayMode.clone()
385 )
386 
387 from RecoTauTag.RecoTau.RecoTauDiscriminantCutMultiplexer_cfi import recoTauDiscriminantCutMultiplexer
388 hpsPFTauDiscriminationByMVA2VLooseElectronRejection = recoTauDiscriminantCutMultiplexer.clone(
389  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
390  Prediscriminants = requireDecayMode.clone(),
391  toMultiplex = cms.InputTag('hpsPFTauDiscriminationByMVA2rawElectronRejection'),
392  key = cms.InputTag('hpsPFTauDiscriminationByMVA2rawElectronRejection:category'),
393  mapping = cms.VPSet(
394  cms.PSet(
395  category = cms.uint32(0), # minMVA1prongNoEleMatchBL
396  cut = cms.double(-0.141383)
397  ),
398  cms.PSet(
399  category = cms.uint32(1), # minMVA1prongBL
400  cut = cms.double(-0.122568)
401  ),
402  cms.PSet(
403  category = cms.uint32(2), # minMVA1prongStripsWOgsfBL
404  cut = cms.double(-0.138286)
405  ),
406  cms.PSet(
407  category = cms.uint32(3), # minMVA1prongStripsWgsfWOpfEleMvaBL
408  cut = cms.double(-0.100279)
409  ),
410  cms.PSet(
411  category = cms.uint32(4), # minMVA1prongStripsWgsfWpfEleMvaBL
412  cut = cms.double(-0.116113)
413  ),
414  cms.PSet(
415  category = cms.uint32(5), # minMVA1prongNoEleMatchEC
416  cut = cms.double(-0.191557)
417  ),
418  cms.PSet(
419  category = cms.uint32(6), # minMVA1prongEC
420  cut = cms.double(-0.0921955)
421  ),
422  cms.PSet(
423  category = cms.uint32(7), # minMVA1prongStripsWOgsfEC
424  cut = cms.double(-0.0936173)
425  ),
426  cms.PSet(
427  category = cms.uint32(8), # minMVA1prongStripsWgsfWOpfEleMvaEC
428  cut = cms.double(-0.119732)
429  ),
430  cms.PSet(
431  category = cms.uint32(9), # minMVA1prongStripsWgsfWpfEleMvaEC
432  cut = cms.double(-0.1042)
433  )
434  )
435 )
436 
437 hpsPFTauDiscriminationByMVA2LooseElectronRejection = copy.deepcopy(hpsPFTauDiscriminationByMVA2VLooseElectronRejection)
438 hpsPFTauDiscriminationByMVA2LooseElectronRejection.mapping[0].cut = cms.double(-0.0639254)
439 hpsPFTauDiscriminationByMVA2LooseElectronRejection.mapping[1].cut = cms.double(-0.0220708)
440 hpsPFTauDiscriminationByMVA2LooseElectronRejection.mapping[2].cut = cms.double(-0.102071)
441 hpsPFTauDiscriminationByMVA2LooseElectronRejection.mapping[3].cut = cms.double(-0.0233814)
442 hpsPFTauDiscriminationByMVA2LooseElectronRejection.mapping[4].cut = cms.double(-0.0391565)
443 hpsPFTauDiscriminationByMVA2LooseElectronRejection.mapping[5].cut = cms.double(-0.142564)
444 hpsPFTauDiscriminationByMVA2LooseElectronRejection.mapping[6].cut = cms.double(+0.00982555)
445 hpsPFTauDiscriminationByMVA2LooseElectronRejection.mapping[7].cut = cms.double(-0.0596019)
446 hpsPFTauDiscriminationByMVA2LooseElectronRejection.mapping[8].cut = cms.double(-0.0381238)
447 hpsPFTauDiscriminationByMVA2LooseElectronRejection.mapping[9].cut = cms.double(-0.100381)
448 
449 hpsPFTauDiscriminationByMVA2MediumElectronRejection = copy.deepcopy(hpsPFTauDiscriminationByMVA2VLooseElectronRejection)
450 hpsPFTauDiscriminationByMVA2MediumElectronRejection.mapping[0].cut = cms.double(+0.011729)
451 hpsPFTauDiscriminationByMVA2MediumElectronRejection.mapping[1].cut = cms.double(+0.0203646)
452 hpsPFTauDiscriminationByMVA2MediumElectronRejection.mapping[2].cut = cms.double(+0.177502)
453 hpsPFTauDiscriminationByMVA2MediumElectronRejection.mapping[3].cut = cms.double(+0.0103449)
454 hpsPFTauDiscriminationByMVA2MediumElectronRejection.mapping[4].cut = cms.double(+0.257798)
455 hpsPFTauDiscriminationByMVA2MediumElectronRejection.mapping[5].cut = cms.double(-0.0966083)
456 hpsPFTauDiscriminationByMVA2MediumElectronRejection.mapping[6].cut = cms.double(-0.0466023)
457 hpsPFTauDiscriminationByMVA2MediumElectronRejection.mapping[7].cut = cms.double(+0.0467638)
458 hpsPFTauDiscriminationByMVA2MediumElectronRejection.mapping[8].cut = cms.double(+0.0863876)
459 hpsPFTauDiscriminationByMVA2MediumElectronRejection.mapping[9].cut = cms.double(+0.233436)
460 
461 hpsPFTauDiscriminationByMVA2TightElectronRejection = copy.deepcopy(hpsPFTauDiscriminationByMVA2VLooseElectronRejection)
462 hpsPFTauDiscriminationByMVA2TightElectronRejection.mapping[0].cut = cms.double(+0.0306715)
463 hpsPFTauDiscriminationByMVA2TightElectronRejection.mapping[1].cut = cms.double(+0.992195)
464 hpsPFTauDiscriminationByMVA2TightElectronRejection.mapping[2].cut = cms.double(+0.308324)
465 hpsPFTauDiscriminationByMVA2TightElectronRejection.mapping[3].cut = cms.double(-0.0370998)
466 hpsPFTauDiscriminationByMVA2TightElectronRejection.mapping[4].cut = cms.double(+0.864643)
467 hpsPFTauDiscriminationByMVA2TightElectronRejection.mapping[5].cut = cms.double(+0.0832094)
468 hpsPFTauDiscriminationByMVA2TightElectronRejection.mapping[6].cut = cms.double(+0.791665)
469 hpsPFTauDiscriminationByMVA2TightElectronRejection.mapping[7].cut = cms.double(+0.675537)
470 hpsPFTauDiscriminationByMVA2TightElectronRejection.mapping[8].cut = cms.double(+0.87047)
471 hpsPFTauDiscriminationByMVA2TightElectronRejection.mapping[9].cut = cms.double(+0.233711)
472 
473 hpsPFTauDiscriminationByMVA3rawElectronRejection = pfRecoTauDiscriminationAgainstElectronMVA3.clone(
474  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
475  Prediscriminants = requireDecayMode.clone()
476 )
477 
478 hpsPFTauDiscriminationByMVA3LooseElectronRejection = recoTauDiscriminantCutMultiplexer.clone(
479  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
480  Prediscriminants = requireDecayMode.clone(),
481  toMultiplex = cms.InputTag('hpsPFTauDiscriminationByMVA3rawElectronRejection'),
482  key = cms.InputTag('hpsPFTauDiscriminationByMVA3rawElectronRejection:category'),
483  mapping = cms.VPSet(
484  cms.PSet(
485  category = cms.uint32(0), # minMVA1prongNoEleMatchWOgWOgsfBL
486  cut = cms.double(0.1816889)
487  ),
488  cms.PSet(
489  category = cms.uint32(1), # minMVA1prongNoEleMatchWOgWgsfBL
490  cut = cms.double(0.1538533)
491  ),
492  cms.PSet(
493  category = cms.uint32(2), # minMVA1prongNoEleMatchWgWOgsfBL
494  cut = cms.double(0.5605197)
495  ),
496  cms.PSet(
497  category = cms.uint32(3), # minMVA1prongNoEleMatchWgWgsfBL
498  cut = cms.double(0.66321647)
499  ),
500  cms.PSet(
501  category = cms.uint32(4), # minMVA1prongWOgWOgsfBL
502  cut = cms.double(0.86337829)
503  ),
504  cms.PSet(
505  category = cms.uint32(5), # minMVA1prongWOgWgsfBL
506  cut = cms.double(0.94084531)
507  ),
508  cms.PSet(
509  category = cms.uint32(6), # minMVA1prongWgWOgsfBL
510  cut = cms.double(0.98025548)
511  ),
512  cms.PSet(
513  category = cms.uint32(7), # minMVA1prongWgWgsfBL
514  cut = cms.double(0.80039471)
515  ),
516  cms.PSet(
517  category = cms.uint32(8), # minMVA1prongNoEleMatchWOgWOgsfEC
518  cut = cms.double(-1.0)
519  ),
520  cms.PSet(
521  category = cms.uint32(9), # minMVA1prongNoEleMatchWOgWgsfEC
522  cut = cms.double(0.49787951)
523  ),
524  cms.PSet(
525  category = cms.uint32(10), # minMVA1prongNoEleMatchWgWOgsfEC
526  cut = cms.double(0.74751109)
527  ),
528  cms.PSet(
529  category = cms.uint32(11), # minMVA1prongNoEleMatchWgWgsfEC
530  cut = cms.double(0.94486511)
531  ),
532  cms.PSet(
533  category = cms.uint32(12), # minMVA1prongWOgWOgsfEC
534  cut = cms.double(0.63645148)
535  ),
536  cms.PSet(
537  category = cms.uint32(13), # minMVA1prongWOgWgsfEC
538  cut = cms.double(0.9575507)
539  ),
540  cms.PSet(
541  category = cms.uint32(14), # minMVA1prongWgWOgsfEC
542  cut = cms.double(0.9549247)
543  ),
544  cms.PSet(
545  category = cms.uint32(15), # minMVA1prongWgWgsfEC
546  cut = cms.double(0.83487612)
547  ),
548  cms.PSet(
549  category = cms.uint32(16), # minMVA3prongMatch
550  cut = cms.double(-1.)
551  ),
552  cms.PSet(
553  category = cms.uint32(17), # minMVA3prongNoMatch
554  cut = cms.double(-1.)
555  )
556  )
557 )
558 
559 hpsPFTauDiscriminationByMVA3MediumElectronRejection = copy.deepcopy(hpsPFTauDiscriminationByMVA3LooseElectronRejection)
560 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[0].cut = cms.double(0.5577119)
561 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[1].cut = cms.double(0.7271899)
562 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[2].cut = cms.double(0.90410149)
563 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[3].cut = cms.double(0.94858187)
564 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[4].cut = cms.double(0.95044029)
565 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[5].cut = cms.double(0.97195327)
566 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[6].cut = cms.double(0.99229473)
567 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[7].cut = cms.double(0.92997772)
568 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[8].cut = cms.double(-0.3049897)
569 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[9].cut = cms.double(0.92191792)
570 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[10].cut = cms.double(0.96017671)
571 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[11].cut = cms.double(0.98126549)
572 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[12].cut = cms.double(0.80912107)
573 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[13].cut = cms.double(0.98326528)
574 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[14].cut = cms.double(0.97490251)
575 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[15].cut = cms.double(0.94708711)
576 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[16].cut = cms.double(-1.)
577 hpsPFTauDiscriminationByMVA3MediumElectronRejection.mapping[17].cut = cms.double(-1.)
578 
579 hpsPFTauDiscriminationByMVA3TightElectronRejection = copy.deepcopy(hpsPFTauDiscriminationByMVA3LooseElectronRejection)
580 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[0].cut = cms.double(0.78914332)
581 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[1].cut = cms.double(0.91818088)
582 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[2].cut = cms.double(0.96754968)
583 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[3].cut = cms.double(0.98437631)
584 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[4].cut = cms.double(0.96684271)
585 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[5].cut = cms.double(0.99065852)
586 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[6].cut = cms.double(0.99797088)
587 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[7].cut = cms.double(0.96952927)
588 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[8].cut = cms.double(0.1180589)
589 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[9].cut = cms.double(0.9714281)
590 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[10].cut = cms.double(0.98451769)
591 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[11].cut = cms.double(0.99372888)
592 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[12].cut = cms.double(0.84681427)
593 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[13].cut = cms.double(0.98940611)
594 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[14].cut = cms.double(0.98308349)
595 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[15].cut = cms.double(0.97482169)
596 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[16].cut = cms.double(-1.)
597 hpsPFTauDiscriminationByMVA3TightElectronRejection.mapping[17].cut = cms.double(-1.)
598 
599 hpsPFTauDiscriminationByMVA3VTightElectronRejection = copy.deepcopy(hpsPFTauDiscriminationByMVA3LooseElectronRejection)
600 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[0].cut = cms.double(0.89307231)
601 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[1].cut = cms.double(0.96239871)
602 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[2].cut = cms.double(0.98247749)
603 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[3].cut = cms.double(0.99013329)
604 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[4].cut = cms.double(0.9768821)
605 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[5].cut = cms.double(0.9958095)
606 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[6].cut = cms.double(0.99797088)
607 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[7].cut = cms.double(0.98120493)
608 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[8].cut = cms.double(0.60025311)
609 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[9].cut = cms.double(0.98320472)
610 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[10].cut = cms.double(0.9897899)
611 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[11].cut = cms.double(0.9964357)
612 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[12].cut = cms.double(0.88230568)
613 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[13].cut = cms.double(0.99132508)
614 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[14].cut = cms.double(0.98467928)
615 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[15].cut = cms.double(0.98235631)
616 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[16].cut = cms.double(-1.)
617 hpsPFTauDiscriminationByMVA3VTightElectronRejection.mapping[17].cut = cms.double(-1.)
618 
619 
620 hpsPFTauDiscriminationByDeadECALElectronRejection = pfRecoTauDiscriminationAgainstElectronDeadECAL.clone(
621  PFTauProducer = cms.InputTag('hpsPFTauProducer'),
622  Prediscriminants = requireDecayMode.clone()
623 )
624 
625 #Define new sequence that is using smaller number on hits cut
626 hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits = hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr.clone()
627 hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3Hits = hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr.clone()
628 hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr3Hits = hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr.clone()
629 
630 hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits.qualityCuts.isolationQualityCuts.minTrackHits = cms.uint32(3)
631 hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3Hits.qualityCuts.isolationQualityCuts.minTrackHits = cms.uint32(3)
632 hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr3Hits.qualityCuts.isolationQualityCuts.minTrackHits = cms.uint32(3)
633 
634 hpsPFTauDiscriminationByRawCombinedIsolationDBSumPtCorr3Hits = hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits.clone(
635  applySumPtCut = False,
636  storeRawSumPt = cms.bool(True)
637 )
638 
639 hpsPFTauDiscriminationByCombinedIsolationSeqDBSumPtCorr3Hits = cms.Sequence(
640  hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits*
641  hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3Hits*
642  hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr3Hits*
643  hpsPFTauDiscriminationByRawCombinedIsolationDBSumPtCorr3Hits
644 )
645 
646 # Define the HPS selection discriminator used in cleaning
647 hpsSelectionDiscriminator.PFTauProducer = cms.InputTag("combinatoricRecoTaus")
648 
649 import RecoTauTag.RecoTau.RecoTauCleanerPlugins as cleaners
650 
651 hpsPFTauProducerSansRefs = cms.EDProducer(
652  "RecoTauCleaner",
653  src = cms.InputTag("combinatoricRecoTaus"),
654  cleaners = cms.VPSet(
655  # Prefer taus that dont' have charge == 3
656  cleaners.unitCharge,
657  # Ignore taus reconstructed in pi0 decay modes in which the highest Pt ("leading") pi0 has pt below 2.5 GeV
658  # (in order to make decay mode reconstruction less sensitive to pile-up)
659  # NOTE: strips are sorted by decreasing pt
660  cms.PSet(
661  name = cms.string("leadStripPtLt2_5"),
662  plugin = cms.string("RecoTauStringCleanerPlugin"),
663  selection = cms.string("signalPiZeroCandidates().size() = 0 | signalPiZeroCandidates()[0].pt > 2.5"),
664  selectionPassFunction = cms.string("0"),
665  selectionFailValue = cms.double(1e3)
666  ),
667  # Prefer taus that are within DR<0.1 of the jet axis
668 # cleaners.matchingConeCut,
669  # Prefer taus that pass HPS selections
670  cms.PSet(
671  name = cms.string("HPS_Select"),
672  plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
673  src = cms.InputTag("hpsSelectionDiscriminator"),
674  ),
675  cleaners.combinedIsolation
676  )
677 )
678 
679 hpsPFTauProducer = cms.EDProducer(
680  "RecoTauPiZeroUnembedder",
681  src = cms.InputTag("hpsPFTauProducerSansRefs")
682 )
683 
684 produceHPSPFTaus = cms.Sequence(
685  hpsSelectionDiscriminator
686  #*hpsTightIsolationCleaner
687  #*hpsMediumIsolationCleaner
688  #*hpsLooseIsolationCleaner
689  #*hpsVLooseIsolationCleaner
690  *hpsPFTauProducerSansRefs
691  *hpsPFTauProducer
692 )
693 
694 produceAndDiscriminateHPSPFTaus = cms.Sequence(
695  produceHPSPFTaus*
696  hpsPFTauDiscriminationByDecayModeFinding*
697  hpsPFTauDiscriminationByChargedIsolationSeq*
698  hpsPFTauDiscriminationByIsolationSeq*
699  #hpsPFTauDiscriminationByIsolationSeqRhoCorr*
700  #hpsPFTauDiscriminationByIsolationSeqCustomRhoCorr*
701  hpsPFTauDiscriminationByIsolationSeqDBSumPtCorr*
702  hpsPFTauDiscriminationByMVAIsolationSeq*
703 
704  hpsPFTauDiscriminationByRawCombinedIsolationDBSumPtCorr*
705  hpsPFTauDiscriminationByRawChargedIsolationDBSumPtCorr*
706  hpsPFTauDiscriminationByRawGammaIsolationDBSumPtCorr*
707 
708  hpsPFTauDiscriminationByCombinedIsolationSeqDBSumPtCorr*
709  hpsPFTauDiscriminationByCombinedIsolationSeqDBSumPtCorr3Hits*
710 
711  hpsPFTauDiscriminationByLooseElectronRejection*
712  hpsPFTauDiscriminationByMediumElectronRejection*
713  hpsPFTauDiscriminationByTightElectronRejection*
714  hpsPFTauDiscriminationByMVAElectronRejection*
715  hpsPFTauDiscriminationByMVA2rawElectronRejection*
716  hpsPFTauDiscriminationByMVA2VLooseElectronRejection*
717  hpsPFTauDiscriminationByMVA2LooseElectronRejection*
718  hpsPFTauDiscriminationByMVA2MediumElectronRejection*
719  hpsPFTauDiscriminationByMVA2TightElectronRejection*
720  hpsPFTauDiscriminationByMVA3rawElectronRejection*
721  hpsPFTauDiscriminationByMVA3LooseElectronRejection*
722  hpsPFTauDiscriminationByMVA3MediumElectronRejection*
723  hpsPFTauDiscriminationByMVA3TightElectronRejection*
724  hpsPFTauDiscriminationByMVA3VTightElectronRejection*
725  hpsPFTauDiscriminationByDeadECALElectronRejection*
726  hpsPFTauDiscriminationByLooseMuonRejection*
727  hpsPFTauDiscriminationByMediumMuonRejection*
728  hpsPFTauDiscriminationByTightMuonRejection*
729  hpsPFTauDiscriminationByLooseMuonRejection2*
730  hpsPFTauDiscriminationByMediumMuonRejection2*
731  hpsPFTauDiscriminationByTightMuonRejection2*
732  hpsPFTauDiscriminationByLooseMuonRejection3*
733  hpsPFTauDiscriminationByTightMuonRejection3
734 
735 )