Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:08

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 # Define eta constants
0004 ebMax = 1.4442
0005 eeMin = 1.566
0006 ebCutOff=1.479
0007 
0008 
0009 # ===============================================
0010 # Define containers used by cut definitions
0011 # ===============================================
0012 
0013 class HEEP_WorkingPoint_V1:
0014     """
0015     This is a container class to hold numerical cut values for either
0016     the barrel or endcap set of cuts
0017     """
0018     def __init__(self, 
0019                  idName,
0020                  dEtaInSeedCut,
0021                  dPhiInCut,
0022                  full5x5SigmaIEtaIEtaCut,
0023                  # Two constants for the GsfEleFull5x5E2x5OverE5x5Cut
0024                  minE1x5OverE5x5Cut,
0025                  minE2x5OverE5x5Cut,
0026                  # Three constants for the GsfEleHadronicOverEMLinearCut:
0027                  #     cut = constTerm if value < slopeStart
0028                  #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0029                  hOverESlopeTerm,
0030                  hOverESlopeStart,
0031                  hOverEConstTerm,
0032                  # Three constants for the GsfEleTrkPtIsoCut: 
0033                  #     cut = constTerm if value < slopeStart
0034                  #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0035                  trkIsoSlopeTerm,
0036                  trkIsoSlopeStart,
0037                  trkIsoConstTerm,
0038                  # Three constants for the GsfEleEmHadD1IsoRhoCut: 
0039                  #     cut = constTerm if value < slopeStart
0040                  #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0041                  # Also for the same cut, the effective area for the rho correction of the isolation
0042                  ehIsoSlopeTerm,
0043                  ehIsoSlopeStart,
0044                  ehIsoConstTerm,
0045                  effAreaForEHIso, 
0046                  # other cuts:
0047                  dxyCut,
0048                  maxMissingHitsCut,
0049                  ecalDrivenCut
0050                  ):
0051         # assign values taken from all the arguments above
0052         self.idName                  = idName
0053         self.dEtaInSeedCut           = dEtaInSeedCut          
0054         self.dPhiInCut               = dPhiInCut              
0055         self.full5x5SigmaIEtaIEtaCut = full5x5SigmaIEtaIEtaCut
0056         self.minE1x5OverE5x5Cut      = minE1x5OverE5x5Cut     
0057         self.minE2x5OverE5x5Cut      = minE2x5OverE5x5Cut     
0058         self.hOverESlopeTerm         = hOverESlopeTerm        
0059         self.hOverESlopeStart        = hOverESlopeStart       
0060         self.hOverEConstTerm         = hOverEConstTerm        
0061         self.trkIsoSlopeTerm         = trkIsoSlopeTerm        
0062         self.trkIsoSlopeStart        = trkIsoSlopeStart       
0063         self.trkIsoConstTerm         = trkIsoConstTerm        
0064         self.ehIsoSlopeTerm          = ehIsoSlopeTerm         
0065         self.ehIsoSlopeStart         = ehIsoSlopeStart        
0066         self.ehIsoConstTerm          = ehIsoConstTerm         
0067         self.effAreaForEHIso         = effAreaForEHIso
0068         self.dxyCut                  = dxyCut                 
0069         self.maxMissingHitsCut       = maxMissingHitsCut      
0070         self.ecalDrivenCut           = ecalDrivenCut
0071 
0072 class HEEP_WorkingPoint_V2:
0073     """
0074     This is a container class to hold numerical cut values for either
0075     the barrel or endcap set of cuts
0076     """
0077     def __init__(self, 
0078                  idName,
0079                  dEtaInSeedCut,
0080                  dPhiInCut,
0081                  full5x5SigmaIEtaIEtaCut,
0082                  # Two constants for the GsfEleFull5x5E2x5OverE5x5Cut
0083                  minE1x5OverE5x5Cut,
0084                  minE2x5OverE5x5Cut,
0085                  # Three constants for the GsfEleHadronicOverEMLinearCut:
0086                  #     cut = constTerm if value < slopeStart
0087                  #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0088                  hOverESlopeTerm,
0089                  hOverESlopeStart,
0090                  hOverEConstTerm,
0091                  # Three constants for the GsfEleTrkPtIsoCut: 
0092                  #     cut = constTerm if value < slopeStart
0093                  #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0094                  trkIsoSlopeTerm,
0095                  trkIsoSlopeStart,
0096                  trkIsoConstTerm,
0097                  trkIsoRhoCorrStart,
0098                  trkIsoEffArea,
0099                  # Three constants for the GsfEleEmHadD1IsoRhoCut: 
0100                  #     cut = constTerm if value < slopeStart
0101                  #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0102                  # Also for the same cut, the effective area for the rho correction of the isolation
0103                  ehIsoSlopeTerm,
0104                  ehIsoSlopeStart,
0105                  ehIsoConstTerm,
0106                  effAreaForEHIso, 
0107                  # other cuts:
0108                  dxyCut,
0109                  maxMissingHitsCut,
0110                  ecalDrivenCut
0111                  ):
0112         # assign values taken from all the arguments above
0113         self.idName                  = idName
0114         self.dEtaInSeedCut           = dEtaInSeedCut          
0115         self.dPhiInCut               = dPhiInCut              
0116         self.full5x5SigmaIEtaIEtaCut = full5x5SigmaIEtaIEtaCut
0117         self.minE1x5OverE5x5Cut      = minE1x5OverE5x5Cut     
0118         self.minE2x5OverE5x5Cut      = minE2x5OverE5x5Cut     
0119         self.hOverESlopeTerm         = hOverESlopeTerm        
0120         self.hOverESlopeStart        = hOverESlopeStart       
0121         self.hOverEConstTerm         = hOverEConstTerm        
0122         self.trkIsoSlopeTerm         = trkIsoSlopeTerm        
0123         self.trkIsoSlopeStart        = trkIsoSlopeStart       
0124         self.trkIsoConstTerm         = trkIsoConstTerm
0125         self.trkIsoRhoCorrStart      = trkIsoRhoCorrStart
0126         self.trkIsoEffArea           = trkIsoEffArea
0127         self.ehIsoSlopeTerm          = ehIsoSlopeTerm         
0128         self.ehIsoSlopeStart         = ehIsoSlopeStart        
0129         self.ehIsoConstTerm          = ehIsoConstTerm         
0130         self.effAreaForEHIso         = effAreaForEHIso
0131         self.dxyCut                  = dxyCut                 
0132         self.maxMissingHitsCut       = maxMissingHitsCut      
0133         self.ecalDrivenCut           = ecalDrivenCut
0134 # ==============================================================
0135 # Define individual cut configurations used by complete cut sets
0136 # ==============================================================
0137 
0138 # The mininum pt cut is set to 35 GeV
0139 def psetMinPtCut(cutValue=35.):
0140     return cms.PSet( 
0141         cutName = cms.string("MinPtCut"),
0142         minPt = cms.double(cutValue),
0143         needsAdditionalProducts = cms.bool(False),
0144         isIgnored = cms.bool(False) 
0145         )
0146 
0147 # The mininum pt cut is set to 5 GeV
0148 def psetMinEcalEtCut(cutValue=5.):
0149     return cms.PSet( 
0150         cutName = cms.string("GsfEleMinEcalEtCut"),
0151         minEt = cms.double(cutValue),
0152         needsAdditionalProducts = cms.bool(False),
0153         isIgnored = cms.bool(False) 
0154         )
0155                 
0156 # Take all particles in the eta ranges 0-ebMax and eeMin-2.5
0157 def psetGsfEleSCEtaMultiRangeCut():
0158     return cms.PSet( 
0159         cutName = cms.string("GsfEleSCEtaMultiRangeCut"),
0160         useAbsEta = cms.bool(True),
0161         allowedEtaRanges = cms.VPSet( 
0162             cms.PSet( minEta = cms.double(0.0), 
0163                       maxEta = cms.double(ebMax) ),
0164             cms.PSet( minEta = cms.double(eeMin), 
0165                       maxEta = cms.double(2.5) )
0166             ),
0167         needsAdditionalProducts = cms.bool(False),
0168         isIgnored = cms.bool(False)
0169         )
0170 
0171 # Configure the cut on the dEtaIn for the seed
0172 def psetGsfEleDEtaInSeedCut(wpEB, wpEE):
0173     return cms.PSet( 
0174         cutName = cms.string('GsfEleEBEECut'),
0175         cutString = cms.string("abs(deltaEtaSeedClusterTrackAtVtx)"),
0176         cutValueEB = cms.double( wpEB.dEtaInSeedCut ),
0177         cutValueEE = cms.double( wpEE.dEtaInSeedCut ),
0178         needsAdditionalProducts = cms.bool(False),
0179         isIgnored = cms.bool(False)
0180         )
0181 
0182 # Configure the cut on the dPhiIn
0183 def psetGsfEleDPhiInCut(wpEB, wpEE):
0184     return cms.PSet( 
0185         cutName = cms.string('GsfEleEBEECut'),
0186         cutString = cms.string("abs(deltaPhiSuperClusterTrackAtVtx)"),
0187         cutValueEB = cms.double( wpEB.dPhiInCut ),
0188         cutValueEE = cms.double( wpEE.dPhiInCut ),
0189         needsAdditionalProducts = cms.bool(False),
0190         isIgnored = cms.bool(False)
0191         )
0192 
0193 # Confugure the full 5x5 sigmaIEtaIEta cut
0194 def psetGsfEleFull5x5SigmaIEtaIEtaCut(wpEB, wpEE):
0195     return cms.PSet( 
0196         cutName = cms.string('GsfEleEBEECut'),
0197         cutString = cms.string("full5x5_sigmaIetaIeta"),
0198         cutValueEB = cms.double( wpEB.full5x5SigmaIEtaIEtaCut ),
0199         cutValueEE = cms.double( wpEE.full5x5SigmaIEtaIEtaCut ),
0200         needsAdditionalProducts = cms.bool(False),
0201         isIgnored = cms.bool(False)
0202         )
0203 
0204 def psetGsfEleFull5x5SigmaIEtaIEtaWithSatCut(wpEB, wpEE):
0205     return cms.PSet( 
0206         cutName = cms.string('GsfEleFull5x5SigmaIEtaIEtaWithSatCut'),
0207         maxSigmaIEtaIEtaEB = cms.double( wpEB.full5x5SigmaIEtaIEtaCut ),
0208         maxSigmaIEtaIEtaEE = cms.double( wpEE.full5x5SigmaIEtaIEtaCut ),
0209         maxNrSatCrysIn5x5EB =cms.int32( 0 ),
0210         maxNrSatCrysIn5x5EE =cms.int32( 0 ),
0211         needsAdditionalProducts = cms.bool(False), 
0212         
0213         isIgnored = cms.bool(False)
0214         )
0215 # Configure XxX shower shape cuts
0216 def psetGsfEleFull5x5E2x5OverE5x5Cut(wpEB, wpEE):
0217     return cms.PSet( 
0218         cutName = cms.string('GsfEleFull5x5E2x5OverE5x5Cut'),
0219         # E1x5 / E5x5
0220         minE1x5OverE5x5EB = cms.double( wpEB.minE1x5OverE5x5Cut ),
0221         minE1x5OverE5x5EE = cms.double( wpEE.minE1x5OverE5x5Cut ),
0222         # E2x5 / E5x5
0223         minE2x5OverE5x5EB = cms.double( wpEB.minE2x5OverE5x5Cut ),
0224         minE2x5OverE5x5EE = cms.double( wpEE.minE2x5OverE5x5Cut ),
0225         needsAdditionalProducts = cms.bool(False),
0226         isIgnored = cms.bool(False)
0227         )
0228 # Configure XxX shower shape cuts
0229 def psetGsfEleFull5x5E2x5OverE5x5WithSatCut(wpEB, wpEE):
0230     return cms.PSet( 
0231         cutName = cms.string('GsfEleFull5x5E2x5OverE5x5WithSatCut'),
0232         # E1x5 / E5x5
0233         minE1x5OverE5x5EB = cms.double( wpEB.minE1x5OverE5x5Cut ),
0234         minE1x5OverE5x5EE = cms.double( wpEE.minE1x5OverE5x5Cut ),
0235         # E2x5 / E5x5
0236         minE2x5OverE5x5EB = cms.double( wpEB.minE2x5OverE5x5Cut ),
0237         minE2x5OverE5x5EE = cms.double( wpEE.minE2x5OverE5x5Cut ),
0238         maxNrSatCrysIn5x5EB =cms.int32( 0 ),
0239         maxNrSatCrysIn5x5EE =cms.int32( 0 ),
0240         needsAdditionalProducts = cms.bool(False),
0241         isIgnored = cms.bool(False)
0242         )
0243 # Configure the cut of E/H
0244 def psetGsfEleHadronicOverEMLinearCut(wpEB, wpEE) :
0245     return cms.PSet( 
0246         cutName = cms.string('GsfEleHadronicOverEMLinearCut'),
0247         # Three constants for the GsfEleHadronicOverEMLinearCut
0248         #     cut = constTerm if value < slopeStart
0249         #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0250         slopeTermEB = cms.double( wpEB.hOverESlopeTerm ),
0251         slopeTermEE = cms.double( wpEE.hOverESlopeTerm ),
0252         slopeStartEB = cms.double( wpEB.hOverESlopeStart ),
0253         slopeStartEE = cms.double( wpEE.hOverESlopeStart ),
0254         constTermEB = cms.double( wpEB.hOverEConstTerm ),
0255         constTermEE = cms.double( wpEE.hOverEConstTerm ),
0256         needsAdditionalProducts = cms.bool(False),
0257         isIgnored = cms.bool(False)
0258         )
0259 
0260 # Configure the cut on the tracker isolation
0261 def psetGsfEleTrkPtIsoCut(wpEB, wpEE, useHEEPIso = False):
0262     return cms.PSet( 
0263         cutName = cms.string('GsfEleTrkPtIsoCut'),
0264         # Three constants for the GsfEleTrkPtIsoCut
0265         #     cut = constTerm if value < slopeStart
0266         #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0267         slopeTermEB = cms.double( wpEB.trkIsoSlopeTerm ),
0268         slopeTermEE = cms.double( wpEE.trkIsoSlopeTerm ),
0269         slopeStartEB = cms.double( wpEB.trkIsoSlopeStart ),
0270         slopeStartEE = cms.double( wpEE.trkIsoSlopeStart ),
0271         constTermEB = cms.double( wpEB.trkIsoConstTerm ),
0272         constTermEE = cms.double( wpEE.trkIsoConstTerm ),
0273         useHEEPIso = cms.bool(useHEEPIso),
0274         needsAdditionalProducts = cms.bool(False),
0275         isIgnored = cms.bool(False)
0276         )
0277 # Configure the cut on the tracker isolation with a rho correction (hack for 76X)
0278 def psetGsfEleTrkPtIsoRhoCut(wpEB, wpEE):
0279     return cms.PSet( 
0280         cutName = cms.string('GsfEleTrkPtIsoRhoCut'),
0281         # Three constants for the GsfEleTrkPtIsoCut
0282         #     cut = constTerm if value < slopeStart
0283         #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0284         slopeTermEB = cms.double( wpEB.trkIsoSlopeTerm ),
0285         slopeTermEE = cms.double( wpEE.trkIsoSlopeTerm ),
0286         slopeStartEB = cms.double( wpEB.trkIsoSlopeStart ),
0287         slopeStartEE = cms.double( wpEE.trkIsoSlopeStart ),
0288         constTermEB = cms.double( wpEB.trkIsoConstTerm ),
0289         constTermEE = cms.double( wpEE.trkIsoConstTerm ),
0290         rhoEtStartEB = cms.double( wpEB.trkIsoRhoCorrStart),
0291         rhoEtStartEE = cms.double( wpEE.trkIsoRhoCorrStart),
0292         rhoEAEB = cms.double( wpEB.trkIsoEffArea),
0293         rhoEAEE = cms.double( wpEE.trkIsoEffArea),
0294         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0295         needsAdditionalProducts = cms.bool(True),
0296         isIgnored = cms.bool(False)
0297         )
0298 def psetGsfEleTrkPtNoJetCoreIsoCut(wpEB, wpEE):
0299     return cms.PSet( 
0300         cutName = cms.string('GsfEleValueMapIsoRhoCut'),
0301         # Three constants for the GsfEleTrkPtIsoCut
0302         #     cut = constTerm if value < slopeStart
0303         #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0304         slopeTermEB = cms.double( wpEB.trkIsoSlopeTerm ),
0305         slopeTermEE = cms.double( wpEE.trkIsoSlopeTerm ),
0306         slopeStartEB = cms.double( wpEB.trkIsoSlopeStart ),
0307         slopeStartEE = cms.double( wpEE.trkIsoSlopeStart ),
0308         constTermEB = cms.double( wpEB.trkIsoConstTerm ),
0309         constTermEE = cms.double( wpEE.trkIsoConstTerm ),
0310         #no rho so we zero it out, if the input tag is empty, its ignored anyways
0311         rhoEtStartEB = cms.double( 999999.),
0312         rhoEtStartEE = cms.double( 999999.),
0313         rhoEAEB = cms.double( 0. ),
0314         rhoEAEE = cms.double( 0. ),
0315         rho = cms.InputTag(""),
0316         value = cms.InputTag("heepIDVarValueMaps","eleTrkPtIsoNoJetCore"),
0317         needsAdditionalProducts = cms.bool(True),
0318         isIgnored = cms.bool(False)
0319         )
0320 def psetGsfEleTrkPtFall16IsoCut(wpEB, wpEE):
0321     return cms.PSet( 
0322         cutName = cms.string('GsfEleValueMapIsoRhoCut'),
0323         # Three constants for the GsfEleTrkPtIsoCut
0324         #     cut = constTerm if value < slopeStart
0325         #     cut = slopeTerm * (value - slopeStart) + constTerm if value >= slopeStart
0326         slopeTermEB = cms.double( wpEB.trkIsoSlopeTerm ),
0327         slopeTermEE = cms.double( wpEE.trkIsoSlopeTerm ),
0328         slopeStartEB = cms.double( wpEB.trkIsoSlopeStart ),
0329         slopeStartEE = cms.double( wpEE.trkIsoSlopeStart ),
0330         constTermEB = cms.double( wpEB.trkIsoConstTerm ),
0331         constTermEE = cms.double( wpEE.trkIsoConstTerm ),
0332         #no rho so we zero it out, if the input tag is empty, its ignored anyways
0333         rhoEtStartEB = cms.double( 999999.),
0334         rhoEtStartEE = cms.double( 999999.),
0335         rhoEAEB = cms.double( 0. ),
0336         rhoEAEE = cms.double( 0. ),
0337         rho = cms.InputTag(""),
0338         value = cms.InputTag("heepIDVarValueMaps","eleTrkPtIso"),
0339         needsAdditionalProducts = cms.bool(True),
0340         isIgnored = cms.bool(False)
0341         )
0342 # Configure the cut on the EM + Had_depth_1 isolation with rho correction
0343 def psetGsfEleEmHadD1IsoRhoCut(wpEB, wpEE,energyType="EcalTrk"):
0344     return cms.PSet(
0345         cutName = cms.string('GsfEleEmHadD1IsoRhoCut'),
0346         slopeTermEB = cms.double( wpEB.ehIsoSlopeTerm ),
0347         slopeTermEE = cms.double( wpEE.ehIsoSlopeTerm ),
0348         slopeStartEB = cms.double( wpEB.ehIsoSlopeStart ),
0349         slopeStartEE = cms.double( wpEE.ehIsoSlopeStart ),
0350         constTermEB = cms.double( wpEB.ehIsoConstTerm ),
0351         constTermEE = cms.double( wpEE.ehIsoConstTerm ),
0352         energyType = cms.string( energyType ),
0353         rhoConstant = cms.double( wpEB.effAreaForEHIso), # expected to be the same for EB and EE
0354         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0355         needsAdditionalProducts = cms.bool(True),
0356         isIgnored = cms.bool(False)
0357         )
0358 
0359 # Configure the dxy cut
0360 def psetGsfEleDxyCut(wpEB, wpEE):
0361     return cms.PSet(
0362         cutName = cms.string('GsfEleDxyCut'),
0363         dxyCutValueEB = cms.double( wpEB.dxyCut ),
0364         dxyCutValueEE = cms.double( wpEE.dxyCut ),
0365         vertexSrc = cms.InputTag("offlinePrimaryVertices"),
0366         vertexSrcMiniAOD = cms.InputTag("offlineSlimmedPrimaryVertices"),
0367         barrelCutOff = cms.double(ebCutOff),
0368         needsAdditionalProducts = cms.bool(True),
0369         isIgnored = cms.bool(False)
0370         )
0371 
0372 # Configure the cut on missing hits
0373 def psetGsfEleMissingHitsCut(wpEB, wpEE):
0374     return cms.PSet( 
0375         cutName = cms.string('GsfEleMissingHitsCut'),
0376         maxMissingHitsEB = cms.uint32( wpEB.maxMissingHitsCut ),
0377         maxMissingHitsEE = cms.uint32( wpEE.maxMissingHitsCut ),
0378         barrelCutOff = cms.double(ebCutOff),
0379         needsAdditionalProducts = cms.bool(False),
0380         isIgnored = cms.bool(False)
0381         )
0382 def psetGsfEleEcalDrivenCut(wpEB, wpEE):
0383     return cms.PSet(
0384         cutName = cms.string('GsfEleEcalDrivenCut'),
0385         ecalDrivenEB = cms.int32( wpEB.ecalDrivenCut ),
0386         ecalDrivenEE = cms.int32( wpEE.ecalDrivenCut ),
0387         barrelCutOff = cms.double(ebCutOff),
0388         needsAdditionalProducts = cms.bool(False),
0389         isIgnored = cms.bool(False)
0390         ) 
0391 
0392 # ==============================================================
0393 # Define the complete cut sets
0394 # ==============================================================
0395 
0396 def configureHEEPElectronID_V51(wpEB, wpEE):
0397     """
0398     This function configures the full cms.PSet for a VID ID and returns it.
0399     The inputs: two objects of the type HEEP_WorkingPoint_V1, one
0400     containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
0401     """
0402     parameterSet = cms.PSet(
0403         idName = cms.string("heepElectronID-HEEPV51"),
0404         cutFlow = cms.VPSet(
0405             psetMinPtCut(cutValue=35.),                   #0
0406             psetGsfEleSCEtaMultiRangeCut(),               #1
0407             psetGsfEleDEtaInSeedCut(wpEB,wpEE),           #2
0408             psetGsfEleDPhiInCut(wpEB,wpEE),               #3
0409             psetGsfEleFull5x5SigmaIEtaIEtaCut(wpEB,wpEE), #4
0410             psetGsfEleFull5x5E2x5OverE5x5Cut(wpEB,wpEE),  #5
0411             psetGsfEleHadronicOverEMLinearCut(wpEB,wpEE), #6 
0412             psetGsfEleTrkPtIsoCut(wpEB,wpEE),             #7
0413             psetGsfEleEmHadD1IsoRhoCut(wpEB,wpEE),        #8
0414             psetGsfEleDxyCut(wpEB,wpEE),                  #9
0415             psetGsfEleMissingHitsCut(wpEB,wpEE),          #10,
0416             psetGsfEleEcalDrivenCut(wpEB,wpEE)            #11
0417             )
0418         )
0419     return parameterSet
0420 
0421 def configureHEEPElectronID_V60(wpEB, wpEE):
0422     """
0423     This function configures the full cms.PSet for a VID ID and returns it.
0424     The inputs: two objects of the type HEEP_WorkingPoint_V1, one
0425     containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
0426     """
0427     parameterSet = cms.PSet(
0428         idName = cms.string("heepElectronID-HEEPV60"),
0429         cutFlow = cms.VPSet(
0430             psetMinPtCut(cutValue=35.),                   #0
0431             psetGsfEleSCEtaMultiRangeCut(),               #1
0432             psetGsfEleDEtaInSeedCut(wpEB,wpEE),           #2
0433             psetGsfEleDPhiInCut(wpEB,wpEE),               #3
0434             psetGsfEleFull5x5SigmaIEtaIEtaCut(wpEB,wpEE), #4
0435             psetGsfEleFull5x5E2x5OverE5x5Cut(wpEB,wpEE),  #5
0436             psetGsfEleHadronicOverEMLinearCut(wpEB,wpEE), #6 
0437             psetGsfEleTrkPtIsoCut(wpEB,wpEE),             #7
0438             psetGsfEleEmHadD1IsoRhoCut(wpEB,wpEE),        #8
0439             psetGsfEleDxyCut(wpEB,wpEE),                  #9
0440             psetGsfEleMissingHitsCut(wpEB,wpEE),          #10,
0441             psetGsfEleEcalDrivenCut(wpEB,wpEE)            #11
0442             )
0443         )
0444     return parameterSet
0445 
0446 
0447 def configureHEEPElectronID_V70(idName, wpEB, wpEE):
0448     """
0449     This function configures the full cms.PSet for a VID ID and returns it.
0450     The inputs: two objects of the type HEEP_WorkingPoint_V1, one
0451     containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
0452     """
0453     parameterSet = cms.PSet(
0454         idName = cms.string(idName),
0455         cutFlow = cms.VPSet(
0456             psetMinPtCut(cutValue=35.),                   #0
0457             psetGsfEleSCEtaMultiRangeCut(),               #1
0458             psetGsfEleDEtaInSeedCut(wpEB,wpEE),           #2
0459             psetGsfEleDPhiInCut(wpEB,wpEE),               #3
0460             psetGsfEleFull5x5SigmaIEtaIEtaWithSatCut(wpEB,wpEE), #4
0461             psetGsfEleFull5x5E2x5OverE5x5WithSatCut(wpEB,wpEE),  #5
0462             psetGsfEleHadronicOverEMLinearCut(wpEB,wpEE), #6 
0463             psetGsfEleTrkPtIsoCut(wpEB,wpEE,useHEEPIso=True),#7
0464             psetGsfEleEmHadD1IsoRhoCut(wpEB,wpEE),        #8
0465             psetGsfEleDxyCut(wpEB,wpEE),                  #9
0466             psetGsfEleMissingHitsCut(wpEB,wpEE),          #10,
0467             psetGsfEleEcalDrivenCut(wpEB,wpEE)            #11
0468             )
0469         )
0470     return parameterSet
0471 
0472 def configureHEEPElectronID_V71(idName, wpEB, wpEE,minEt):
0473     """
0474     This function configures the full cms.PSet for a VID ID and returns it.
0475     The inputs: two objects of the type HEEP_WorkingPoint_V1, one
0476     containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
0477     """
0478     parameterSet = cms.PSet(
0479         idName = cms.string(idName),
0480         cutFlow = cms.VPSet(
0481             psetMinEcalEtCut(cutValue=minEt),             #0
0482             psetGsfEleSCEtaMultiRangeCut(),               #1
0483             psetGsfEleDEtaInSeedCut(wpEB,wpEE),           #2
0484             psetGsfEleDPhiInCut(wpEB,wpEE),               #3
0485             psetGsfEleFull5x5SigmaIEtaIEtaWithSatCut(wpEB,wpEE), #4
0486             psetGsfEleFull5x5E2x5OverE5x5WithSatCut(wpEB,wpEE),  #5
0487             psetGsfEleHadronicOverEMLinearCut(wpEB,wpEE), #6 
0488             psetGsfEleTrkPtIsoCut(wpEB,wpEE,useHEEPIso=True),#7
0489             psetGsfEleEmHadD1IsoRhoCut(wpEB,wpEE,energyType="Ecal"),  #8
0490             psetGsfEleDxyCut(wpEB,wpEE),                  #9
0491             psetGsfEleMissingHitsCut(wpEB,wpEE),          #10,
0492             psetGsfEleEcalDrivenCut(wpEB,wpEE)            #11
0493             )
0494         )
0495     return parameterSet
0496 
0497 
0498 def configureHEEPElectronID_V60_80XAOD(idName, wpEB, wpEE):
0499     """
0500     This function configures the full cms.PSet for a VID ID and returns it.
0501     The inputs: two objects of the type HEEP_WorkingPoint_V1, one
0502     containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
0503     """
0504     parameterSet = cms.PSet(
0505         idName = cms.string(idName),
0506         cutFlow = cms.VPSet(
0507             psetMinPtCut(cutValue=35.),                   #0
0508             psetGsfEleSCEtaMultiRangeCut(),               #1
0509             psetGsfEleDEtaInSeedCut(wpEB,wpEE),           #2
0510             psetGsfEleDPhiInCut(wpEB,wpEE),               #3
0511             psetGsfEleFull5x5SigmaIEtaIEtaWithSatCut(wpEB,wpEE), #4
0512             psetGsfEleFull5x5E2x5OverE5x5WithSatCut(wpEB,wpEE),  #5
0513             psetGsfEleHadronicOverEMLinearCut(wpEB,wpEE), #6 
0514             psetGsfEleTrkPtNoJetCoreIsoCut(wpEB,wpEE),    #7
0515             psetGsfEleEmHadD1IsoRhoCut(wpEB,wpEE),        #8
0516             psetGsfEleDxyCut(wpEB,wpEE),                  #9
0517             psetGsfEleMissingHitsCut(wpEB,wpEE),          #10,
0518             psetGsfEleEcalDrivenCut(wpEB,wpEE)            #11
0519             )
0520         )
0521     return parameterSet
0522 
0523 def configureHEEPElectronID_V61(wpEB, wpEE):
0524     """
0525     This function configures the full cms.PSet for a VID ID and returns it.
0526     The inputs: two objects of the type HEEP_WorkingPoint_V2, one
0527     containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
0528     """
0529     parameterSet = cms.PSet(
0530         idName = cms.string("heepElectronID-HEEPV61"),
0531         cutFlow = cms.VPSet(
0532             psetMinPtCut(cutValue=35.),                   #0
0533             psetGsfEleSCEtaMultiRangeCut(),               #1
0534             psetGsfEleDEtaInSeedCut(wpEB,wpEE),           #2
0535             psetGsfEleDPhiInCut(wpEB,wpEE),               #3
0536             psetGsfEleFull5x5SigmaIEtaIEtaCut(wpEB,wpEE), #4
0537             psetGsfEleFull5x5E2x5OverE5x5Cut(wpEB,wpEE),  #5
0538             psetGsfEleHadronicOverEMLinearCut(wpEB,wpEE), #6 
0539             psetGsfEleTrkPtIsoRhoCut(wpEB,wpEE),          #7
0540             psetGsfEleEmHadD1IsoRhoCut(wpEB,wpEE),        #8
0541             psetGsfEleDxyCut(wpEB,wpEE),                  #9
0542             psetGsfEleMissingHitsCut(wpEB,wpEE),          #10,
0543             psetGsfEleEcalDrivenCut(wpEB,wpEE)            #11
0544             )
0545         )
0546     return parameterSet
0547 
0548 def addHEEPVMProducerToSeq(process,seq,useMiniAOD, task=None):
0549     newTask = cms.Task()
0550     seq.associate(newTask)
0551     if task is not None:
0552         task.add(newTask)
0553 
0554     process.load("RecoEgamma.ElectronIdentification.heepIdVarValueMapProducer_cfi")
0555     newTask.add(process.heepIDVarValueMaps)
0556 
0557     if useMiniAOD==False:
0558         process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi")
0559         process.load("PhysicsTools.PatAlgos.slimming.primaryVertexAssociation_cfi")
0560         process.load("PhysicsTools.PatAlgos.slimming.offlineSlimmedPrimaryVertices_cfi")
0561         process.load("PhysicsTools.PatAlgos.slimming.packedPFCandidates_cfi") 
0562         from PhysicsTools.PatAlgos.slimming.packedPFCandidates_cfi import packedPFCandidates
0563         process.packedCandsForTkIso = packedPFCandidates.clone()
0564         process.packedCandsForTkIso.PuppiSrc=cms.InputTag("")
0565         process.packedCandsForTkIso.PuppiNoLepSrc=cms.InputTag("")
0566         
0567         process.load("PhysicsTools.PatAlgos.slimming.lostTracks_cfi")
0568         from PhysicsTools.PatAlgos.slimming.lostTracks_cfi import lostTracks
0569         process.lostTracksForTkIso = lostTracks.clone()
0570         process.lostTracksForTkIso.packedPFCandidates =cms.InputTag("packedCandsForTkIso")
0571         newTask.add(process.primaryVertexAssociation,
0572                     process.offlineSlimmedPrimaryVertices,
0573                     process.packedCandsForTkIso,
0574                     process.lostTracksForTkIso)
0575 
0576 def addHEEPProducersToSeq(process,seq,useMiniAOD, task=None):
0577     '''currently no additional products are needed to run the HEEP ID so this 
0578     function simply remains as a placeholder
0579     '''
0580     return