Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-24 04:45:08

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 #electron mva ids
0004 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_GeneralPurpose_V1_cff as ele_spring16_gp_v1
0005 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_HZZ_V1_cff as ele_spring16_hzz_v1
0006 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V1_cff as ele_fall17_iso_v1
0007 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V1_cff as ele_fall17_noIso_v1
0008 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V2_cff as ele_fall17_iso_v2
0009 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V2_cff as ele_fall17_noIso_v2
0010 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer18UL_ID_ISO_cff as ele_summer18UL_hzz
0011 
0012 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_RunIIIWinter22_iso_V1_cff as ele_RunIIIWinter22_iso_v1
0013 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_RunIIIWinter22_noIso_V1_cff as ele_RunIIIWinter22_noIso_v1
0014 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Winter22_HZZ_V1_cff as ele_Winter22_HZZ_V1
0015 
0016 #photon mva ids
0017 import RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff as pho_spring16_nt_v1
0018 import RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V1p1_cff as pho_fall17_94X_v1p1
0019 import RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V2_cff as pho_fall17_94X_v2
0020 import RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Winter22_122X_V1_cff as pho_winter22_122X_v1
0021 
0022 
0023 ele_mva_prod_name = 'electronMVAValueMapProducer'
0024 pho_mva_prod_name = 'photonMVAValueMapProducer'
0025 
0026 def setup_mva(val_pset,cat_pset,prod_name,mva_name):
0027     value_name = '%s:%sValues'%(prod_name,mva_name)
0028     cat_name   = '%s:%sCategories'%(prod_name,mva_name)
0029     setattr( val_pset, '%sValues'%mva_name, cms.InputTag(value_name) )
0030     setattr( cat_pset, '%sCategories'%mva_name, cms.InputTag(cat_name) )
0031 
0032 egamma_modifications = cms.VPSet(
0033     cms.PSet( modifierName    = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
0034               electron_config = cms.PSet( ),
0035               photon_config   = cms.PSet( )
0036               ),
0037     cms.PSet( modifierName    = cms.string('EGExtraInfoModifierFromIntValueMaps'),
0038               electron_config = cms.PSet( ),
0039               photon_config   = cms.PSet( )
0040               )
0041 )
0042 
0043 #setup the mva value maps to embed
0044 for ele_mva_cff in [
0045           ele_spring16_gp_v1,
0046           ele_spring16_hzz_v1,
0047           ele_fall17_iso_v1,
0048           ele_fall17_noIso_v1,
0049           ele_fall17_iso_v2,
0050           ele_fall17_noIso_v2,
0051           ele_summer18UL_hzz,
0052           ele_RunIIIWinter22_iso_v1,
0053           ele_RunIIIWinter22_noIso_v1,
0054           ele_Winter22_HZZ_V1
0055         ]:
0056 
0057     setup_mva(egamma_modifications[0].electron_config,
0058               egamma_modifications[1].electron_config,
0059               ele_mva_prod_name,
0060               ele_mva_cff.mvaClassName + ele_mva_cff.mvaTag)
0061 
0062 for pho_mva_cff in [
0063           pho_spring16_nt_v1,
0064           pho_fall17_94X_v1p1,
0065           pho_fall17_94X_v2,
0066           pho_winter22_122X_v1
0067         ]:
0068 
0069     setup_mva(egamma_modifications[0].photon_config,
0070               egamma_modifications[1].photon_config,
0071               pho_mva_prod_name,
0072               pho_mva_cff.mvaClassName + pho_mva_cff.mvaTag)
0073 
0074 #############################################################
0075 # REGRESSION MODIFIERS
0076 #############################################################
0077 
0078 #from RecoEgamma.EgammaTools.regressionModifier_cfi import *
0079 
0080 #egamma_modifications.append( regressionModifier )
0081 
0082 #############################################################
0083 # Scale and Smearing Modifiers
0084 #############################################################
0085 reducedEgammaEnergyScaleAndSmearingModifier = cms.PSet(
0086     modifierName    = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
0087     electron_config = cms.PSet(),
0088     photon_config   = cms.PSet()
0089 )
0090 from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
0091 import RecoEgamma.EgammaTools.calibratedElectronProducer_cfi
0092 for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducer_cfi.calibratedElectronProducer.valueMapsStored:
0093     setattr(reducedEgammaEnergyScaleAndSmearingModifier.electron_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibEle",valueMapName)))
0094 
0095 import RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi
0096 for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi.calibratedPhotonProducer.valueMapsStored:
0097     setattr(reducedEgammaEnergyScaleAndSmearingModifier.photon_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibPho",valueMapName)))
0098 
0099 #############################################################
0100 # 8X to 9X modifiers (fills in variables new to 9X w.r.t 8X)
0101 #############################################################
0102 egamma8XObjectUpdateModifier = cms.PSet(
0103     modifierName  = cms.string('EG8XObjectUpdateModifier'),
0104     ecalRecHitsEB = cms.InputTag("reducedEgamma","reducedEBRecHits"),
0105     ecalRecHitsEE = cms.InputTag("reducedEgamma","reducedEERecHits"),
0106 )
0107 
0108 #############################################################
0109 # 9X-106X to 106X modifiers (fills in variables new to 106X w.r.t 9X-105X)
0110 #############################################################
0111 egamma9X105XUpdateModifier = cms.PSet( 
0112     modifierName    = cms.string('EG9X105XObjectUpdateModifier'),
0113     eleCollVMsAreKeyedTo = cms.InputTag("slimmedElectrons",processName=cms.InputTag.skipCurrentProcess()),
0114     phoCollVMsAreKeyedTo = cms.InputTag("slimmedPhotons",processName=cms.InputTag.skipCurrentProcess()),
0115     conversions = cms.InputTag("reducedEgamma","reducedConversions"),
0116     beamspot = cms.InputTag("offlineBeamSpot"),
0117     ecalRecHitsEB = cms.InputTag("reducedEgamma","reducedEBRecHits"),
0118     ecalRecHitsEE = cms.InputTag("reducedEgamma","reducedEERecHits"),
0119     eleTrkIso = cms.InputTag("heepIDVarValueMaps","eleTrkPtIso"),
0120     eleTrkIso04 = cms.InputTag("heepIDVarValueMaps","eleTrkPtIso04"),
0121     phoPhotonIso = cms.InputTag("photonIDValueMapProducer","phoPhotonIsolation"),
0122     phoNeutralHadIso = cms.InputTag("photonIDValueMapProducer","phoNeutralHadronIsolation"),
0123     phoChargedHadIso = cms.InputTag("photonIDValueMapProducer","phoChargedIsolation"),
0124     phoChargedHadWorstVtxIso = cms.InputTag("photonIDValueMapProducer","phoWorstChargedIsolation"),
0125     phoChargedHadWorstVtxConeVetoIso = cms.InputTag("photonIDValueMapProducer","phoWorstChargedIsolationConeVeto"),
0126     phoChargedHadPFPVIso = cms.InputTag("egmPhotonIsolation","h+-DR030-"),
0127     allowGsfTrackForConvs = cms.bool(False),
0128     updateChargedHadPFPVIso = cms.bool(True)
0129 )
0130 
0131 #############################################################
0132 # 8X legacy needs an extra Et scale systematic
0133 # due to an inflection around 45 GeV which is handled as a
0134 # patch on top of the standard scale and smearing systematics
0135 #############################################################
0136 from RecoEgamma.EgammaTools.calibratedEgammas_cff import ecalTrkCombinationRegression
0137 egamma8XLegacyEtScaleSysModifier = cms.PSet(
0138     modifierName = cms.string('EGEtScaleSysModifier'),
0139     epCombConfig = ecalTrkCombinationRegression,
0140     uncertFunc = cms.PSet(
0141         name = cms.string("UncertFuncV1"),
0142         lowEt = cms.double(43.5),
0143         highEt = cms.double(46.5),
0144         lowEtUncert = cms.double(0.002),
0145         highEtUncert = cms.double(-0.002)
0146         )
0147     )
0148 
0149 # modifier for photon isolation used in heavy ions
0150 egammaHIPhotonIsolationModifier = cms.PSet(
0151     modifierName = cms.string('EGExtraInfoModifierFromHIPhotonIsolationValueMaps'),
0152     electron_config = cms.PSet(),
0153     photon_config = cms.PSet(
0154         photonIsolationHI = cms.InputTag("reducedEgamma:photonIsolationHIProducerppGED")
0155         )
0156     )
0157 
0158 photonDRNModifier = cms.PSet(
0159       modifierName = cms.string("EGRegressionModifierDRN"),
0160       patPhotons = cms.PSet(
0161           source = cms.InputTag("selectedPatPhotons"),
0162           correctionsSource = cms.InputTag('patPhotonsDRN'),
0163           energyFloat = cms.string("energyDRN"),
0164           resFloat = cms.string("resolutionDRN")
0165         )
0166     )
0167 
0168 def appendReducedEgammaEnergyScaleAndSmearingModifier(modifiers):
0169     modifiers.append(reducedEgammaEnergyScaleAndSmearingModifier)
0170 
0171 
0172 def appendEgammaHIPhotonIsolationModifier(modifiers):
0173     modifiers.append(egammaHIPhotonIsolationModifier)
0174 
0175 def appendPhotonDRNModifier(modifiers):
0176     modifiers.append(photonDRNModifier)
0177 
0178 from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL
0179 (run2_miniAOD_UL).toModify(egamma_modifications,appendReducedEgammaEnergyScaleAndSmearingModifier)
0180  
0181 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
0182 pp_on_AA.toModify(egamma_modifications, appendEgammaHIPhotonIsolationModifier)
0183 
0184 from Configuration.ProcessModifiers.photonDRN_cff import _photonDRN
0185 _photonDRN.toModify(egamma_modifications, appendPhotonDRNModifier)