Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 # Barrel/endcap division in eta
0005 ebCutOff = 1.479
0006 
0007 # ===============================================
0008 # Define containers used by cut definitions
0009 # ===============================================
0010 
0011 class WorkingPoint_V1:
0012     """
0013     This is a container class to hold numerical cut values for either
0014     the barrel or endcap set of cuts
0015     """
0016     def __init__(self, 
0017                  idName,
0018                  hOverECut,
0019                  full5x5_sigmaIEtaIEtaCut,
0020                  # Isolation cuts are generally pt-dependent: cut = C1 + pt * C2
0021                  absPFChaHadIsoWithEACut_C1,
0022                  absPFChaHadIsoWithEACut_C2,
0023                  absPFNeuHadIsoWithEACut_C1,
0024                  absPFNeuHadIsoWithEACut_C2,
0025                  absPFPhoIsoWithEACut_C1,
0026                  absPFPhoIsoWithEACut_C2
0027                  ):
0028         self.idName    = idName
0029         self.hOverECut = hOverECut
0030         self.full5x5_sigmaIEtaIEtaCut = full5x5_sigmaIEtaIEtaCut
0031         self.absPFChaHadIsoWithEACut_C1  = absPFChaHadIsoWithEACut_C1 # charged hadron isolation C1
0032         self.absPFChaHadIsoWithEACut_C2  = absPFChaHadIsoWithEACut_C2 # ........ C2
0033         self.absPFNeuHadIsoWithEACut_C1  = absPFNeuHadIsoWithEACut_C1 # neutral hadron isolation C1
0034         self.absPFNeuHadIsoWithEACut_C2  = absPFNeuHadIsoWithEACut_C2 # ........ C2
0035         self.absPFPhoIsoWithEACut_C1     = absPFPhoIsoWithEACut_C1    # photon isolation C1
0036         self.absPFPhoIsoWithEACut_C2     = absPFPhoIsoWithEACut_C2    # ........ C2
0037 
0038 class WorkingPoint_V2:
0039     """
0040     This is a container class to hold numerical cut values for either
0041     the barrel or endcap set of cuts
0042     This version of the container is different from the previous one
0043     by the fact that it contains three constants instead of two for
0044     the neutral hadron isolation cut, for exponantial parameterization
0045     """
0046     def __init__(self, 
0047                  idName,
0048                  hOverECut,
0049                  full5x5_sigmaIEtaIEtaCut,
0050                  # Isolation cuts are generally pt-dependent: cut = C1 + pt * C2
0051                  # except for the neutral hadron isolation where it is cut = C1+exp(pt*C2+C3)
0052                  absPFChaHadIsoWithEACut_C1,
0053                  absPFChaHadIsoWithEACut_C2,
0054                  absPFNeuHadIsoWithEACut_C1,
0055                  absPFNeuHadIsoWithEACut_C2,
0056                  absPFNeuHadIsoWithEACut_C3,
0057                  absPFPhoIsoWithEACut_C1,
0058                  absPFPhoIsoWithEACut_C2
0059                  ):
0060         self.idName    = idName
0061         self.hOverECut = hOverECut
0062         self.full5x5_sigmaIEtaIEtaCut = full5x5_sigmaIEtaIEtaCut
0063         self.absPFChaHadIsoWithEACut_C1  = absPFChaHadIsoWithEACut_C1 # charged hadron isolation C1
0064         self.absPFChaHadIsoWithEACut_C2  = absPFChaHadIsoWithEACut_C2 # ........ C2
0065         self.absPFNeuHadIsoWithEACut_C1  = absPFNeuHadIsoWithEACut_C1 # neutral hadron isolation C1
0066         self.absPFNeuHadIsoWithEACut_C2  = absPFNeuHadIsoWithEACut_C2 # ........ C2
0067         self.absPFNeuHadIsoWithEACut_C3  = absPFNeuHadIsoWithEACut_C3 # ........ C3
0068         self.absPFPhoIsoWithEACut_C1     = absPFPhoIsoWithEACut_C1    # photon isolation C1
0069         self.absPFPhoIsoWithEACut_C2     = absPFPhoIsoWithEACut_C2    # ........ C2
0070 
0071 
0072 class WorkingPoint_V3:
0073     """
0074     This is a container class to hold the numerical cut values for either
0075     the barrel or endcap set of cuts.
0076     The changes made in this version:
0077     1) The charged hadron isolation and neutral hadron isolation are replaced
0078     by ECal cluster isolation and HCal cluster isolation.
0079     2) The isolation variables have pt-dependance: ECal cluster isolation has
0080     linear dependance and HCal cluster isolation has quadratic dependance
0081     3) Cone-based H/E (instead of tower-based, as done for Run2) is used, and
0082     PU-correction is done for it as well.
0083     """
0084     def __init__(self,
0085                  idName,
0086                  full5x5_sigmaIEtaIEtaCut,
0087                  hOverEwithEACut,
0088                  absPFChgHadIsoWithEACut_C1,
0089                  absPFChgHadIsoWithEACut_C2,
0090                  absPFECalClusIsoWithEACut_C1,
0091                  absPFECalClusIsoWithEACut_C2,
0092                  absPFHCalClusIsoWithEACut_C1,
0093                  absPFHCalClusIsoWithEACut_C2,
0094                  absPFHCalClusIsoWithEACut_C3
0095                  ):
0096                      self.idName = idName
0097 
0098                      self.full5x5_sigmaIEtaIEtaCut = full5x5_sigmaIEtaIEtaCut # sigmaIetaIeta
0099                      self.hOverEwithEACut          = hOverEwithEACut          # H/E (cone-based)
0100 
0101                      self.absPFChgHadIsoWithEACut_C1   = absPFChgHadIsoWithEACut_C1    # Charged hadron isolation (const. term)
0102                      self.absPFChgHadIsoWithEACut_C2   = absPFChgHadIsoWithEACut_C2    # Charged hadron isolation (linear term)
0103                      self.absPFECalClusIsoWithEACut_C1 = absPFECalClusIsoWithEACut_C1  # ECal Cluster isolation (const. term)
0104                      self.absPFECalClusIsoWithEACut_C2 = absPFECalClusIsoWithEACut_C1  # ECal Cluster isolation (linear term)
0105                      self.absPFHCalClusIsoWithEACut_C1 = absPFHCalClusIsoWithEACut_C1  # HCal Cluster isolation (const. term)
0106                      self.absPFHCalClusIsoWithEACut_C2 = absPFHCalClusIsoWithEACut_C2  # HCal Cluster isolation (linear term)
0107                      self.absPFHCalClusIsoWithEACut_C3 = absPFHCalClusIsoWithEACut_C3  # HCal Cluster isolation (quadratic term)
0108 
0109 
0110 class IsolationCutInputs:
0111     """
0112     A container class that holds the names of the isolation maps in the event record
0113     and the names of the files with the effective area constants for pile-up corrections
0114     """
0115     def __init__(self, 
0116                  chHadIsolationMapName,
0117                  chHadIsolationEffAreas,
0118                  neuHadIsolationMapName,
0119                  neuHadIsolationEffAreas,
0120                  phoIsolationMapName,
0121                  phoIsolationEffAreas
0122                  ):
0123                  self.chHadIsolationMapName   = chHadIsolationMapName    
0124                  self.chHadIsolationEffAreas  = chHadIsolationEffAreas  
0125                  self.neuHadIsolationMapName  = neuHadIsolationMapName  
0126                  self.neuHadIsolationEffAreas = neuHadIsolationEffAreas 
0127                  self.phoIsolationMapName     = phoIsolationMapName     
0128                  self.phoIsolationEffAreas    = phoIsolationEffAreas    
0129 
0130 class ClusterIsolationCutInputs:
0131     """
0132     A container class that holds the names of the cluster based isolation maps in the event record
0133     and the names of the files with the effective area constants for pile-up corrections
0134     """
0135     def __init__(self,
0136                  trkIsolationMapName,
0137                  trkIsolationEffAreas,
0138                  ecalClusIsolationMapName,
0139                  ecalClusIsolationEffAreas,
0140                  hcalClusIsolationMapName,
0141                  hcalClusIsolationEffAreas
0142                  ):
0143                  self.trkIsolationMapName       = trkIsolationMapName
0144                  self.trkIsolationEffAreas      = trkIsolationEffAreas
0145                  self.ecalClusIsolationMapName  = ecalClusIsolationMapName
0146                  self.ecalClusIsolationEffAreas = ecalClusIsolationEffAreas
0147                  self.hcalClusIsolationMapName  = hcalClusIsolationMapName
0148                  self.hcalClusIsolationEffAreas = hcalClusIsolationEffAreas
0149 
0150 
0151 class HoverECutInputs:
0152     """
0153     A container class that holds the name of the file with the effective area constants
0154     for pile-up corrections
0155     """
0156     def __init__(self,
0157                  hOverEEffAreas
0158                  ):
0159                  self.hOverEEffAreas = hOverEEffAreas
0160 
0161 
0162 # ==============================================================
0163 # Define individual cut configurations used by complete cut sets
0164 # ==============================================================
0165 
0166 # The mininum pt cut is set to 5 GeV
0167 def psetMinPtCut():
0168     return cms.PSet( 
0169         cutName = cms.string("MinPtCut"),
0170         minPt = cms.double(5.0),
0171         needsAdditionalProducts = cms.bool(False),
0172         isIgnored = cms.bool(False) 
0173         )
0174 
0175 # Take all particles in the eta ranges 0-ebCutOff and ebCutOff-2.5
0176 def psetPhoSCEtaMultiRangeCut():
0177     return cms.PSet( 
0178         cutName = cms.string("PhoSCEtaMultiRangeCut"),
0179         useAbsEta = cms.bool(True),
0180         allowedEtaRanges = cms.VPSet( 
0181             cms.PSet( minEta = cms.double(0.0), 
0182                       maxEta = cms.double(ebCutOff) ),
0183             cms.PSet( minEta = cms.double(ebCutOff), 
0184                       maxEta = cms.double(2.5) )
0185             ),
0186         needsAdditionalProducts = cms.bool(False),
0187         isIgnored = cms.bool(False)
0188         )
0189 
0190 # Configure the cut on H/E
0191 def psetPhoHcalOverEcalBcCut( wpEB, wpEE):
0192     """
0193     Arguments: two containers of working point cut values of the type WorkingPoint_*
0194     """
0195     return cms.PSet( 
0196         cutName = cms.string('PhotonHcalOverEcalBcCut'),
0197         hcalOverEcalCutValueEB = cms.double( wpEB.hOverECut ),
0198         hcalOverEcalCutValueEE = cms.double( wpEE.hOverECut ),
0199         barrelCutOff = cms.double(ebCutOff),
0200         needsAdditionalProducts = cms.bool(False),
0201         isIgnored = cms.bool(False)
0202         )
0203 
0204 # Configure the cut on full5x5 sigmaIEtaIEta that uses a ValueMap,
0205 # relying on an upstream producer that creates it. This was necessary
0206 # for photons up to 7.2.0.
0207 def psetPhoFull5x5SigmaIEtaIEtaValueMapCut(wpEB, wpEE):
0208     """
0209     Arguments: two containers of working point cut values of the type WorkingPoint_*
0210     """
0211     return cms.PSet( 
0212         cutName = cms.string('PhoFull5x5SigmaIEtaIEtaValueMapCut'),
0213         cutValueEB = cms.double( wpEB.full5x5_sigmaIEtaIEtaCut ),
0214         cutValueEE = cms.double( wpEE.full5x5_sigmaIEtaIEtaCut ),
0215         full5x5SigmaIEtaIEtaMap = cms.InputTag('photonIDValueMapProducer:phoFull5x5SigmaIEtaIEta'),
0216         barrelCutOff = cms.double(ebCutOff),
0217         needsAdditionalProducts = cms.bool(True),
0218         isIgnored = cms.bool(False)
0219         )
0220 
0221 # Configure the cut on full5x5 sigmaIEtaIEta that uses the native Photon field
0222 # with this variable (works for releases past 7.2.0).
0223 def psetPhoFull5x5SigmaIEtaIEtaCut(wpEB, wpEE):
0224     """
0225     Arguments: two containers of working point cut values of the type WorkingPoint_*
0226     """
0227     return cms.PSet( 
0228         cutName = cms.string('PhoFull5x5SigmaIEtaIEtaCut'),
0229         cutValueEB = cms.double( wpEB.full5x5_sigmaIEtaIEtaCut ),
0230         cutValueEE = cms.double( wpEE.full5x5_sigmaIEtaIEtaCut ),
0231         barrelCutOff = cms.double(ebCutOff),
0232         needsAdditionalProducts = cms.bool(False),
0233         isIgnored = cms.bool(False)
0234         )
0235 
0236 # Configure the cut on the charged hadron isolation that uses
0237 # the linear pt scaling for barrel and endcap
0238 def psetChHadIsoWithEALinScalingCut(wpEB, wpEE, isoInputs):
0239     """
0240     Arguments: two containers of working point cut values of the type WorkingPoint_*
0241     The third argument contains data for isolation calculation.
0242     The cut is (for lessThan==True), otherwise replace "<" with ">="
0243           X < constTerm + linearPtTerm*pt + quadPtTerm* pt*pt + rho*EA
0244     """
0245     return cms.PSet( 
0246         cutName = cms.string('PhoGenericRhoPtScaledCut'), 
0247         cutVariable = cms.string("chargedHadronIso"),
0248         lessThan = cms.bool(True),
0249         # cut 
0250         constTermEB = cms.double( wpEB.absPFChaHadIsoWithEACut_C1 ),
0251         constTermEE = cms.double( wpEE.absPFChaHadIsoWithEACut_C1 ),
0252         linearPtTermEB = cms.double( wpEB.absPFChaHadIsoWithEACut_C2 ),
0253         linearPtTermEE = cms.double( wpEE.absPFChaHadIsoWithEACut_C2 ),
0254         quadPtTermEB = cms.double( 0. ),
0255         quadPtTermEE = cms.double( 0. ),
0256         needsAdditionalProducts = cms.bool(True),
0257         isIgnored = cms.bool(False),
0258         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0259         effAreasConfigFile = cms.FileInPath( isoInputs.chHadIsolationEffAreas ) 
0260         )
0261 
0262 # Configure the cut on the neutral hadron isolation that uses
0263 # the linear pt scaling for barrel and endcap
0264 def psetNeuHadIsoWithEALinScalingCut( wpEB, wpEE, isoInputs):
0265     """
0266     Arguments: two containers of working point cut values of the type WorkingPoint_*
0267     The third argument contains data for isolation calculation.
0268     """
0269     return cms.PSet( 
0270         cutName = cms.string('PhoGenericRhoPtScaledCut'), 
0271         cutVariable = cms.string("neutralHadronIso"),
0272         lessThan = cms.bool(True),
0273         # cut 
0274         constTermEB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C1 ),
0275         constTermEE = cms.double( wpEE.absPFNeuHadIsoWithEACut_C1 ),
0276         linearPtTermEB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C2 ),
0277         linearPtTermEE = cms.double( wpEE.absPFNeuHadIsoWithEACut_C2 ),
0278         quadPtTermEB = cms.double( 0. ),
0279         quadPtTermEE = cms.double( 0. ),
0280         needsAdditionalProducts = cms.bool(True),
0281         isIgnored = cms.bool(False),
0282         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0283         effAreasConfigFile = cms.FileInPath( isoInputs.neuHadIsolationEffAreas ) 
0284         )
0285 
0286 # Configure the cut on the neutral hadron isolation that uses
0287 # the exponential pt scaling for barrel and the linear pt scaling for endcap
0288 def psetNeuHadIsoWithEAExpoScalingEBCut(wpEB, wpEE, isoInputs):
0289     """
0290     Arguments: two containers of working point cut values of the type WorkingPoint_*
0291     The third argument contains data for isolation calculation.
0292     """
0293     return cms.PSet( 
0294         cutName = cms.string('PhoAnyPFIsoWithEAAndExpoScalingEBCut'), # Neutral hadrons isolation block
0295         # Barrel: cut = c1 + expo(pt*c2+c3)
0296         C1_EB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C1 ),
0297         C2_EB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C2 ),
0298         C3_EB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C3 ),
0299         # Endcap: cut = c1 + pt*c2
0300         C1_EE = cms.double( wpEE.absPFNeuHadIsoWithEACut_C1 ),
0301         C2_EE = cms.double( wpEE.absPFNeuHadIsoWithEACut_C2 ),
0302         anyPFIsoMap = cms.InputTag( isoInputs.neuHadIsolationMapName ),
0303         barrelCutOff = cms.double(ebCutOff),
0304         useRelativeIso = cms.bool(False),
0305         needsAdditionalProducts = cms.bool(True),
0306         isIgnored = cms.bool(False),
0307         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0308         effAreasConfigFile = cms.FileInPath( isoInputs.neuHadIsolationEffAreas ) 
0309         )
0310 
0311 # Configure the cut on the neutral hadron isolation that uses
0312 # the exponential pt scaling for both barrel and endcap
0313 def psetNeuHadIsoWithEAExpoScalingCut(wpEB, wpEE, isoInputs):
0314     """
0315     Arguments: two containers of working point cut values of the type WorkingPoint_*
0316     The third argument contains data for isolation calculation.
0317     """
0318     return cms.PSet( 
0319         cutName = cms.string('PhoAnyPFIsoWithEAAndExpoScalingCut'), # Neutral hadrons isolation block
0320         # Barrel: cut = c1 + expo(pt*c2+c3)
0321         C1_EB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C1 ),
0322         C2_EB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C2 ),
0323         C3_EB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C3 ),
0324         # Endcap: cut = cut = c1 + expo(pt*c2+c3)
0325         C1_EE = cms.double( wpEE.absPFNeuHadIsoWithEACut_C1 ),
0326         C2_EE = cms.double( wpEE.absPFNeuHadIsoWithEACut_C2 ),
0327         C3_EE = cms.double( wpEE.absPFNeuHadIsoWithEACut_C3 ),
0328         anyPFIsoMap = cms.InputTag( isoInputs.neuHadIsolationMapName ),
0329         barrelCutOff = cms.double(ebCutOff),
0330         useRelativeIso = cms.bool(False),
0331         needsAdditionalProducts = cms.bool(True),
0332         isIgnored = cms.bool(False),
0333         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0334         effAreasConfigFile = cms.FileInPath( isoInputs.neuHadIsolationEffAreas ) 
0335         )
0336 
0337 # Configure the cut on the neutral hadron isolation that uses
0338 # the quadratic polynomial pt scaling for both barrel and endcap
0339 def psetNeuHadIsoWithEAQuadScalingCut(wpEB, wpEE, isoInputs):
0340     """
0341     Arguments: two containers of working point cut values of the type WorkingPoint_*
0342     The third argument contains data for isolation calculation.
0343     """
0344     return cms.PSet(
0345         cutName = cms.string('PhoGenericRhoPtScaledCut'), 
0346         cutVariable = cms.string("neutralHadronIso"),
0347         lessThan = cms.bool(True),
0348         # cut 
0349         constTermEB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C1 ),
0350         constTermEE = cms.double( wpEE.absPFNeuHadIsoWithEACut_C1 ),
0351         linearPtTermEB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C2 ),
0352         linearPtTermEE = cms.double( wpEE.absPFNeuHadIsoWithEACut_C2 ),
0353         quadPtTermEB = cms.double( wpEB.absPFNeuHadIsoWithEACut_C3 ),
0354         quadPtTermEE = cms.double( wpEE.absPFNeuHadIsoWithEACut_C3 ),
0355         needsAdditionalProducts = cms.bool(True),
0356         isIgnored = cms.bool(False),
0357         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0358         effAreasConfigFile = cms.FileInPath( isoInputs.neuHadIsolationEffAreas )
0359         )
0360 
0361 # Configure the cut on the photon isolation that uses
0362 # the linear pt scaling for barrel and endcap
0363 def psetPhoIsoWithEALinScalingCut(wpEB, wpEE, isoInputs):
0364     """
0365     Arguments: two containers of working point cut values of the type WorkingPoint_*
0366     The third argument contains data for isolation calculation.
0367     """
0368     return cms.PSet(
0369         cutName = cms.string('PhoGenericRhoPtScaledCut'), 
0370         cutVariable = cms.string("photonIso"),
0371         lessThan = cms.bool(True),
0372         # cut 
0373         constTermEB = cms.double( wpEB.absPFPhoIsoWithEACut_C1 ),
0374         constTermEE = cms.double( wpEE.absPFPhoIsoWithEACut_C1 ),
0375         linearPtTermEB = cms.double( wpEB.absPFPhoIsoWithEACut_C2 ),
0376         linearPtTermEE = cms.double( wpEE.absPFPhoIsoWithEACut_C2 ),
0377         quadPtTermEB = cms.double( 0. ),
0378         quadPtTermEE = cms.double( 0. ),
0379         needsAdditionalProducts = cms.bool(True),
0380         isIgnored = cms.bool(False),
0381         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0382         effAreasConfigFile = cms.FileInPath( isoInputs.phoIsolationEffAreas )
0383         )
0384 
0385 
0386 # Configure the cut on H/E (cone-based)
0387 def psetPhoHcalOverEcalWithEACut( wpEB, wpEE, hOverEInputs ):
0388     """
0389     Arguments: two containers of working point cut values of the type WorkingPoint_V3
0390     Third argument contains the effective areas for pile-up corrections.
0391     """
0392     return cms.PSet(
0393         cutName = cms.string('PhoGenericQuadraticRhoPtScaledCut'),
0394         cutVariable = cms.string("hcalOverEcal"),
0395         lessThan = cms.bool(True),
0396         # cut
0397         constTermEB = cms.double( wpEB.hOverEwithEACut ),
0398         constTermEE = cms.double( wpEE.hOverEwithEACut ),
0399         linearPtTermEB = cms.double( 0. ),
0400         linearPtTermEE = cms.double( 0. ),
0401         quadraticPtTermEB = cms.double( 0. ),
0402         quadraticPtTermEE = cms.double( 0. ),
0403         needsAdditionalProducts = cms.bool(True),
0404         isIgnored = cms.bool(False),
0405         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0406         quadEAflag = cms.bool(True),
0407         effAreasConfigFile = cms.FileInPath( hOverEInputs.hOverEEffAreas )
0408         )
0409 
0410 
0411 # Configure the cut on the charged hadron isolation that uses
0412 # the quadratic pt scaling for barrel and endcap
0413 def psetChgHadIsoWithEAQuadScalingCut(wpEB, wpEE, isoInputs):
0414     """
0415     Arguments: two containers of working point cut values of the type WorkingPoint_V3
0416     The third argument contains data for isolation calculation.
0417     The cut is (for lessThan==True), otherwise replace "<" with ">="
0418           X < constTerm + linearPtTerm*pt + quadPtTerm* pt*pt + rho*EA
0419     """
0420     return cms.PSet(
0421         cutName = cms.string('PhoGenericQuadraticRhoPtScaledCut'),
0422         cutVariable = cms.string("chargedHadronIso"),
0423         lessThan = cms.bool(True),
0424         # cut
0425         constTermEB = cms.double( wpEB.absPFChgHadIsoWithEACut_C1 ),
0426         constTermEE = cms.double( wpEE.absPFChgHadIsoWithEACut_C1 ),
0427         linearPtTermEB = cms.double( wpEB.absPFChgHadIsoWithEACut_C2 ),
0428         linearPtTermEE = cms.double( wpEE.absPFChgHadIsoWithEACut_C2 ),
0429         quadraticPtTermEB = cms.double( 0. ),
0430         quadraticPtTermEE = cms.double( 0. ),
0431         needsAdditionalProducts = cms.bool(True),
0432         isIgnored = cms.bool(False),
0433         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0434         quadEAflag = cms.bool(True),
0435         effAreasConfigFile = cms.FileInPath( isoInputs.chHadIsolationEffAreas )
0436         )
0437 
0438 
0439 
0440 # Configure the cut on the ECal cluster isolation that uses
0441 # the quadratic pt scaling for barrel and endcap
0442 def psetECalClusIsoWithEAQuadScalingCut(wpEB, wpEE, clusterIsoInputs):
0443     """
0444     Arguments: two containers of working point cut values of the type WorkingPoint_V3
0445     The third argument contains data for isolation calculation.
0446     """
0447     return cms.PSet(
0448         cutName = cms.string('PhoGenericQuadraticRhoPtScaledCut'),
0449         cutVariable = cms.string("ecalPFClusterIso"),
0450         lessThan = cms.bool(True),
0451         # cut
0452         constTermEB = cms.double( wpEB.absPFECalClusIsoWithEACut_C1 ),
0453         constTermEE = cms.double( wpEE.absPFECalClusIsoWithEACut_C1 ),
0454         linearPtTermEB = cms.double( wpEB.absPFECalClusIsoWithEACut_C2 ),
0455         linearPtTermEE = cms.double( wpEE.absPFECalClusIsoWithEACut_C2 ),
0456         quadraticPtTermEB = cms.double( 0. ),
0457         quadraticPtTermEE = cms.double( 0. ),
0458         needsAdditionalProducts = cms.bool(True),
0459         isIgnored = cms.bool(False),
0460         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0461         quadEAflag = cms.bool(True),
0462         effAreasConfigFile = cms.FileInPath( clusterIsoInputs.ecalClusIsolationEffAreas )
0463         )
0464 
0465 
0466 # Configure the cut on the HCal cluster isolation that uses
0467 # the quadratic polynomial pt scaling for both barrel and endcap
0468 def psetHCalClusIsoWithEAQuadScalingCut(wpEB, wpEE, clusterIsoInputs):
0469     """
0470     Arguments: two containers of working point cut values of the type WorkingPoint_V3
0471     The third argument contains data for isolation calculation.
0472     """
0473     return cms.PSet(
0474         cutName = cms.string('PhoGenericQuadraticRhoPtScaledCut'),
0475         cutVariable = cms.string("hcalPFClusterIso"),
0476         lessThan = cms.bool(True),
0477         # cut
0478         constTermEB = cms.double( wpEB.absPFHCalClusIsoWithEACut_C1 ),
0479         constTermEE = cms.double( wpEE.absPFHCalClusIsoWithEACut_C1 ),
0480         linearPtTermEB = cms.double( wpEB.absPFHCalClusIsoWithEACut_C2 ),
0481         linearPtTermEE = cms.double( wpEE.absPFHCalClusIsoWithEACut_C2 ),
0482         quadraticPtTermEB = cms.double( wpEB.absPFHCalClusIsoWithEACut_C3 ),
0483         quadraticPtTermEE = cms.double( wpEE.absPFHCalClusIsoWithEACut_C3 ),
0484         needsAdditionalProducts = cms.bool(True),
0485         isIgnored = cms.bool(False),
0486         rho = cms.InputTag("fixedGridRhoFastjetAll"),
0487         quadEAflag = cms.bool(True),
0488         effAreasConfigFile = cms.FileInPath( clusterIsoInputs.hcalClusIsolationEffAreas )
0489         )
0490 
0491 
0492 
0493 # ==============================================================
0494 # Define the complete cut sets
0495 # ==============================================================
0496 
0497 
0498 def configureVIDCutBasedPhoID_V1( wpEB, wpEE, isoInputs ):
0499     """
0500     This function configures the full cms.PSet for a VID ID and returns it.
0501     The inputs: two objects of the type WorkingPoint_V1, one
0502     containing the cuts for the Barrel (EB) and the other one for the Endcap (EE).
0503     The third argument contains data for isolation calculation.
0504     """
0505     # print "VID: Configuring cut set %s" % wpEB.idName
0506     parameterSet =  cms.PSet(
0507         #
0508         idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
0509         cutFlow = cms.VPSet( 
0510             psetMinPtCut(),                                        # pt cut
0511             psetPhoSCEtaMultiRangeCut(),                           # eta cut
0512             psetPhoHcalOverEcalBcCut(wpEB,wpEE),                   # H/E cut
0513             psetPhoFull5x5SigmaIEtaIEtaValueMapCut(wpEB,wpEE),     # full 5x5 sigmaIEtaIEta cut
0514             psetChHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs),  # charged hadron isolation cut
0515             psetNeuHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs), # neutral hadron isolation cut
0516             psetPhoIsoWithEALinScalingCut(wpEB,wpEE,isoInputs)     # photon isolation cut
0517             )
0518         )
0519     #
0520     return parameterSet
0521 
0522 def configureVIDCutBasedPhoID_V2( wpEB, wpEE, isoInputs ):
0523     """
0524     This function configures the full cms.PSet for a VID ID and returns it.
0525     The inputs: first object is of the type WorkingPoint_V2, second object
0526     is of the type WorkingPoint_V1, containing the cuts for the Barrel (EB) 
0527     and the other one for the Endcap (EE).
0528     The third argument contains data for isolation calculation.
0529 
0530     The V2 with respect to V1 has one change: the neutral hadron isolation
0531     cut has an exponential pt scaling for the barrel.
0532     """
0533     # print "VID: Configuring cut set %s" % wpEB.idName
0534     parameterSet =  cms.PSet(
0535         #
0536         idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
0537         cutFlow = cms.VPSet( 
0538             psetMinPtCut(),                                           # pt cut
0539             psetPhoSCEtaMultiRangeCut(),                              # eta cut
0540             psetPhoHcalOverEcalBcCut(wpEB,wpEE),                      # H/E cut
0541             psetPhoFull5x5SigmaIEtaIEtaValueMapCut(wpEB,wpEE),        # full 5x5 sigmaIEtaIEta cut
0542             psetChHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs),     # charged hadron isolation cut
0543             psetNeuHadIsoWithEAExpoScalingEBCut(wpEB,wpEE,isoInputs), # neutral hadron isolation cut
0544             psetPhoIsoWithEALinScalingCut(wpEB,wpEE,isoInputs)        # photon isolation cut
0545             )
0546         )
0547     #
0548     return parameterSet
0549 
0550 def configureVIDCutBasedPhoID_V3( wpEB, wpEE, isoInputs ):
0551     """
0552     This function configures the full cms.PSet for a VID ID and returns it.
0553     The inputs: first object is of the type WorkingPoint_V2, second object
0554     is of the type WorkingPoint_V1, containing the cuts for the Barrel (EB) 
0555     and the other one for the Endcap (EE).
0556     The third argument contains data for isolation calculation.
0557 
0558     The V3 with respect to V2 has one change: the full5x5 sigmaIEtaIEta
0559     is taken from the native reco::Photon method and not from a ValueMap
0560     produced upstream by some producer module.
0561     """
0562     # print "VID: Configuring cut set %s" % wpEB.idName
0563     parameterSet =  cms.PSet(
0564         #
0565         idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
0566         cutFlow = cms.VPSet( 
0567             psetMinPtCut(),                                           # pt cut
0568             psetPhoSCEtaMultiRangeCut(),                              # eta cut
0569             psetPhoHcalOverEcalBcCut(wpEB,wpEE),                      # H/E cut
0570             psetPhoFull5x5SigmaIEtaIEtaCut(wpEB,wpEE),                # full 5x5 sigmaIEtaIEta cut
0571             psetChHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs),     # charged hadron isolation cut
0572             psetNeuHadIsoWithEAExpoScalingEBCut(wpEB,wpEE,isoInputs), # neutral hadron isolation cut
0573             psetPhoIsoWithEALinScalingCut(wpEB,wpEE,isoInputs)        # photon isolation cut
0574             )
0575         )
0576     #
0577     return parameterSet
0578 
0579 def configureVIDCutBasedPhoID_V4( wpEB, wpEE, isoInputs ):
0580     """
0581     This function configures the full cms.PSet for a VID ID and returns it.
0582     The inputs: first object is of the type WorkingPoint_V2, second object
0583     is of the type WorkingPoint_V2 as well, first containing the cuts for the 
0584     Barrel (EB) and the other one for the Endcap (EE).
0585     The third argument contains data for isolation calculation.
0586 
0587     The V4 with respect to V3 has one change: both barrel and endcap
0588     use the exponential scaling for the neutral hadron isolation cut
0589     (in V3 it was only done for the barrel)
0590     """
0591     # print "VID: Configuring cut set %s" % wpEB.idName
0592     parameterSet =  cms.PSet(
0593         #
0594         idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
0595         cutFlow = cms.VPSet( 
0596             psetMinPtCut(),                                           # pt cut
0597             psetPhoSCEtaMultiRangeCut(),                              # eta cut
0598             psetPhoHcalOverEcalBcCut(wpEB,wpEE),                      # H/E cut
0599             psetPhoFull5x5SigmaIEtaIEtaCut(wpEB,wpEE),                # full 5x5 sigmaIEtaIEta cut
0600             psetChHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs),     # charged hadron isolation cut
0601             psetNeuHadIsoWithEAExpoScalingCut(wpEB,wpEE,isoInputs), # neutral hadron isolation cut
0602             psetPhoIsoWithEALinScalingCut(wpEB,wpEE,isoInputs)        # photon isolation cut
0603             )
0604         )
0605     #
0606     return parameterSet
0607 
0608 def configureVIDCutBasedPhoID_V5( wpEB, wpEE, isoInputs ):
0609     """
0610     This function configures the full cms.PSet for a VID ID and returns it.
0611     The inputs: first object is of the type WorkingPoint_V2, second object
0612     is of the type WorkingPoint_V2 as well, first containing the cuts for the 
0613     Barrel (EB) and the other one for the Endcap (EE).
0614     The third argument contains data for isolation calculation.
0615 
0616     The V5 with respect to V4 has one change: the neutral hadron isolation
0617     for both barrel and endcap now uses quadratic polynomial scaling.
0618     """
0619     # print "VID: Configuring cut set %s" % wpEB.idName
0620     parameterSet =  cms.PSet(
0621         #
0622         idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
0623         cutFlow = cms.VPSet( 
0624             psetMinPtCut(),                                           # pt cut
0625             psetPhoSCEtaMultiRangeCut(),                              # eta cut
0626             psetPhoHcalOverEcalBcCut(wpEB,wpEE),                      # H/E cut
0627             psetPhoFull5x5SigmaIEtaIEtaCut(wpEB,wpEE),                # full 5x5 sigmaIEtaIEta cut
0628             psetChHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs),     # charged hadron isolation cut
0629             psetNeuHadIsoWithEAQuadScalingCut(wpEB,wpEE,isoInputs),   # neutral hadron isolation cut
0630             psetPhoIsoWithEALinScalingCut(wpEB,wpEE,isoInputs)        # photon isolation cut
0631             )
0632         )
0633     #
0634     return parameterSet
0635 
0636 
0637 
0638 def configureVIDCutBasedPhoID_V6( wpEB, wpEE, isoInputs, clusterIsoInputs, hOverEInputs ):
0639     """
0640     This function configures the full cms.PSet for a VID ID and returns it.
0641     The inputs: first object is of the type WorkingPoint_V3, second object
0642     is of the type WorkingPoint_V3 as well, first containing the cuts for the
0643     Barrel (EB) and the other one for the Endcap (EE).
0644     The third argument contains data for isolation calculation.
0645 
0646     The V6 with respect to V5 has following changes:
0647         1) H/E is now cone-based instead of tower-based.
0648         2) Neutral hadron isolation is replaced by HCal Cluster isolation
0649         for both barrel and endcap (and uses quadratic polynomial scaling
0650         as done before for neutral hadron isolation).
0651         3) Photon isolation is replaced by ECal Cluster isolation for both
0652         barrel and endcap (and uses linear polynomial scaling as done before
0653         for photon isolation).
0654     """
0655 
0656     # print "VID: Configuring cut set %s" % wpEB.idName
0657     parameterSet =  cms.PSet(
0658         #
0659         idName = cms.string( wpEB.idName ), # same name stored in the _EB and _EE objects
0660         cutFlow = cms.VPSet(
0661             psetMinPtCut(),                                           # pt cut
0662             psetPhoSCEtaMultiRangeCut(),                              # eta cut
0663             psetPhoFull5x5SigmaIEtaIEtaCut(wpEB,wpEE),                # full 5x5 sigmaIEtaIEta cut
0664             psetPhoHcalOverEcalWithEACut(wpEB,wpEE,hOverEInputs),     # H/E cut
0665             psetChgHadIsoWithEAQuadScalingCut(wpEB,wpEE,isoInputs),          # charged hadron isolation cut
0666             psetECalClusIsoWithEAQuadScalingCut(wpEB,wpEE,clusterIsoInputs), # ecal cluster isolation cut
0667             psetHCalClusIsoWithEAQuadScalingCut(wpEB,wpEE,clusterIsoInputs)  # hcal cluster isolation cut
0668             )
0669         )
0670     #
0671     return parameterSet
0672 
0673