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  useHEEPIso = cms.bool(False),
381  needsAdditionalProducts = cms.bool(False),
382  isIgnored = cms.bool(False)
383  )
384 
385 # Configure GsfTrack chi2/NDOF cut
386 def psetNormalizedGsfChi2Cut(wpEB, wpEE):
387  return cms.PSet(
388  cutName = cms.string('GsfEleNormalizedGsfChi2Cut'),
389  normalizedGsfChi2CutValueEB = cms.double( wpEB.normalizedGsfChi2Cut ),
390  normalizedGsfChi2CutValueEE = cms.double( wpEE.normalizedGsfChi2Cut ),
391  barrelCutOff = cms.double(ebCutOff),
392  needsAdditionalProducts = cms.bool(False),
393  isIgnored = cms.bool(False)
394  )
395 
396 def psetEffAreaPFIsoCut(wpEB, wpEE, isoInputs):
397  return cms.PSet(
398  cutName = cms.string('GsfEleEffAreaPFIsoCut'),
399  isoCutEBLowPt = cms.double( wpEB.relCombIsolationWithEALowPtCut ),
400  isoCutEBHighPt = cms.double( wpEB.relCombIsolationWithEAHighPtCut ),
401  isoCutEELowPt = cms.double( wpEE.relCombIsolationWithEALowPtCut ),
402  isoCutEEHighPt = cms.double( wpEE.relCombIsolationWithEAHighPtCut ),
403  isRelativeIso = cms.bool(True),
404  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
405  barrelCutOff = cms.double(ebCutOff),
406  rho = cms.InputTag("fixedGridRhoFastjetAll"),
407  effAreasConfigFile = cms.FileInPath( isoInputs.isoEffAreas ),
408  needsAdditionalProducts = cms.bool(True),
409  isIgnored = cms.bool(False)
410  )
411 
412 def psetRelPFIsoScaledCut(wpEB, wpEE, isoInputs):
413  return cms.PSet(
414  cutName = cms.string('GsfEleRelPFIsoScaledCut'),
415  barrelC0 = cms.double(wpEB.relCombIsolationWithEACut_C0),
416  endcapC0 = cms.double(wpEE.relCombIsolationWithEACut_C0),
417  barrelCpt = cms.double(wpEB.relCombIsolationWithEACut_Cpt),
418  endcapCpt = cms.double(wpEE.relCombIsolationWithEACut_Cpt),
419  barrelCutOff = cms.double(ebCutOff),
420  rho = cms.InputTag("fixedGridRhoFastjetAll"),
421  effAreasConfigFile = cms.FileInPath( isoInputs.isoEffAreas ),
422  needsAdditionalProducts = cms.bool(True),
423  isIgnored = cms.bool(False)
424  )
425 
426 
428  return cms.PSet(
429  cutName = cms.string('GsfEleConversionVetoCut'),
430  conversionSrc = cms.InputTag('allConversions'),
431  conversionSrcMiniAOD = cms.InputTag('reducedEgamma:reducedConversions'),
432  beamspotSrc = cms.InputTag('offlineBeamSpot'),
433  needsAdditionalProducts = cms.bool(True),
434  isIgnored = cms.bool(False)
435  )
436 
437 def psetMissingHitsCut(wpEB, wpEE):
438  return cms.PSet(
439  cutName = cms.string('GsfEleMissingHitsCut'),
440  maxMissingHitsEB = cms.uint32( wpEB.missingHitsCut ),
441  maxMissingHitsEE = cms.uint32( wpEE.missingHitsCut ),
442  barrelCutOff = cms.double(ebCutOff),
443  needsAdditionalProducts = cms.bool(False),
444  isIgnored = cms.bool(False)
445  )
446 
447 
448 # -----------------------------
449 # Version V1 common definitions
450 # -----------------------------
451 
452 # This cut set definition is in the old style, with everything configured
453 # in one go. It is kept to minimize changes. New definitions should use
454 # PSets defined above instead.
456  """
457  This function configures the full cms.PSet for a VID ID and returns it.
458  The inputs: two objects of the type WorkingPoint_V1, one
459  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
460  """
461  # print "VID: Configuring cut set %s" % wpEB.idName
462  parameterSet = cms.PSet(
463  #
464  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
465  cutFlow = cms.VPSet(
466  cms.PSet( cutName = cms.string("MinPtCut"),
467  minPt = cms.double(5.0),
468  needsAdditionalProducts = cms.bool(False),
469  isIgnored = cms.bool(False) ),
470  cms.PSet( cutName = cms.string("GsfEleSCEtaMultiRangeCut"),
471  useAbsEta = cms.bool(True),
472  allowedEtaRanges = cms.VPSet(
473  cms.PSet( minEta = cms.double(0.0),
474  maxEta = cms.double(ebCutOff) ),
475  cms.PSet( minEta = cms.double(ebCutOff),
476  maxEta = cms.double(2.5) )
477  ),
478  needsAdditionalProducts = cms.bool(False),
479  isIgnored = cms.bool(False)),
480  cms.PSet( cutName = cms.string('GsfEleDEtaInCut'),
481  dEtaInCutValueEB = cms.double( wpEB.dEtaInCut ),
482  dEtaInCutValueEE = cms.double( wpEE.dEtaInCut ),
483  barrelCutOff = cms.double(ebCutOff),
484  needsAdditionalProducts = cms.bool(False),
485  isIgnored = cms.bool(False)),
486  cms.PSet( cutName = cms.string('GsfEleDPhiInCut'),
487  dPhiInCutValueEB = cms.double( wpEB.dPhiInCut ),
488  dPhiInCutValueEE = cms.double( wpEE.dPhiInCut ),
489  barrelCutOff = cms.double(ebCutOff),
490  needsAdditionalProducts = cms.bool(False),
491  isIgnored = cms.bool(False)),
492  cms.PSet( cutName = cms.string('GsfEleFull5x5SigmaIEtaIEtaCut'),
493  full5x5SigmaIEtaIEtaCutValueEB = cms.double( wpEB.full5x5_sigmaIEtaIEtaCut ),
494  full5x5SigmaIEtaIEtaCutValueEE = cms.double( wpEE.full5x5_sigmaIEtaIEtaCut ),
495  barrelCutOff = cms.double(ebCutOff),
496  needsAdditionalProducts = cms.bool(False),
497  isIgnored = cms.bool(False)),
498  cms.PSet( cutName = cms.string('GsfEleHadronicOverEMCut'),
499  hadronicOverEMCutValueEB = cms.double( wpEB.hOverECut ),
500  hadronicOverEMCutValueEE = cms.double( wpEE.hOverECut ),
501  barrelCutOff = cms.double(ebCutOff),
502  needsAdditionalProducts = cms.bool(False),
503  isIgnored = cms.bool(False)),
504  cms.PSet( cutName = cms.string('GsfEleDxyCut'),
505  dxyCutValueEB = cms.double( wpEB.dxyCut ),
506  dxyCutValueEE = cms.double( wpEE.dxyCut ),
507  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
508  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
509  barrelCutOff = cms.double(ebCutOff),
510  needsAdditionalProducts = cms.bool(True),
511  isIgnored = cms.bool(False)),
512  cms.PSet( cutName = cms.string('GsfEleDzCut'),
513  dzCutValueEB = cms.double( wpEB.dzCut ),
514  dzCutValueEE = cms.double( wpEE.dzCut ),
515  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
516  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
517  barrelCutOff = cms.double(ebCutOff),
518  needsAdditionalProducts = cms.bool(True),
519  isIgnored = cms.bool(False)),
520  cms.PSet( cutName = cms.string('GsfEleEInverseMinusPInverseCut'),
521  eInverseMinusPInverseCutValueEB = cms.double( wpEB.absEInverseMinusPInverseCut ),
522  eInverseMinusPInverseCutValueEE = cms.double( wpEE.absEInverseMinusPInverseCut ),
523  barrelCutOff = cms.double(ebCutOff),
524  needsAdditionalProducts = cms.bool(False),
525  isIgnored = cms.bool(False)),
526  cms.PSet( cutName = cms.string('GsfEleDeltaBetaIsoCutStandalone'),
527  isoCutEBLowPt = cms.double( wpEB.relCombIsolationWithDBetaLowPtCut ),
528  isoCutEBHighPt = cms.double( wpEB.relCombIsolationWithDBetaHighPtCut ),
529  isoCutEELowPt = cms.double( wpEE.relCombIsolationWithDBetaLowPtCut ),
530  isoCutEEHighPt = cms.double( wpEE.relCombIsolationWithDBetaHighPtCut ),
531  isRelativeIso = cms.bool(True),
532  deltaBetaConstant = cms.double(0.5),
533  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
534  barrelCutOff = cms.double(ebCutOff),
535  needsAdditionalProducts = cms.bool(False),
536  isIgnored = cms.bool(False)),
537  cms.PSet( cutName = cms.string('GsfEleConversionVetoCut'),
538  conversionSrc = cms.InputTag('allConversions'),
539  conversionSrcMiniAOD = cms.InputTag('reducedEgamma:reducedConversions'),
540  beamspotSrc = cms.InputTag('offlineBeamSpot'),
541  needsAdditionalProducts = cms.bool(True),
542  isIgnored = cms.bool(False)),
543  cms.PSet( cutName = cms.string('GsfEleMissingHitsCut'),
544  maxMissingHitsEB = cms.uint32( wpEB.missingHitsCut ),
545  maxMissingHitsEE = cms.uint32( wpEE.missingHitsCut ),
546  barrelCutOff = cms.double(ebCutOff),
547  needsAdditionalProducts = cms.bool(False),
548  isIgnored = cms.bool(False) ),
549  )
550  )
551  #
552  return parameterSet
553 
554 # -----------------------------
555 # Version V2 common definitions
556 # -----------------------------
557 
558 # This cut set definition is in the old style, with everything configured
559 # in one go. It is kept to minimize changes. New definitions should use
560 # PSets defined above instead.
561 def configureVIDCutBasedEleID_V2( wpEB, wpEE, isoInputs ):
562  """
563  This function configures the full cms.PSet for a VID ID and returns it.
564  The inputs: two objects of the type WorkingPoint_V2, one
565  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
566  The third argument is an object that contains information necessary
567  for isolation calculations.
568  """
569  # print "VID: Configuring cut set %s" % wpEB.idName
570  parameterSet = cms.PSet(
571  #
572  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
573  cutFlow = cms.VPSet(
574  cms.PSet( cutName = cms.string("MinPtCut"),
575  minPt = cms.double(5.0),
576  needsAdditionalProducts = cms.bool(False),
577  isIgnored = cms.bool(False) ),
578  cms.PSet( cutName = cms.string("GsfEleSCEtaMultiRangeCut"),
579  useAbsEta = cms.bool(True),
580  allowedEtaRanges = cms.VPSet(
581  cms.PSet( minEta = cms.double(0.0),
582  maxEta = cms.double(ebCutOff) ),
583  cms.PSet( minEta = cms.double(ebCutOff),
584  maxEta = cms.double(2.5) )
585  ),
586  needsAdditionalProducts = cms.bool(False),
587  isIgnored = cms.bool(False)),
588  cms.PSet( cutName = cms.string('GsfEleDEtaInCut'),
589  dEtaInCutValueEB = cms.double( wpEB.dEtaInCut ),
590  dEtaInCutValueEE = cms.double( wpEE.dEtaInCut ),
591  barrelCutOff = cms.double(ebCutOff),
592  needsAdditionalProducts = cms.bool(False),
593  isIgnored = cms.bool(False)),
594  cms.PSet( cutName = cms.string('GsfEleDPhiInCut'),
595  dPhiInCutValueEB = cms.double( wpEB.dPhiInCut ),
596  dPhiInCutValueEE = cms.double( wpEE.dPhiInCut ),
597  barrelCutOff = cms.double(ebCutOff),
598  needsAdditionalProducts = cms.bool(False),
599  isIgnored = cms.bool(False)),
600  cms.PSet( cutName = cms.string('GsfEleFull5x5SigmaIEtaIEtaCut'),
601  full5x5SigmaIEtaIEtaCutValueEB = cms.double( wpEB.full5x5_sigmaIEtaIEtaCut ),
602  full5x5SigmaIEtaIEtaCutValueEE = cms.double( wpEE.full5x5_sigmaIEtaIEtaCut ),
603  barrelCutOff = cms.double(ebCutOff),
604  needsAdditionalProducts = cms.bool(False),
605  isIgnored = cms.bool(False)),
606  cms.PSet( cutName = cms.string('GsfEleHadronicOverEMCut'),
607  hadronicOverEMCutValueEB = cms.double( wpEB.hOverECut ),
608  hadronicOverEMCutValueEE = cms.double( wpEE.hOverECut ),
609  barrelCutOff = cms.double(ebCutOff),
610  needsAdditionalProducts = cms.bool(False),
611  isIgnored = cms.bool(False)),
612  cms.PSet( cutName = cms.string('GsfEleDxyCut'),
613  dxyCutValueEB = cms.double( wpEB.dxyCut ),
614  dxyCutValueEE = cms.double( wpEE.dxyCut ),
615  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
616  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
617  barrelCutOff = cms.double(ebCutOff),
618  needsAdditionalProducts = cms.bool(True),
619  isIgnored = cms.bool(False)),
620  cms.PSet( cutName = cms.string('GsfEleDzCut'),
621  dzCutValueEB = cms.double( wpEB.dzCut ),
622  dzCutValueEE = cms.double( wpEE.dzCut ),
623  vertexSrc = cms.InputTag("offlinePrimaryVertices"),
624  vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
625  barrelCutOff = cms.double(ebCutOff),
626  needsAdditionalProducts = cms.bool(True),
627  isIgnored = cms.bool(False)),
628  cms.PSet( cutName = cms.string('GsfEleEInverseMinusPInverseCut'),
629  eInverseMinusPInverseCutValueEB = cms.double( wpEB.absEInverseMinusPInverseCut ),
630  eInverseMinusPInverseCutValueEE = cms.double( wpEE.absEInverseMinusPInverseCut ),
631  barrelCutOff = cms.double(ebCutOff),
632  needsAdditionalProducts = cms.bool(False),
633  isIgnored = cms.bool(False)),
634  cms.PSet( cutName = cms.string('GsfEleEffAreaPFIsoCut'),
635  isoCutEBLowPt = cms.double( wpEB.relCombIsolationWithEALowPtCut ),
636  isoCutEBHighPt = cms.double( wpEB.relCombIsolationWithEAHighPtCut ),
637  isoCutEELowPt = cms.double( wpEE.relCombIsolationWithEALowPtCut ),
638  isoCutEEHighPt = cms.double( wpEE.relCombIsolationWithEAHighPtCut ),
639  isRelativeIso = cms.bool(True),
640  ptCutOff = cms.double(20.0), # high pT above this value, low pT below
641  barrelCutOff = cms.double(ebCutOff),
642  rho = cms.InputTag("fixedGridRhoFastjetAll"),
643  effAreasConfigFile = cms.FileInPath( isoInputs.isoEffAreas ),
644  needsAdditionalProducts = cms.bool(True),
645  isIgnored = cms.bool(False) ),
646  cms.PSet( cutName = cms.string('GsfEleConversionVetoCut'),
647  conversionSrc = cms.InputTag('allConversions'),
648  conversionSrcMiniAOD = cms.InputTag('reducedEgamma:reducedConversions'),
649  beamspotSrc = cms.InputTag('offlineBeamSpot'),
650  needsAdditionalProducts = cms.bool(True),
651  isIgnored = cms.bool(False)),
652  cms.PSet( cutName = cms.string('GsfEleMissingHitsCut'),
653  maxMissingHitsEB = cms.uint32( wpEB.missingHitsCut ),
654  maxMissingHitsEE = cms.uint32( wpEE.missingHitsCut ),
655  barrelCutOff = cms.double(ebCutOff),
656  needsAdditionalProducts = cms.bool(False),
657  isIgnored = cms.bool(False) ),
658  )
659  )
660  #
661  return parameterSet
662 
663 
664 # ==============================================================
665 # Define the complete cut sets
666 # ==============================================================
667 
668 def configureVIDCutBasedEleID_V3( wpEB, wpEE, isoInputs ):
669  """
670  This function configures the full cms.PSet for a VID ID and returns it.
671  The inputs: two objects of the type WorkingPoint_V3, one
672  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
673  The third argument is an object that contains information necessary
674  for isolation calculations.
675  In this version, the impact parameter cuts dxy and dz are not present
676  """
677  # print "VID: Configuring cut set %s" % wpEB.idName
678  parameterSet = cms.PSet(
679  #
680  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
681  cutFlow = cms.VPSet(
682  psetMinPtCut(),
683  psetPhoSCEtaMultiRangeCut(), # eta cut
684  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
685  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
686  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
687  psetHadronicOverEMCut(wpEB, wpEE), # H/E cut
688  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
689  psetEffAreaPFIsoCut(wpEB, wpEE, isoInputs), # rel. comb. PF isolation cut
691  psetMissingHitsCut(wpEB, wpEE)
692  )
693  )
694  #
695  return parameterSet
696 
697 def configureVIDCutBasedEleID_V4( wpEB, wpEE, isoInputs ):
698  """
699  This function configures the full cms.PSet for a VID ID and returns it.
700  The inputs: two objects of the type WorkingPoint_V3, one
701  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
702  The third argument is an object that contains information necessary
703  for isolation calculations.
704  In this version, the energy and pileup dependent hOverE is introduced
705  """
706  # print "VID: Configuring cut set %s" % wpEB.idName
707  parameterSet = cms.PSet(
708  #
709  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
710  cutFlow = cms.VPSet(
711  psetMinPtCut(),
712  psetPhoSCEtaMultiRangeCut(), # eta cut
713  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
714  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
715  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
716  psetHadronicOverEMEnergyScaledCut(wpEB, wpEE), # H/E cut
717  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
718  psetEffAreaPFIsoCut(wpEB, wpEE, isoInputs), # rel. comb. PF isolation cut
720  psetMissingHitsCut(wpEB, wpEE)
721  )
722  )
723  #
724  return parameterSet
725 
726 def configureVIDCutBasedEleID_V5( wpEB, wpEE, isoInputs ):
727  """
728  This function configures the full cms.PSet for a VID ID and returns it.
729  The inputs: two objects of the type WorkingPoint_V3, one
730  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
731  The third argument is an object that contains information necessary
732  for isolation calculations.
733  In this version, the pt dependent isolation is introduced
734  """
735  # print "VID: Configuring cut set %s" % wpEB.idName
736  parameterSet = cms.PSet(
737  #
738  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
739  cutFlow = cms.VPSet(
740  psetMinPtCut(),
741  psetPhoSCEtaMultiRangeCut(), # eta cut
742  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
743  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
744  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
745  psetHadronicOverEMEnergyScaledCut(wpEB, wpEE), # H/E cut
746  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
747  psetRelPFIsoScaledCut(wpEB, wpEE, isoInputs), # rel. comb. PF isolation cut
749  psetMissingHitsCut(wpEB, wpEE)
750  )
751  )
752  #
753  return parameterSet
754 
755 
756 # -----------------------------
757 # HLT-safe common definitions
758 # -----------------------------
759 
760 
761 def configureVIDCutBasedEleHLTPreselection_V1( wpEB, wpEE, ecalIsoInputs, hcalIsoInputs ):
762  """
763  This function configures the full cms.PSet for a VID ID and returns it.
764  The inputs: two objects of the type EleHLTSelection_V1, one
765  containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
766  The third and fourth arguments are objects that contain information necessary
767  for isolation calculations for ECAL and HCAL.
768  """
769  # print "VID: Configuring cut set %s" % wpEB.idName
770  parameterSet = cms.PSet(
771  idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
772  cutFlow = cms.VPSet(
773  psetMinPtCut(), # min pt cut
774  psetPhoSCEtaMultiRangeCut(), # eta cut
775  psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE), # full 5x5 sigmaIEtaIEta cut
776  psetDEtaInSeedCut(wpEB, wpEE), # dEtaIn seed cut
777  psetDPhiInCut(wpEB, wpEE), # dPhiIn cut
778  psetHadronicOverEMCut(wpEB, wpEE), # H/E cut
779  psetEInerseMinusPInverseCut(wpEB, wpEE), # |1/e-1/p| cut
780  psetEcalPFClusterIsoCut(wpEB, wpEE, ecalIsoInputs), # ECAL PF Cluster isolation
781  psetHcalPFClusterIsoCut(wpEB, wpEE, hcalIsoInputs), # HCAL PF Cluster isolation
782  psetTrkPtIsoCut(wpEB, wpEE), # tracker isolation cut
783  psetNormalizedGsfChi2Cut(wpEB, wpEE) # GsfTrack chi2/NDOF cut
784  )
785  )
786  #
787  return parameterSet
788 
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)