Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-29 23:10:57

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