CMS 3D CMS Logo

cutBasedElectronID_tools.py
Go to the documentation of this file.
1 
2 import FWCore.ParameterSet.Config as cms
3 
4 # Barrel/endcap division in eta
5 ebCutOff = 1.479
6 
7 # ===============================================
8 # Define containers used by cut definitions
9 # ===============================================
10 
12  """
13  A container class that holds the name of the file with the effective
14  area constants for pile-up corrections
15  """
16  def __init__(self,
17  isoEffAreas
18  ):
19  self.isoEffAreas = isoEffAreas
20 
21 
23  """
24  This is a container class to hold numerical cut values for either
25  the barrel or endcap set of cuts for electron cut-based ID
26  """
27  def __init__(self,
28  idName,
29  dEtaInCut,
30  dPhiInCut,
31  full5x5_sigmaIEtaIEtaCut,
32  hOverECut,
33  dxyCut,
34  dzCut,
35  absEInverseMinusPInverseCut,
36  relCombIsolationWithDBetaLowPtCut,
37  relCombIsolationWithDBetaHighPtCut,
38  # conversion veto cut needs no parameters, so not mentioned
39  missingHitsCut
40  ):
41  self.idName = idName
42  self.dEtaInCut = dEtaInCut
43  self.dPhiInCut = dPhiInCut
44  self.full5x5_sigmaIEtaIEtaCut = full5x5_sigmaIEtaIEtaCut
45  self.hOverECut = hOverECut
46  self.dxyCut = dxyCut
47  self.dzCut = dzCut
48  self.absEInverseMinusPInverseCut = absEInverseMinusPInverseCut
49  self.relCombIsolationWithDBetaLowPtCut = relCombIsolationWithDBetaLowPtCut
50  self.relCombIsolationWithDBetaHighPtCut = relCombIsolationWithDBetaHighPtCut
51  # conversion veto cut needs no parameters, so not mentioned
52  self.missingHitsCut = missingHitsCut
53 
55  """
56  This is a container class to hold numerical cut values for either
57  the barrel or endcap set of cuts for electron cut-based ID
58  """
59  def __init__(self,
60  idName,
61  dEtaInCut,
62  dPhiInCut,
63  full5x5_sigmaIEtaIEtaCut,
64  hOverECut,
65  dxyCut,
66  dzCut,
67  absEInverseMinusPInverseCut,
68  relCombIsolationWithEALowPtCut,
69  relCombIsolationWithEAHighPtCut,
70  # conversion veto cut needs no parameters, so not mentioned
71  missingHitsCut
72  ):
73  self.idName = idName
74  self.dEtaInCut = dEtaInCut
75  self.dPhiInCut = dPhiInCut
76  self.full5x5_sigmaIEtaIEtaCut = full5x5_sigmaIEtaIEtaCut
77  self.hOverECut = hOverECut
78  self.dxyCut = dxyCut
79  self.dzCut = dzCut
80  self.absEInverseMinusPInverseCut = absEInverseMinusPInverseCut
81  self.relCombIsolationWithEALowPtCut = relCombIsolationWithEALowPtCut
82  self.relCombIsolationWithEAHighPtCut = relCombIsolationWithEAHighPtCut
83  # conversion veto cut needs no parameters, so not mentioned
84  self.missingHitsCut = missingHitsCut
85 
87  """
88  This is a container class to hold numerical cut values for either
89  the barrel or endcap set of cuts for electron cut-based ID
90  With resepect to V2, the impact parameter cuts on dxy and dz are removed.
91  """
92  def __init__(self,
93  idName,
94  dEtaInSeedCut,
95  dPhiInCut,
96  full5x5_sigmaIEtaIEtaCut,
97  hOverECut,
98  absEInverseMinusPInverseCut,
99  relCombIsolationWithEALowPtCut,
100  relCombIsolationWithEAHighPtCut,
101  # conversion veto cut needs no parameters, so not mentioned
102  missingHitsCut
103  ):
104  self.idName = idName
105  self.dEtaInSeedCut = dEtaInSeedCut
106  self.dPhiInCut = dPhiInCut
107  self.full5x5_sigmaIEtaIEtaCut = full5x5_sigmaIEtaIEtaCut
108  self.hOverECut = hOverECut
109  self.absEInverseMinusPInverseCut = absEInverseMinusPInverseCut
110  self.relCombIsolationWithEALowPtCut = relCombIsolationWithEALowPtCut
111  self.relCombIsolationWithEAHighPtCut = relCombIsolationWithEAHighPtCut
112  # conversion veto cut needs no parameters, so not mentioned
113  self.missingHitsCut = missingHitsCut
114 
116  """
117  This is a container class to hold numerical cut values for either
118  the barrel or endcap set of cuts for electron cut-based ID
119  With respect to V3, the hOverE cut is made energy and pileup dependent as presented in
120  https://indico.cern.ch/event/662749/contributions/2763092/attachments/1545209/2425054/talk_electron_ID_2017.pdf
121  """
122  def __init__(self,
123  idName,
124  dEtaInSeedCut,
125  dPhiInCut,
126  full5x5_sigmaIEtaIEtaCut,
127  hOverECut_C0,
128  hOverECut_CE,
129  hOverECut_Cr,
130  absEInverseMinusPInverseCut,
131  relCombIsolationWithEALowPtCut,
132  relCombIsolationWithEAHighPtCut,
133  # conversion veto cut needs no parameters, so not mentioned
134  missingHitsCut
135  ):
136  self.idName = idName
137  self.dEtaInSeedCut = dEtaInSeedCut
138  self.dPhiInCut = dPhiInCut
139  self.full5x5_sigmaIEtaIEtaCut = full5x5_sigmaIEtaIEtaCut
140  self.hOverECut_C0 = hOverECut_C0
141  self.hOverECut_CE = hOverECut_CE
142  self.hOverECut_Cr = hOverECut_Cr
143  self.absEInverseMinusPInverseCut = absEInverseMinusPInverseCut
144  self.relCombIsolationWithEALowPtCut = relCombIsolationWithEALowPtCut
145  self.relCombIsolationWithEAHighPtCut = relCombIsolationWithEAHighPtCut
146  # conversion veto cut needs no parameters, so not mentioned
147  self.missingHitsCut = missingHitsCut
148 
149 
151  """
152  This is a container class to hold numerical cut values for either
153  the barrel or endcap set of cuts for electron cut-based ID
154  With respect to V4, the isolation cut is made pt dependent as presented in the following meeting: https://indico.cern.ch/event/697079/
155  """
156  def __init__(self,
157  idName,
158  dEtaInSeedCut,
159  dPhiInCut,
160  full5x5_sigmaIEtaIEtaCut,
161  hOverECut_C0,
162  hOverECut_CE,
163  hOverECut_Cr,
164  absEInverseMinusPInverseCut,
165  relCombIsolationWithEACut_C0,
166  relCombIsolationWithEACut_Cpt,
167  # conversion veto cut needs no parameters, so not mentioned
168  missingHitsCut
169  ):
170  self.idName = idName
171  self.dEtaInSeedCut = dEtaInSeedCut
172  self.dPhiInCut = dPhiInCut
173  self.full5x5_sigmaIEtaIEtaCut = full5x5_sigmaIEtaIEtaCut
174  self.hOverECut_C0 = hOverECut_C0
175  self.hOverECut_CE = hOverECut_CE
176  self.hOverECut_Cr = hOverECut_Cr
177  self.absEInverseMinusPInverseCut = absEInverseMinusPInverseCut
178  self.relCombIsolationWithEACut_C0 = relCombIsolationWithEACut_C0
179  self.relCombIsolationWithEACut_Cpt = relCombIsolationWithEACut_Cpt
180  # conversion veto cut needs no parameters, so not mentioned
181  self.missingHitsCut = missingHitsCut
182 
183 
184 
185 
187  """
188  This is a container class to hold numerical cut values for either
189  the barrel or endcap set of cuts for electron cut-based HLT-safe preselection
190  """
191  def __init__(self,
192  idName,
193  full5x5_sigmaIEtaIEtaCut,
194  dEtaInSeedCut,
195  dPhiInCut,
196  hOverECut,
197  absEInverseMinusPInverseCut,
198  # isolations
199  ecalPFClusterIsoLowPtCut,
200  ecalPFClusterIsoHighPtCut,
201  hcalPFClusterIsoLowPtCut,
202  hcalPFClusterIsoHighPtCut,
203  trkIsoSlopeTerm,
204  trkIsoSlopeStart,
205  trkIsoConstTerm,
206  #
207  normalizedGsfChi2Cut
208  ):
209  self.idName = idName
210  self.full5x5_sigmaIEtaIEtaCut = full5x5_sigmaIEtaIEtaCut
211  self.dEtaInSeedCut = dEtaInSeedCut
212  self.dPhiInCut = dPhiInCut
213  self.hOverECut = hOverECut
214  self.absEInverseMinusPInverseCut = absEInverseMinusPInverseCut
215  self.ecalPFClusterIsoLowPtCut = ecalPFClusterIsoLowPtCut
216  self.ecalPFClusterIsoHighPtCut = ecalPFClusterIsoHighPtCut
217  self.hcalPFClusterIsoLowPtCut = hcalPFClusterIsoLowPtCut
218  self.hcalPFClusterIsoHighPtCut = hcalPFClusterIsoHighPtCut
219  self.trkIsoSlopeTerm = trkIsoSlopeTerm
220  self.trkIsoSlopeStart = trkIsoSlopeStart
221  self.trkIsoConstTerm = trkIsoConstTerm
222  #
223  self.normalizedGsfChi2Cut = normalizedGsfChi2Cut
224 
225 
226 # ==============================================================
227 # Define individual cut configurations used by complete cut sets
228 # ==============================================================
229 
230 
231 # The mininum pt cut is set to 5 GeV
233  return cms.PSet(
234  cutName = cms.string("MinPtCut"),
235  minPt = cms.double(5.0),
236  needsAdditionalProducts = cms.bool(False),
237  isIgnored = cms.bool(False)
238  )
239 
240 # Take all particles in the eta ranges 0-ebCutOff and ebCutOff-2.5
242  return cms.PSet(
243  cutName = cms.string("GsfEleSCEtaMultiRangeCut"),
244  useAbsEta = cms.bool(True),
245  allowedEtaRanges = cms.VPSet(
246  cms.PSet( minEta = cms.double(0.0),
247  maxEta = cms.double(ebCutOff) ),
248  cms.PSet( minEta = cms.double(ebCutOff),
249  maxEta = cms.double(2.5) )
250  ),
251  needsAdditionalProducts = cms.bool(False),
252  isIgnored = cms.bool(False)
253  )
254 
255 # Configure the cut on full5x5 sigmaIEtaIEta
257  return cms.PSet(
258  cutName = cms.string('GsfEleFull5x5SigmaIEtaIEtaCut'),
259  full5x5SigmaIEtaIEtaCutValueEB = cms.double( wpEB.full5x5_sigmaIEtaIEtaCut ),
260  full5x5SigmaIEtaIEtaCutValueEE = cms.double( wpEE.full5x5_sigmaIEtaIEtaCut ),
261  barrelCutOff = cms.double(ebCutOff),
262  needsAdditionalProducts = cms.bool(False),
263  isIgnored = cms.bool(False)
264  )
265 
266 # Configure the cut on dEta seed
267 def psetDEtaInSeedCut(wpEB, wpEE):
268  return cms.PSet(
269  cutName = cms.string('GsfEleDEtaInSeedCut'),
270  dEtaInSeedCutValueEB = cms.double( wpEB.dEtaInSeedCut ),
271  dEtaInSeedCutValueEE = cms.double( wpEE.dEtaInSeedCut ),
272  barrelCutOff = cms.double(ebCutOff),
273  needsAdditionalProducts = cms.bool(False),
274  isIgnored = cms.bool(False)
275  )
276 
277 # Configure dPhiIn cut
278 def psetDPhiInCut(wpEB, wpEE):
279  return cms.PSet(
280  cutName = cms.string('GsfEleDPhiInCut'),
281  dPhiInCutValueEB = cms.double( wpEB.dPhiInCut ),
282  dPhiInCutValueEE = cms.double( wpEE.dPhiInCut ),
283  barrelCutOff = cms.double(ebCutOff),
284  needsAdditionalProducts = cms.bool(False),
285  isIgnored = cms.bool(False)
286  )
287 
288 # Configure H/E cut
289 def psetHadronicOverEMCut(wpEB, wpEE):
290  return cms.PSet(
291  cutName = cms.string('GsfEleHadronicOverEMCut'),
292  hadronicOverEMCutValueEB = cms.double( wpEB.hOverECut ),
293  hadronicOverEMCutValueEE = cms.double( wpEE.hOverECut ),
294  barrelCutOff = cms.double(ebCutOff),
295  needsAdditionalProducts = cms.bool(False),
296  isIgnored = cms.bool(False)
297  )
298 
299 # Configure energy and pileup dependent H/E cut
301  return cms.PSet(
302  cutName = cms.string('GsfEleHadronicOverEMEnergyScaledCut'),
303  barrelC0 = cms.double( wpEB.hOverECut_C0 ),
304  barrelCE = cms.double( wpEB.hOverECut_CE ),
305  barrelCr = cms.double( wpEB.hOverECut_Cr ),
306  endcapC0 = cms.double( wpEE.hOverECut_C0 ),
307  endcapCE = cms.double( wpEE.hOverECut_CE ),
308  endcapCr = cms.double( wpEE.hOverECut_Cr ),
309  rho = cms.InputTag("fixedGridRhoFastjetAll"),
310  barrelCutOff = cms.double(ebCutOff),
311  needsAdditionalProducts = cms.bool(True),
312  isIgnored = cms.bool(False)
313  )
314 
315 
316 # Configure |1/E-1/p| cut
318  return cms.PSet(
319  cutName = cms.string('GsfEleEInverseMinusPInverseCut'),
320  eInverseMinusPInverseCutValueEB = cms.double( wpEB.absEInverseMinusPInverseCut ),
321  eInverseMinusPInverseCutValueEE = cms.double( wpEE.absEInverseMinusPInverseCut ),
322  barrelCutOff = cms.double(ebCutOff),
323  needsAdditionalProducts = cms.bool(False),
324  isIgnored = cms.bool(False)
325  )
326 
327 # Configure ECAL PF Cluster isolation cut. Note that this cut requires
328 # effective area constants file as input
329 def psetEcalPFClusterIsoCut(wpEB, wpEE, ecalIsoInputs):
330  return cms.PSet(
331  cutName = cms.string('GsfEleCalPFClusterIsoCut'),
332  isoType = cms.int32( 0 ), # ECAL = 0, HCAL = 1, see cut class header for IsoType enum
333  isoCutEBLowPt = cms.double( wpEB.ecalPFClusterIsoLowPtCut ),
334  isoCutEBHighPt = cms.double( wpEB.ecalPFClusterIsoHighPtCut ),
335  isoCutEELowPt = cms.double( wpEE.ecalPFClusterIsoLowPtCut ),
336  isoCutEEHighPt = cms.double( wpEE.ecalPFClusterIsoHighPtCut ),
337  isRelativeIso = cms.bool(True),
338  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
339  barrelCutOff = cms.double(ebCutOff),
340  rho = cms.InputTag("fixedGridRhoFastjetCentralCalo"), # This rho is best for emulation
341  # while HLT uses ...AllCalo
342  effAreasConfigFile = cms.FileInPath( ecalIsoInputs.isoEffAreas ),
343  needsAdditionalProducts = cms.bool(True),
344  isIgnored = cms.bool(False)
345  )
346 
347 # Configure HCAL PF Cluster isolation cut. Note that this cut requires
348 # effective area constants file as input
349 def psetHcalPFClusterIsoCut(wpEB, wpEE, hcalIsoInputs):
350  return cms.PSet(
351  cutName = cms.string('GsfEleCalPFClusterIsoCut'),
352  isoType = cms.int32( 1 ), # ECAL = 0, HCAL = 1, see cut class header for IsoType enum
353  isoCutEBLowPt = cms.double( wpEB.hcalPFClusterIsoLowPtCut ),
354  isoCutEBHighPt = cms.double( wpEB.hcalPFClusterIsoHighPtCut ),
355  isoCutEELowPt = cms.double( wpEE.hcalPFClusterIsoLowPtCut ),
356  isoCutEEHighPt = cms.double( wpEE.hcalPFClusterIsoHighPtCut ),
357  isRelativeIso = cms.bool(True),
358  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
359  barrelCutOff = cms.double(ebCutOff),
360  rho = cms.InputTag("fixedGridRhoFastjetCentralCalo"), # This rho is best for emulation
361  # while HLT uses ...AllCalo
362  effAreasConfigFile = cms.FileInPath( hcalIsoInputs.isoEffAreas ),
363  needsAdditionalProducts = cms.bool(True),
364  isIgnored = cms.bool(False)
365  )
366 
367 # Configure tracker isolation cut
368 def psetTrkPtIsoCut(wpEB, wpEE):
369  return cms.PSet(
370  cutName = cms.string('GsfEleTrkPtIsoCut'),
371  # Three constants for the GsfEleTrkPtIsoCut
372  # cut = constTerm if Et < slopeStart
373  # cut = slopeTerm * (Et - slopeStart) + constTerm if Et >= slopeStart
374  slopeTermEB = cms.double( wpEB.trkIsoSlopeTerm ),
375  slopeTermEE = cms.double( wpEE.trkIsoSlopeTerm ),
376  slopeStartEB = cms.double( wpEB.trkIsoSlopeStart ),
377  slopeStartEE = cms.double( wpEE.trkIsoSlopeStart ),
378  constTermEB = cms.double( wpEB.trkIsoConstTerm ),
379  constTermEE = cms.double( wpEE.trkIsoConstTerm ),
380  needsAdditionalProducts = cms.bool(False),
381  isIgnored = cms.bool(False)
382  )
383 
384 # Configure GsfTrack chi2/NDOF cut
385 def psetNormalizedGsfChi2Cut(wpEB, wpEE):
386  return cms.PSet(
387  cutName = cms.string('GsfEleNormalizedGsfChi2Cut'),
388  normalizedGsfChi2CutValueEB = cms.double( wpEB.normalizedGsfChi2Cut ),
389  normalizedGsfChi2CutValueEE = cms.double( wpEE.normalizedGsfChi2Cut ),
390  barrelCutOff = cms.double(ebCutOff),
391  needsAdditionalProducts = cms.bool(False),
392  isIgnored = cms.bool(False)
393  )
394 
395 def psetEffAreaPFIsoCut(wpEB, wpEE, isoInputs):
396  return cms.PSet(
397  cutName = cms.string('GsfEleEffAreaPFIsoCut'),
398  isoCutEBLowPt = cms.double( wpEB.relCombIsolationWithEALowPtCut ),
399  isoCutEBHighPt = cms.double( wpEB.relCombIsolationWithEAHighPtCut ),
400  isoCutEELowPt = cms.double( wpEE.relCombIsolationWithEALowPtCut ),
401  isoCutEEHighPt = cms.double( wpEE.relCombIsolationWithEAHighPtCut ),
402  isRelativeIso = cms.bool(True),
403  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
404  barrelCutOff = cms.double(ebCutOff),
405  rho = cms.InputTag("fixedGridRhoFastjetAll"),
406  effAreasConfigFile = cms.FileInPath( isoInputs.isoEffAreas ),
407  needsAdditionalProducts = cms.bool(True),
408  isIgnored = cms.bool(False)
409  )
410 
411 def psetRelPFIsoScaledCut(wpEB, wpEE, isoInputs):
412  return cms.PSet(
413  cutName = cms.string('GsfEleRelPFIsoScaledCut'),
414  barrelC0 = cms.double(wpEB.relCombIsolationWithEACut_C0),
415  endcapC0 = cms.double(wpEE.relCombIsolationWithEACut_C0),
416  barrelCpt = cms.double(wpEB.relCombIsolationWithEACut_Cpt),
417  endcapCpt = cms.double(wpEE.relCombIsolationWithEACut_Cpt),
418  barrelCutOff = cms.double(ebCutOff),
419  rho = cms.InputTag("fixedGridRhoFastjetAll"),
420  effAreasConfigFile = cms.FileInPath( isoInputs.isoEffAreas ),
421  needsAdditionalProducts = cms.bool(True),
422  isIgnored = cms.bool(False)
423  )
424 
425 
427  return cms.PSet(
428  cutName = cms.string('GsfEleConversionVetoCut'),
429  conversionSrc = cms.InputTag('allConversions'),
430  conversionSrcMiniAOD = cms.InputTag('reducedEgamma:reducedConversions'),
431  beamspotSrc = cms.InputTag('offlineBeamSpot'),
432  needsAdditionalProducts = cms.bool(True),
433  isIgnored = cms.bool(False)
434  )
435 
436 def psetMissingHitsCut(wpEB, wpEE):
437  return cms.PSet(
438  cutName = cms.string('GsfEleMissingHitsCut'),
439  maxMissingHitsEB = cms.uint32( wpEB.missingHitsCut ),
440  maxMissingHitsEE = cms.uint32( wpEE.missingHitsCut ),
441  barrelCutOff = cms.double(ebCutOff),
442  needsAdditionalProducts = cms.bool(False),
443  isIgnored = cms.bool(False)
444  )
445 
446 
447 # -----------------------------
448 # Version V1 common definitions
449 # -----------------------------
450 
451 # This cut set definition is in the old style, with everything configured
452 # in one go. It is kept to minimize changes. New definitions should use
453 # PSets defined above instead.
455  """
456  This function configures the full cms.PSet for a VID ID and returns it.
457  The inputs: two objects of the type WorkingPoint_V1, one
458  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
459  """
460  # print "VID: Configuring cut set %s" % wpEB.idName
461  parameterSet = cms.PSet(
462  #
463  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
464  cutFlow = cms.VPSet(
465  cms.PSet( cutName = cms.string("MinPtCut"),
466  minPt = cms.double(5.0),
467  needsAdditionalProducts = cms.bool(False),
468  isIgnored = cms.bool(False) ),
469  cms.PSet( cutName = cms.string("GsfEleSCEtaMultiRangeCut"),
470  useAbsEta = cms.bool(True),
471  allowedEtaRanges = cms.VPSet(
472  cms.PSet( minEta = cms.double(0.0),
473  maxEta = cms.double(ebCutOff) ),
474  cms.PSet( minEta = cms.double(ebCutOff),
475  maxEta = cms.double(2.5) )
476  ),
477  needsAdditionalProducts = cms.bool(False),
478  isIgnored = cms.bool(False)),
479  cms.PSet( cutName = cms.string('GsfEleDEtaInCut'),
480  dEtaInCutValueEB = cms.double( wpEB.dEtaInCut ),
481  dEtaInCutValueEE = cms.double( wpEE.dEtaInCut ),
482  barrelCutOff = cms.double(ebCutOff),
483  needsAdditionalProducts = cms.bool(False),
484  isIgnored = cms.bool(False)),
485  cms.PSet( cutName = cms.string('GsfEleDPhiInCut'),
486  dPhiInCutValueEB = cms.double( wpEB.dPhiInCut ),
487  dPhiInCutValueEE = cms.double( wpEE.dPhiInCut ),
488  barrelCutOff = cms.double(ebCutOff),
489  needsAdditionalProducts = cms.bool(False),
490  isIgnored = cms.bool(False)),
491  cms.PSet( cutName = cms.string('GsfEleFull5x5SigmaIEtaIEtaCut'),
492  full5x5SigmaIEtaIEtaCutValueEB = cms.double( wpEB.full5x5_sigmaIEtaIEtaCut ),
493  full5x5SigmaIEtaIEtaCutValueEE = cms.double( wpEE.full5x5_sigmaIEtaIEtaCut ),
494  barrelCutOff = cms.double(ebCutOff),
495  needsAdditionalProducts = cms.bool(False),
496  isIgnored = cms.bool(False)),
497  cms.PSet( cutName = cms.string('GsfEleHadronicOverEMCut'),
498  hadronicOverEMCutValueEB = cms.double( wpEB.hOverECut ),
499  hadronicOverEMCutValueEE = cms.double( wpEE.hOverECut ),
500  barrelCutOff = cms.double(ebCutOff),
501  needsAdditionalProducts = cms.bool(False),
502  isIgnored = cms.bool(False)),
503  cms.PSet( cutName = cms.string('GsfEleDxyCut'),
504  dxyCutValueEB = cms.double( wpEB.dxyCut ),
505  dxyCutValueEE = cms.double( wpEE.dxyCut ),
506  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
507  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
508  barrelCutOff = cms.double(ebCutOff),
509  needsAdditionalProducts = cms.bool(True),
510  isIgnored = cms.bool(False)),
511  cms.PSet( cutName = cms.string('GsfEleDzCut'),
512  dzCutValueEB = cms.double( wpEB.dzCut ),
513  dzCutValueEE = cms.double( wpEE.dzCut ),
514  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
515  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
516  barrelCutOff = cms.double(ebCutOff),
517  needsAdditionalProducts = cms.bool(True),
518  isIgnored = cms.bool(False)),
519  cms.PSet( cutName = cms.string('GsfEleEInverseMinusPInverseCut'),
520  eInverseMinusPInverseCutValueEB = cms.double( wpEB.absEInverseMinusPInverseCut ),
521  eInverseMinusPInverseCutValueEE = cms.double( wpEE.absEInverseMinusPInverseCut ),
522  barrelCutOff = cms.double(ebCutOff),
523  needsAdditionalProducts = cms.bool(False),
524  isIgnored = cms.bool(False)),
525  cms.PSet( cutName = cms.string('GsfEleDeltaBetaIsoCutStandalone'),
526  isoCutEBLowPt = cms.double( wpEB.relCombIsolationWithDBetaLowPtCut ),
527  isoCutEBHighPt = cms.double( wpEB.relCombIsolationWithDBetaHighPtCut ),
528  isoCutEELowPt = cms.double( wpEE.relCombIsolationWithDBetaLowPtCut ),
529  isoCutEEHighPt = cms.double( wpEE.relCombIsolationWithDBetaHighPtCut ),
530  isRelativeIso = cms.bool(True),
531  deltaBetaConstant = cms.double(0.5),
532  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
533  barrelCutOff = cms.double(ebCutOff),
534  needsAdditionalProducts = cms.bool(False),
535  isIgnored = cms.bool(False)),
536  cms.PSet( cutName = cms.string('GsfEleConversionVetoCut'),
537  conversionSrc = cms.InputTag('allConversions'),
538  conversionSrcMiniAOD = cms.InputTag('reducedEgamma:reducedConversions'),
539  beamspotSrc = cms.InputTag('offlineBeamSpot'),
540  needsAdditionalProducts = cms.bool(True),
541  isIgnored = cms.bool(False)),
542  cms.PSet( cutName = cms.string('GsfEleMissingHitsCut'),
543  maxMissingHitsEB = cms.uint32( wpEB.missingHitsCut ),
544  maxMissingHitsEE = cms.uint32( wpEE.missingHitsCut ),
545  barrelCutOff = cms.double(ebCutOff),
546  needsAdditionalProducts = cms.bool(False),
547  isIgnored = cms.bool(False) ),
548  )
549  )
550  #
551  return parameterSet
552 
553 # -----------------------------
554 # Version V2 common definitions
555 # -----------------------------
556 
557 # This cut set definition is in the old style, with everything configured
558 # in one go. It is kept to minimize changes. New definitions should use
559 # PSets defined above instead.
560 def configureVIDCutBasedEleID_V2( wpEB, wpEE, isoInputs ):
561  """
562  This function configures the full cms.PSet for a VID ID and returns it.
563  The inputs: two objects of the type WorkingPoint_V2, one
564  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
565  The third argument is an object that contains information necessary
566  for isolation calculations.
567  """
568  # print "VID: Configuring cut set %s" % wpEB.idName
569  parameterSet = cms.PSet(
570  #
571  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
572  cutFlow = cms.VPSet(
573  cms.PSet( cutName = cms.string("MinPtCut"),
574  minPt = cms.double(5.0),
575  needsAdditionalProducts = cms.bool(False),
576  isIgnored = cms.bool(False) ),
577  cms.PSet( cutName = cms.string("GsfEleSCEtaMultiRangeCut"),
578  useAbsEta = cms.bool(True),
579  allowedEtaRanges = cms.VPSet(
580  cms.PSet( minEta = cms.double(0.0),
581  maxEta = cms.double(ebCutOff) ),
582  cms.PSet( minEta = cms.double(ebCutOff),
583  maxEta = cms.double(2.5) )
584  ),
585  needsAdditionalProducts = cms.bool(False),
586  isIgnored = cms.bool(False)),
587  cms.PSet( cutName = cms.string('GsfEleDEtaInCut'),
588  dEtaInCutValueEB = cms.double( wpEB.dEtaInCut ),
589  dEtaInCutValueEE = cms.double( wpEE.dEtaInCut ),
590  barrelCutOff = cms.double(ebCutOff),
591  needsAdditionalProducts = cms.bool(False),
592  isIgnored = cms.bool(False)),
593  cms.PSet( cutName = cms.string('GsfEleDPhiInCut'),
594  dPhiInCutValueEB = cms.double( wpEB.dPhiInCut ),
595  dPhiInCutValueEE = cms.double( wpEE.dPhiInCut ),
596  barrelCutOff = cms.double(ebCutOff),
597  needsAdditionalProducts = cms.bool(False),
598  isIgnored = cms.bool(False)),
599  cms.PSet( cutName = cms.string('GsfEleFull5x5SigmaIEtaIEtaCut'),
600  full5x5SigmaIEtaIEtaCutValueEB = cms.double( wpEB.full5x5_sigmaIEtaIEtaCut ),
601  full5x5SigmaIEtaIEtaCutValueEE = cms.double( wpEE.full5x5_sigmaIEtaIEtaCut ),
602  barrelCutOff = cms.double(ebCutOff),
603  needsAdditionalProducts = cms.bool(False),
604  isIgnored = cms.bool(False)),
605  cms.PSet( cutName = cms.string('GsfEleHadronicOverEMCut'),
606  hadronicOverEMCutValueEB = cms.double( wpEB.hOverECut ),
607  hadronicOverEMCutValueEE = cms.double( wpEE.hOverECut ),
608  barrelCutOff = cms.double(ebCutOff),
609  needsAdditionalProducts = cms.bool(False),
610  isIgnored = cms.bool(False)),
611  cms.PSet( cutName = cms.string('GsfEleDxyCut'),
612  dxyCutValueEB = cms.double( wpEB.dxyCut ),
613  dxyCutValueEE = cms.double( wpEE.dxyCut ),
614  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
615  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
616  barrelCutOff = cms.double(ebCutOff),
617  needsAdditionalProducts = cms.bool(True),
618  isIgnored = cms.bool(False)),
619  cms.PSet( cutName = cms.string('GsfEleDzCut'),
620  dzCutValueEB = cms.double( wpEB.dzCut ),
621  dzCutValueEE = cms.double( wpEE.dzCut ),
622  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
623  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
624  barrelCutOff = cms.double(ebCutOff),
625  needsAdditionalProducts = cms.bool(True),
626  isIgnored = cms.bool(False)),
627  cms.PSet( cutName = cms.string('GsfEleEInverseMinusPInverseCut'),
628  eInverseMinusPInverseCutValueEB = cms.double( wpEB.absEInverseMinusPInverseCut ),
629  eInverseMinusPInverseCutValueEE = cms.double( wpEE.absEInverseMinusPInverseCut ),
630  barrelCutOff = cms.double(ebCutOff),
631  needsAdditionalProducts = cms.bool(False),
632  isIgnored = cms.bool(False)),
633  cms.PSet( cutName = cms.string('GsfEleEffAreaPFIsoCut'),
634  isoCutEBLowPt = cms.double( wpEB.relCombIsolationWithEALowPtCut ),
635  isoCutEBHighPt = cms.double( wpEB.relCombIsolationWithEAHighPtCut ),
636  isoCutEELowPt = cms.double( wpEE.relCombIsolationWithEALowPtCut ),
637  isoCutEEHighPt = cms.double( wpEE.relCombIsolationWithEAHighPtCut ),
638  isRelativeIso = cms.bool(True),
639  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
640  barrelCutOff = cms.double(ebCutOff),
641  rho = cms.InputTag("fixedGridRhoFastjetAll"),
642  effAreasConfigFile = cms.FileInPath( isoInputs.isoEffAreas ),
643  needsAdditionalProducts = cms.bool(True),
644  isIgnored = cms.bool(False) ),
645  cms.PSet( cutName = cms.string('GsfEleConversionVetoCut'),
646  conversionSrc = cms.InputTag('allConversions'),
647  conversionSrcMiniAOD = cms.InputTag('reducedEgamma:reducedConversions'),
648  beamspotSrc = cms.InputTag('offlineBeamSpot'),
649  needsAdditionalProducts = cms.bool(True),
650  isIgnored = cms.bool(False)),
651  cms.PSet( cutName = cms.string('GsfEleMissingHitsCut'),
652  maxMissingHitsEB = cms.uint32( wpEB.missingHitsCut ),
653  maxMissingHitsEE = cms.uint32( wpEE.missingHitsCut ),
654  barrelCutOff = cms.double(ebCutOff),
655  needsAdditionalProducts = cms.bool(False),
656  isIgnored = cms.bool(False) ),
657  )
658  )
659  #
660  return parameterSet
661 
662 
663 # ==============================================================
664 # Define the complete cut sets
665 # ==============================================================
666 
667 def configureVIDCutBasedEleID_V3( wpEB, wpEE, isoInputs ):
668  """
669  This function configures the full cms.PSet for a VID ID and returns it.
670  The inputs: two objects of the type WorkingPoint_V3, one
671  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
672  The third argument is an object that contains information necessary
673  for isolation calculations.
674  In this version, the impact parameter cuts dxy and dz are not present
675  """
676  # print "VID: Configuring cut set %s" % wpEB.idName
677  parameterSet = cms.PSet(
678  #
679  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
680  cutFlow = cms.VPSet(
681  psetMinPtCut(),
682  psetPhoSCEtaMultiRangeCut(), # eta cut
683  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
684  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
685  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
686  psetHadronicOverEMCut(wpEB, wpEE), # H/E cut
687  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
688  psetEffAreaPFIsoCut(wpEB, wpEE, isoInputs), # rel. comb. PF isolation cut
690  psetMissingHitsCut(wpEB, wpEE)
691  )
692  )
693  #
694  return parameterSet
695 
696 def configureVIDCutBasedEleID_V4( wpEB, wpEE, isoInputs ):
697  """
698  This function configures the full cms.PSet for a VID ID and returns it.
699  The inputs: two objects of the type WorkingPoint_V3, one
700  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
701  The third argument is an object that contains information necessary
702  for isolation calculations.
703  In this version, the energy and pileup dependent hOverE is introduced
704  """
705  # print "VID: Configuring cut set %s" % wpEB.idName
706  parameterSet = cms.PSet(
707  #
708  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
709  cutFlow = cms.VPSet(
710  psetMinPtCut(),
711  psetPhoSCEtaMultiRangeCut(), # eta cut
712  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
713  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
714  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
715  psetHadronicOverEMEnergyScaledCut(wpEB, wpEE), # H/E cut
716  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
717  psetEffAreaPFIsoCut(wpEB, wpEE, isoInputs), # rel. comb. PF isolation cut
719  psetMissingHitsCut(wpEB, wpEE)
720  )
721  )
722  #
723  return parameterSet
724 
725 def configureVIDCutBasedEleID_V5( wpEB, wpEE, isoInputs ):
726  """
727  This function configures the full cms.PSet for a VID ID and returns it.
728  The inputs: two objects of the type WorkingPoint_V3, one
729  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
730  The third argument is an object that contains information necessary
731  for isolation calculations.
732  In this version, the pt dependent isolation is introduced
733  """
734  # print "VID: Configuring cut set %s" % wpEB.idName
735  parameterSet = cms.PSet(
736  #
737  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
738  cutFlow = cms.VPSet(
739  psetMinPtCut(),
740  psetPhoSCEtaMultiRangeCut(), # eta cut
741  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
742  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
743  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
744  psetHadronicOverEMEnergyScaledCut(wpEB, wpEE), # H/E cut
745  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
746  psetRelPFIsoScaledCut(wpEB, wpEE, isoInputs), # rel. comb. PF isolation cut
748  psetMissingHitsCut(wpEB, wpEE)
749  )
750  )
751  #
752  return parameterSet
753 
754 
755 # -----------------------------
756 # HLT-safe common definitions
757 # -----------------------------
758 
759 
760 def configureVIDCutBasedEleHLTPreselection_V1( wpEB, wpEE, ecalIsoInputs, hcalIsoInputs ):
761  """
762  This function configures the full cms.PSet for a VID ID and returns it.
763  The inputs: two objects of the type EleHLTSelection_V1, one
764  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
765  The third and fourth arguments are objects that contain information necessary
766  for isolation calculations for ECAL and HCAL.
767  """
768  # print "VID: Configuring cut set %s" % wpEB.idName
769  parameterSet = cms.PSet(
770  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
771  cutFlow = cms.VPSet(
772  psetMinPtCut(), # min pt cut
773  psetPhoSCEtaMultiRangeCut(), # eta cut
774  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
775  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
776  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
777  psetHadronicOverEMCut(wpEB, wpEE), # H/E cut
778  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
779  psetEcalPFClusterIsoCut(wpEB, wpEE, ecalIsoInputs), # ECAL PF Cluster isolation
780  psetHcalPFClusterIsoCut(wpEB, wpEE, hcalIsoInputs), # HCAL PF Cluster isolation
781  psetTrkPtIsoCut(wpEB, wpEE), # tracker isolation cut
782  psetNormalizedGsfChi2Cut(wpEB, wpEE) # GsfTrack chi2/NDOF cut
783  )
784  )
785  #
786  return parameterSet
787 
def psetEcalPFClusterIsoCut(wpEB, wpEE, ecalIsoInputs)
def __init__(self, idName, dEtaInCut, dPhiInCut, full5x5_sigmaIEtaIEtaCut, hOverECut, dxyCut, dzCut, absEInverseMinusPInverseCut, relCombIsolationWithDBetaLowPtCut, relCombIsolationWithDBetaHighPtCut, missingHitsCut)
def __init__(self, idName, full5x5_sigmaIEtaIEtaCut, dEtaInSeedCut, dPhiInCut, hOverECut, absEInverseMinusPInverseCut, ecalPFClusterIsoLowPtCut, ecalPFClusterIsoHighPtCut, hcalPFClusterIsoLowPtCut, hcalPFClusterIsoHighPtCut, trkIsoSlopeTerm, trkIsoSlopeStart, trkIsoConstTerm, normalizedGsfChi2Cut)
def psetHadronicOverEMEnergyScaledCut(wpEB, wpEE)
def psetRelPFIsoScaledCut(wpEB, wpEE, isoInputs)
def configureVIDCutBasedEleID_V4(wpEB, wpEE, isoInputs)
def psetHcalPFClusterIsoCut(wpEB, wpEE, hcalIsoInputs)
def __init__(self, idName, dEtaInSeedCut, dPhiInCut, full5x5_sigmaIEtaIEtaCut, hOverECut, absEInverseMinusPInverseCut, relCombIsolationWithEALowPtCut, relCombIsolationWithEAHighPtCut, missingHitsCut)
def __init__(self, idName, dEtaInCut, dPhiInCut, full5x5_sigmaIEtaIEtaCut, hOverECut, dxyCut, dzCut, absEInverseMinusPInverseCut, relCombIsolationWithEALowPtCut, relCombIsolationWithEAHighPtCut, missingHitsCut)
def __init__(self, idName, dEtaInSeedCut, dPhiInCut, full5x5_sigmaIEtaIEtaCut, hOverECut_C0, hOverECut_CE, hOverECut_Cr, absEInverseMinusPInverseCut, relCombIsolationWithEACut_C0, relCombIsolationWithEACut_Cpt, missingHitsCut)
def configureVIDCutBasedEleID_V3(wpEB, wpEE, isoInputs)
def configureVIDCutBasedEleID_V5(wpEB, wpEE, isoInputs)
def __init__(self, idName, dEtaInSeedCut, dPhiInCut, full5x5_sigmaIEtaIEtaCut, hOverECut_C0, hOverECut_CE, hOverECut_Cr, absEInverseMinusPInverseCut, relCombIsolationWithEALowPtCut, relCombIsolationWithEAHighPtCut, missingHitsCut)
def configureVIDCutBasedEleHLTPreselection_V1(wpEB, wpEE, ecalIsoInputs, hcalIsoInputs)
def configureVIDCutBasedEleID_V1(wpEB, wpEE)
def psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE)
def psetEffAreaPFIsoCut(wpEB, wpEE, isoInputs)
def configureVIDCutBasedEleID_V2(wpEB, wpEE, isoInputs)