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 dependend 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 HLT-safe preselection
154  """
155  def __init__(self,
156  idName,
157  full5x5_sigmaIEtaIEtaCut,
158  dEtaInSeedCut,
159  dPhiInCut,
160  hOverECut,
161  absEInverseMinusPInverseCut,
162  # isolations
163  ecalPFClusterIsoLowPtCut,
164  ecalPFClusterIsoHighPtCut,
165  hcalPFClusterIsoLowPtCut,
166  hcalPFClusterIsoHighPtCut,
167  trkIsoSlopeTerm,
168  trkIsoSlopeStart,
169  trkIsoConstTerm,
170  #
171  normalizedGsfChi2Cut
172  ):
173  self.idName = idName
174  self.full5x5_sigmaIEtaIEtaCut = full5x5_sigmaIEtaIEtaCut
175  self.dEtaInSeedCut = dEtaInSeedCut
176  self.dPhiInCut = dPhiInCut
177  self.hOverECut = hOverECut
178  self.absEInverseMinusPInverseCut = absEInverseMinusPInverseCut
179  self.ecalPFClusterIsoLowPtCut = ecalPFClusterIsoLowPtCut
180  self.ecalPFClusterIsoHighPtCut = ecalPFClusterIsoHighPtCut
181  self.hcalPFClusterIsoLowPtCut = hcalPFClusterIsoLowPtCut
182  self.hcalPFClusterIsoHighPtCut = hcalPFClusterIsoHighPtCut
183  self.trkIsoSlopeTerm = trkIsoSlopeTerm
184  self.trkIsoSlopeStart = trkIsoSlopeStart
185  self.trkIsoConstTerm = trkIsoConstTerm
186  #
187  self.normalizedGsfChi2Cut = normalizedGsfChi2Cut
188 
189 
190 # ==============================================================
191 # Define individual cut configurations used by complete cut sets
192 # ==============================================================
193 
194 
195 # The mininum pt cut is set to 5 GeV
197  return cms.PSet(
198  cutName = cms.string("MinPtCut"),
199  minPt = cms.double(5.0),
200  needsAdditionalProducts = cms.bool(False),
201  isIgnored = cms.bool(False)
202  )
203 
204 # Take all particles in the eta ranges 0-ebCutOff and ebCutOff-2.5
206  return cms.PSet(
207  cutName = cms.string("GsfEleSCEtaMultiRangeCut"),
208  useAbsEta = cms.bool(True),
209  allowedEtaRanges = cms.VPSet(
210  cms.PSet( minEta = cms.double(0.0),
211  maxEta = cms.double(ebCutOff) ),
212  cms.PSet( minEta = cms.double(ebCutOff),
213  maxEta = cms.double(2.5) )
214  ),
215  needsAdditionalProducts = cms.bool(False),
216  isIgnored = cms.bool(False)
217  )
218 
219 # Configure the cut on full5x5 sigmaIEtaIEta
221  return cms.PSet(
222  cutName = cms.string('GsfEleFull5x5SigmaIEtaIEtaCut'),
223  full5x5SigmaIEtaIEtaCutValueEB = cms.double( wpEB.full5x5_sigmaIEtaIEtaCut ),
224  full5x5SigmaIEtaIEtaCutValueEE = cms.double( wpEE.full5x5_sigmaIEtaIEtaCut ),
225  barrelCutOff = cms.double(ebCutOff),
226  needsAdditionalProducts = cms.bool(False),
227  isIgnored = cms.bool(False)
228  )
229 
230 # Configure the cut on dEta seed
231 def psetDEtaInSeedCut(wpEB, wpEE):
232  return cms.PSet(
233  cutName = cms.string('GsfEleDEtaInSeedCut'),
234  dEtaInSeedCutValueEB = cms.double( wpEB.dEtaInSeedCut ),
235  dEtaInSeedCutValueEE = cms.double( wpEE.dEtaInSeedCut ),
236  barrelCutOff = cms.double(ebCutOff),
237  needsAdditionalProducts = cms.bool(False),
238  isIgnored = cms.bool(False)
239  )
240 
241 # Configure dPhiIn cut
242 def psetDPhiInCut(wpEB, wpEE):
243  return cms.PSet(
244  cutName = cms.string('GsfEleDPhiInCut'),
245  dPhiInCutValueEB = cms.double( wpEB.dPhiInCut ),
246  dPhiInCutValueEE = cms.double( wpEE.dPhiInCut ),
247  barrelCutOff = cms.double(ebCutOff),
248  needsAdditionalProducts = cms.bool(False),
249  isIgnored = cms.bool(False)
250  )
251 
252 # Configure H/E cut
253 def psetHadronicOverEMCut(wpEB, wpEE):
254  return cms.PSet(
255  cutName = cms.string('GsfEleHadronicOverEMCut'),
256  hadronicOverEMCutValueEB = cms.double( wpEB.hOverECut ),
257  hadronicOverEMCutValueEE = cms.double( wpEE.hOverECut ),
258  barrelCutOff = cms.double(ebCutOff),
259  needsAdditionalProducts = cms.bool(False),
260  isIgnored = cms.bool(False)
261  )
262 
263 # Configure energy and pileup dependend H/E cut
265  return cms.PSet(
266  cutName = cms.string('GsfEleHadronicOverEMEnergyScaledCut'),
267  barrelC0 = cms.double( wpEB.hOverECut_C0 ),
268  barrelCE = cms.double( wpEB.hOverECut_CE ),
269  barrelCr = cms.double( wpEB.hOverECut_Cr ),
270  endcapC0 = cms.double( wpEE.hOverECut_C0 ),
271  endcapCE = cms.double( wpEE.hOverECut_CE ),
272  endcapCr = cms.double( wpEE.hOverECut_Cr ),
273  rho = cms.InputTag("fixedGridRhoFastjetAll"),
274  barrelCutOff = cms.double(ebCutOff),
275  needsAdditionalProducts = cms.bool(True),
276  isIgnored = cms.bool(False)
277  )
278 
279 
280 # Configure |1/E-1/p| cut
282  return cms.PSet(
283  cutName = cms.string('GsfEleEInverseMinusPInverseCut'),
284  eInverseMinusPInverseCutValueEB = cms.double( wpEB.absEInverseMinusPInverseCut ),
285  eInverseMinusPInverseCutValueEE = cms.double( wpEE.absEInverseMinusPInverseCut ),
286  barrelCutOff = cms.double(ebCutOff),
287  needsAdditionalProducts = cms.bool(False),
288  isIgnored = cms.bool(False)
289  )
290 
291 # Configure ECAL PF Cluster isolation cut. Note that this cut requires
292 # effective area constants file as input
293 def psetEcalPFClusterIsoCut(wpEB, wpEE, ecalIsoInputs):
294  return cms.PSet(
295  cutName = cms.string('GsfEleCalPFClusterIsoCut'),
296  isoType = cms.int32( 0 ), # ECAL = 0, HCAL = 1, see cut class header for IsoType enum
297  isoCutEBLowPt = cms.double( wpEB.ecalPFClusterIsoLowPtCut ),
298  isoCutEBHighPt = cms.double( wpEB.ecalPFClusterIsoHighPtCut ),
299  isoCutEELowPt = cms.double( wpEE.ecalPFClusterIsoLowPtCut ),
300  isoCutEEHighPt = cms.double( wpEE.ecalPFClusterIsoHighPtCut ),
301  isRelativeIso = cms.bool(True),
302  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
303  barrelCutOff = cms.double(ebCutOff),
304  rho = cms.InputTag("fixedGridRhoFastjetCentralCalo"), # This rho is best for emulation
305  # while HLT uses ...AllCalo
306  effAreasConfigFile = cms.FileInPath( ecalIsoInputs.isoEffAreas ),
307  needsAdditionalProducts = cms.bool(True),
308  isIgnored = cms.bool(False)
309  )
310 
311 # Configure HCAL PF Cluster isolation cut. Note that this cut requires
312 # effective area constants file as input
313 def psetHcalPFClusterIsoCut(wpEB, wpEE, hcalIsoInputs):
314  return cms.PSet(
315  cutName = cms.string('GsfEleCalPFClusterIsoCut'),
316  isoType = cms.int32( 1 ), # ECAL = 0, HCAL = 1, see cut class header for IsoType enum
317  isoCutEBLowPt = cms.double( wpEB.hcalPFClusterIsoLowPtCut ),
318  isoCutEBHighPt = cms.double( wpEB.hcalPFClusterIsoHighPtCut ),
319  isoCutEELowPt = cms.double( wpEE.hcalPFClusterIsoLowPtCut ),
320  isoCutEEHighPt = cms.double( wpEE.hcalPFClusterIsoHighPtCut ),
321  isRelativeIso = cms.bool(True),
322  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
323  barrelCutOff = cms.double(ebCutOff),
324  rho = cms.InputTag("fixedGridRhoFastjetCentralCalo"), # This rho is best for emulation
325  # while HLT uses ...AllCalo
326  effAreasConfigFile = cms.FileInPath( hcalIsoInputs.isoEffAreas ),
327  needsAdditionalProducts = cms.bool(True),
328  isIgnored = cms.bool(False)
329  )
330 
331 # Configure tracker isolation cut
332 def psetTrkPtIsoCut(wpEB, wpEE):
333  return cms.PSet(
334  cutName = cms.string('GsfEleTrkPtIsoCut'),
335  # Three constants for the GsfEleTrkPtIsoCut
336  # cut = constTerm if Et < slopeStart
337  # cut = slopeTerm * (Et - slopeStart) + constTerm if Et >= slopeStart
338  slopeTermEB = cms.double( wpEB.trkIsoSlopeTerm ),
339  slopeTermEE = cms.double( wpEE.trkIsoSlopeTerm ),
340  slopeStartEB = cms.double( wpEB.trkIsoSlopeStart ),
341  slopeStartEE = cms.double( wpEE.trkIsoSlopeStart ),
342  constTermEB = cms.double( wpEB.trkIsoConstTerm ),
343  constTermEE = cms.double( wpEE.trkIsoConstTerm ),
344  needsAdditionalProducts = cms.bool(False),
345  isIgnored = cms.bool(False)
346  )
347 
348 # Configure GsfTrack chi2/NDOF cut
349 def psetNormalizedGsfChi2Cut(wpEB, wpEE):
350  return cms.PSet(
351  cutName = cms.string('GsfEleNormalizedGsfChi2Cut'),
352  normalizedGsfChi2CutValueEB = cms.double( wpEB.normalizedGsfChi2Cut ),
353  normalizedGsfChi2CutValueEE = cms.double( wpEE.normalizedGsfChi2Cut ),
354  barrelCutOff = cms.double(ebCutOff),
355  needsAdditionalProducts = cms.bool(False),
356  isIgnored = cms.bool(False)
357  )
358 
359 def psetEffAreaPFIsoCut(wpEB, wpEE, isoInputs):
360  return cms.PSet(
361  cutName = cms.string('GsfEleEffAreaPFIsoCut'),
362  isoCutEBLowPt = cms.double( wpEB.relCombIsolationWithEALowPtCut ),
363  isoCutEBHighPt = cms.double( wpEB.relCombIsolationWithEAHighPtCut ),
364  isoCutEELowPt = cms.double( wpEE.relCombIsolationWithEALowPtCut ),
365  isoCutEEHighPt = cms.double( wpEE.relCombIsolationWithEAHighPtCut ),
366  isRelativeIso = cms.bool(True),
367  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
368  barrelCutOff = cms.double(ebCutOff),
369  rho = cms.InputTag("fixedGridRhoFastjetAll"),
370  effAreasConfigFile = cms.FileInPath( isoInputs.isoEffAreas ),
371  needsAdditionalProducts = cms.bool(True),
372  isIgnored = cms.bool(False)
373  )
374 
376  return cms.PSet(
377  cutName = cms.string('GsfEleConversionVetoCut'),
378  conversionSrc = cms.InputTag('allConversions'),
379  conversionSrcMiniAOD = cms.InputTag('reducedEgamma:reducedConversions'),
380  beamspotSrc = cms.InputTag('offlineBeamSpot'),
381  needsAdditionalProducts = cms.bool(True),
382  isIgnored = cms.bool(False)
383  )
384 
385 def psetMissingHitsCut(wpEB, wpEE):
386  return cms.PSet(
387  cutName = cms.string('GsfEleMissingHitsCut'),
388  maxMissingHitsEB = cms.uint32( wpEB.missingHitsCut ),
389  maxMissingHitsEE = cms.uint32( wpEE.missingHitsCut ),
390  barrelCutOff = cms.double(ebCutOff),
391  needsAdditionalProducts = cms.bool(False),
392  isIgnored = cms.bool(False)
393  )
394 
395 
396 # -----------------------------
397 # Version V1 common definitions
398 # -----------------------------
399 
400 # This cut set definition is in the old style, with everything configured
401 # in one go. It is kept to minimize changes. New definitions should use
402 # PSets defined above instead.
404  """
405  This function configures the full cms.PSet for a VID ID and returns it.
406  The inputs: two objects of the type WorkingPoint_V1, one
407  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
408  """
409  # print "VID: Configuring cut set %s" % wpEB.idName
410  parameterSet = cms.PSet(
411  #
412  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
413  cutFlow = cms.VPSet(
414  cms.PSet( cutName = cms.string("MinPtCut"),
415  minPt = cms.double(5.0),
416  needsAdditionalProducts = cms.bool(False),
417  isIgnored = cms.bool(False) ),
418  cms.PSet( cutName = cms.string("GsfEleSCEtaMultiRangeCut"),
419  useAbsEta = cms.bool(True),
420  allowedEtaRanges = cms.VPSet(
421  cms.PSet( minEta = cms.double(0.0),
422  maxEta = cms.double(ebCutOff) ),
423  cms.PSet( minEta = cms.double(ebCutOff),
424  maxEta = cms.double(2.5) )
425  ),
426  needsAdditionalProducts = cms.bool(False),
427  isIgnored = cms.bool(False)),
428  cms.PSet( cutName = cms.string('GsfEleDEtaInCut'),
429  dEtaInCutValueEB = cms.double( wpEB.dEtaInCut ),
430  dEtaInCutValueEE = cms.double( wpEE.dEtaInCut ),
431  barrelCutOff = cms.double(ebCutOff),
432  needsAdditionalProducts = cms.bool(False),
433  isIgnored = cms.bool(False)),
434  cms.PSet( cutName = cms.string('GsfEleDPhiInCut'),
435  dPhiInCutValueEB = cms.double( wpEB.dPhiInCut ),
436  dPhiInCutValueEE = cms.double( wpEE.dPhiInCut ),
437  barrelCutOff = cms.double(ebCutOff),
438  needsAdditionalProducts = cms.bool(False),
439  isIgnored = cms.bool(False)),
440  cms.PSet( cutName = cms.string('GsfEleFull5x5SigmaIEtaIEtaCut'),
441  full5x5SigmaIEtaIEtaCutValueEB = cms.double( wpEB.full5x5_sigmaIEtaIEtaCut ),
442  full5x5SigmaIEtaIEtaCutValueEE = cms.double( wpEE.full5x5_sigmaIEtaIEtaCut ),
443  barrelCutOff = cms.double(ebCutOff),
444  needsAdditionalProducts = cms.bool(False),
445  isIgnored = cms.bool(False)),
446  cms.PSet( cutName = cms.string('GsfEleHadronicOverEMCut'),
447  hadronicOverEMCutValueEB = cms.double( wpEB.hOverECut ),
448  hadronicOverEMCutValueEE = cms.double( wpEE.hOverECut ),
449  barrelCutOff = cms.double(ebCutOff),
450  needsAdditionalProducts = cms.bool(False),
451  isIgnored = cms.bool(False)),
452  cms.PSet( cutName = cms.string('GsfEleDxyCut'),
453  dxyCutValueEB = cms.double( wpEB.dxyCut ),
454  dxyCutValueEE = cms.double( wpEE.dxyCut ),
455  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
456  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
457  barrelCutOff = cms.double(ebCutOff),
458  needsAdditionalProducts = cms.bool(True),
459  isIgnored = cms.bool(False)),
460  cms.PSet( cutName = cms.string('GsfEleDzCut'),
461  dzCutValueEB = cms.double( wpEB.dzCut ),
462  dzCutValueEE = cms.double( wpEE.dzCut ),
463  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
464  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
465  barrelCutOff = cms.double(ebCutOff),
466  needsAdditionalProducts = cms.bool(True),
467  isIgnored = cms.bool(False)),
468  cms.PSet( cutName = cms.string('GsfEleEInverseMinusPInverseCut'),
469  eInverseMinusPInverseCutValueEB = cms.double( wpEB.absEInverseMinusPInverseCut ),
470  eInverseMinusPInverseCutValueEE = cms.double( wpEE.absEInverseMinusPInverseCut ),
471  barrelCutOff = cms.double(ebCutOff),
472  needsAdditionalProducts = cms.bool(False),
473  isIgnored = cms.bool(False)),
474  cms.PSet( cutName = cms.string('GsfEleDeltaBetaIsoCutStandalone'),
475  isoCutEBLowPt = cms.double( wpEB.relCombIsolationWithDBetaLowPtCut ),
476  isoCutEBHighPt = cms.double( wpEB.relCombIsolationWithDBetaHighPtCut ),
477  isoCutEELowPt = cms.double( wpEE.relCombIsolationWithDBetaLowPtCut ),
478  isoCutEEHighPt = cms.double( wpEE.relCombIsolationWithDBetaHighPtCut ),
479  isRelativeIso = cms.bool(True),
480  deltaBetaConstant = cms.double(0.5),
481  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
482  barrelCutOff = cms.double(ebCutOff),
483  needsAdditionalProducts = cms.bool(False),
484  isIgnored = cms.bool(False)),
485  cms.PSet( cutName = cms.string('GsfEleConversionVetoCut'),
486  conversionSrc = cms.InputTag('allConversions'),
487  conversionSrcMiniAOD = cms.InputTag('reducedEgamma:reducedConversions'),
488  beamspotSrc = cms.InputTag('offlineBeamSpot'),
489  needsAdditionalProducts = cms.bool(True),
490  isIgnored = cms.bool(False)),
491  cms.PSet( cutName = cms.string('GsfEleMissingHitsCut'),
492  maxMissingHitsEB = cms.uint32( wpEB.missingHitsCut ),
493  maxMissingHitsEE = cms.uint32( wpEE.missingHitsCut ),
494  barrelCutOff = cms.double(ebCutOff),
495  needsAdditionalProducts = cms.bool(False),
496  isIgnored = cms.bool(False) ),
497  )
498  )
499  #
500  return parameterSet
501 
502 # -----------------------------
503 # Version V2 common definitions
504 # -----------------------------
505 
506 # This cut set definition is in the old style, with everything configured
507 # in one go. It is kept to minimize changes. New definitions should use
508 # PSets defined above instead.
509 def configureVIDCutBasedEleID_V2( wpEB, wpEE, isoInputs ):
510  """
511  This function configures the full cms.PSet for a VID ID and returns it.
512  The inputs: two objects of the type WorkingPoint_V2, one
513  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
514  The third argument is an object that contains information necessary
515  for isolation calculations.
516  """
517  # print "VID: Configuring cut set %s" % wpEB.idName
518  parameterSet = cms.PSet(
519  #
520  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
521  cutFlow = cms.VPSet(
522  cms.PSet( cutName = cms.string("MinPtCut"),
523  minPt = cms.double(5.0),
524  needsAdditionalProducts = cms.bool(False),
525  isIgnored = cms.bool(False) ),
526  cms.PSet( cutName = cms.string("GsfEleSCEtaMultiRangeCut"),
527  useAbsEta = cms.bool(True),
528  allowedEtaRanges = cms.VPSet(
529  cms.PSet( minEta = cms.double(0.0),
530  maxEta = cms.double(ebCutOff) ),
531  cms.PSet( minEta = cms.double(ebCutOff),
532  maxEta = cms.double(2.5) )
533  ),
534  needsAdditionalProducts = cms.bool(False),
535  isIgnored = cms.bool(False)),
536  cms.PSet( cutName = cms.string('GsfEleDEtaInCut'),
537  dEtaInCutValueEB = cms.double( wpEB.dEtaInCut ),
538  dEtaInCutValueEE = cms.double( wpEE.dEtaInCut ),
539  barrelCutOff = cms.double(ebCutOff),
540  needsAdditionalProducts = cms.bool(False),
541  isIgnored = cms.bool(False)),
542  cms.PSet( cutName = cms.string('GsfEleDPhiInCut'),
543  dPhiInCutValueEB = cms.double( wpEB.dPhiInCut ),
544  dPhiInCutValueEE = cms.double( wpEE.dPhiInCut ),
545  barrelCutOff = cms.double(ebCutOff),
546  needsAdditionalProducts = cms.bool(False),
547  isIgnored = cms.bool(False)),
548  cms.PSet( cutName = cms.string('GsfEleFull5x5SigmaIEtaIEtaCut'),
549  full5x5SigmaIEtaIEtaCutValueEB = cms.double( wpEB.full5x5_sigmaIEtaIEtaCut ),
550  full5x5SigmaIEtaIEtaCutValueEE = cms.double( wpEE.full5x5_sigmaIEtaIEtaCut ),
551  barrelCutOff = cms.double(ebCutOff),
552  needsAdditionalProducts = cms.bool(False),
553  isIgnored = cms.bool(False)),
554  cms.PSet( cutName = cms.string('GsfEleHadronicOverEMCut'),
555  hadronicOverEMCutValueEB = cms.double( wpEB.hOverECut ),
556  hadronicOverEMCutValueEE = cms.double( wpEE.hOverECut ),
557  barrelCutOff = cms.double(ebCutOff),
558  needsAdditionalProducts = cms.bool(False),
559  isIgnored = cms.bool(False)),
560  cms.PSet( cutName = cms.string('GsfEleDxyCut'),
561  dxyCutValueEB = cms.double( wpEB.dxyCut ),
562  dxyCutValueEE = cms.double( wpEE.dxyCut ),
563  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
564  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
565  barrelCutOff = cms.double(ebCutOff),
566  needsAdditionalProducts = cms.bool(True),
567  isIgnored = cms.bool(False)),
568  cms.PSet( cutName = cms.string('GsfEleDzCut'),
569  dzCutValueEB = cms.double( wpEB.dzCut ),
570  dzCutValueEE = cms.double( wpEE.dzCut ),
571  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
572  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
573  barrelCutOff = cms.double(ebCutOff),
574  needsAdditionalProducts = cms.bool(True),
575  isIgnored = cms.bool(False)),
576  cms.PSet( cutName = cms.string('GsfEleEInverseMinusPInverseCut'),
577  eInverseMinusPInverseCutValueEB = cms.double( wpEB.absEInverseMinusPInverseCut ),
578  eInverseMinusPInverseCutValueEE = cms.double( wpEE.absEInverseMinusPInverseCut ),
579  barrelCutOff = cms.double(ebCutOff),
580  needsAdditionalProducts = cms.bool(False),
581  isIgnored = cms.bool(False)),
582  cms.PSet( cutName = cms.string('GsfEleEffAreaPFIsoCut'),
583  isoCutEBLowPt = cms.double( wpEB.relCombIsolationWithEALowPtCut ),
584  isoCutEBHighPt = cms.double( wpEB.relCombIsolationWithEAHighPtCut ),
585  isoCutEELowPt = cms.double( wpEE.relCombIsolationWithEALowPtCut ),
586  isoCutEEHighPt = cms.double( wpEE.relCombIsolationWithEAHighPtCut ),
587  isRelativeIso = cms.bool(True),
588  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
589  barrelCutOff = cms.double(ebCutOff),
590  rho = cms.InputTag("fixedGridRhoFastjetAll"),
591  effAreasConfigFile = cms.FileInPath( isoInputs.isoEffAreas ),
592  needsAdditionalProducts = cms.bool(True),
593  isIgnored = cms.bool(False) ),
594  cms.PSet( cutName = cms.string('GsfEleConversionVetoCut'),
595  conversionSrc = cms.InputTag('allConversions'),
596  conversionSrcMiniAOD = cms.InputTag('reducedEgamma:reducedConversions'),
597  beamspotSrc = cms.InputTag('offlineBeamSpot'),
598  needsAdditionalProducts = cms.bool(True),
599  isIgnored = cms.bool(False)),
600  cms.PSet( cutName = cms.string('GsfEleMissingHitsCut'),
601  maxMissingHitsEB = cms.uint32( wpEB.missingHitsCut ),
602  maxMissingHitsEE = cms.uint32( wpEE.missingHitsCut ),
603  barrelCutOff = cms.double(ebCutOff),
604  needsAdditionalProducts = cms.bool(False),
605  isIgnored = cms.bool(False) ),
606  )
607  )
608  #
609  return parameterSet
610 
611 
612 # ==============================================================
613 # Define the complete cut sets
614 # ==============================================================
615 
616 def configureVIDCutBasedEleID_V3( wpEB, wpEE, isoInputs ):
617  """
618  This function configures the full cms.PSet for a VID ID and returns it.
619  The inputs: two objects of the type WorkingPoint_V3, one
620  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
621  The third argument is an object that contains information necessary
622  for isolation calculations.
623  In this version, the impact parameter cuts dxy and dz are not present
624  """
625  # print "VID: Configuring cut set %s" % wpEB.idName
626  parameterSet = cms.PSet(
627  #
628  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
629  cutFlow = cms.VPSet(
630  psetMinPtCut(),
631  psetPhoSCEtaMultiRangeCut(), # eta cut
632  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
633  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
634  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
635  psetHadronicOverEMCut(wpEB, wpEE), # H/E cut
636  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
637  psetEffAreaPFIsoCut(wpEB, wpEE, isoInputs), # rel. comb. PF isolation cut
639  psetMissingHitsCut(wpEB, wpEE)
640  )
641  )
642  #
643  return parameterSet
644 
645 def configureVIDCutBasedEleID_V4( wpEB, wpEE, isoInputs ):
646  """
647  This function configures the full cms.PSet for a VID ID and returns it.
648  The inputs: two objects of the type WorkingPoint_V3, one
649  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
650  The third argument is an object that contains information necessary
651  for isolation calculations.
652  In this version, the energy and pileup dependend hOverE is introduced
653  """
654  # print "VID: Configuring cut set %s" % wpEB.idName
655  parameterSet = cms.PSet(
656  #
657  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
658  cutFlow = cms.VPSet(
659  psetMinPtCut(),
660  psetPhoSCEtaMultiRangeCut(), # eta cut
661  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
662  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
663  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
664  psetHadronicOverEMEnergyScaledCut(wpEB, wpEE), # H/E cut
665  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
666  psetEffAreaPFIsoCut(wpEB, wpEE, isoInputs), # rel. comb. PF isolation cut
668  psetMissingHitsCut(wpEB, wpEE)
669  )
670  )
671  #
672  return parameterSet
673 
674 
675 # -----------------------------
676 # HLT-safe common definitions
677 # -----------------------------
678 
679 
680 def configureVIDCutBasedEleHLTPreselection_V1( wpEB, wpEE, ecalIsoInputs, hcalIsoInputs ):
681  """
682  This function configures the full cms.PSet for a VID ID and returns it.
683  The inputs: two objects of the type EleHLTSelection_V1, one
684  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
685  The third and fourth arguments are objects that contain information necessary
686  for isolation calculations for ECAL and HCAL.
687  """
688  # print "VID: Configuring cut set %s" % wpEB.idName
689  parameterSet = cms.PSet(
690  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
691  cutFlow = cms.VPSet(
692  psetMinPtCut(), # min pt cut
693  psetPhoSCEtaMultiRangeCut(), # eta cut
694  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
695  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
696  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
697  psetHadronicOverEMCut(wpEB, wpEE), # H/E cut
698  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
699  psetEcalPFClusterIsoCut(wpEB, wpEE, ecalIsoInputs), # ECAL PF Cluster isolation
700  psetHcalPFClusterIsoCut(wpEB, wpEE, hcalIsoInputs), # HCAL PF Cluster isolation
701  psetTrkPtIsoCut(wpEB, wpEE), # tracker isolation cut
702  psetNormalizedGsfChi2Cut(wpEB, wpEE) # GsfTrack chi2/NDOF cut
703  )
704  )
705  #
706  return parameterSet
707 
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 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 configureVIDCutBasedEleID_V3(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)