CMS 3D CMS Logo

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