def addEScaleSmearing2018(process): process.calibratedPatElectrons102X = calibratedPatElectrons.clone( produceCalibratedObjs=False, correctionFile=cms.string( "tthAnalysis/NanoAOD/data/ScalesSmearings/Run2018_Step2Closure_CoarseEtaR9Gain_v2" ), ) run2_nanoAOD_102Xv1.toModify( process.slimmedElectronsWithUserData.userFloats, ecalTrkEnergyErrPostCorrNew=cms.InputTag("calibratedPatElectrons102X", "ecalTrkEnergyErrPostCorr"), ecalTrkEnergyPreCorrNew=cms.InputTag("calibratedPatElectrons102X", "ecalTrkEnergyPreCorr"), ecalTrkEnergyPostCorrNew=cms.InputTag("calibratedPatElectrons102X", "ecalTrkEnergyPostCorr"), ) run2_nanoAOD_102Xv1.toModify( process.electronTable.variables, pt=Var( "pt*userFloat('ecalTrkEnergyPostCorrNew')/userFloat('ecalTrkEnergyPreCorrNew')", float, precision=-1, doc="p_{T}"), energyErr=Var("userFloat('ecalTrkEnergyErrPostCorrNew')", float, precision=10, doc="energy error of the cluster-track combination"), eCorr=Var( "userFloat('ecalTrkEnergyPostCorrNew')/userFloat('ecalTrkEnergyPreCorrNew')", float, doc="ratio of the calibrated energy/miniaod energy"), ) _with102XScale_sequence = process.electronSequence.copy() _with102XScale_sequence.replace( process.slimmedElectronsWithUserData, process.calibratedPatElectrons102X + process.slimmedElectronsWithUserData) run2_nanoAOD_102Xv1.toReplaceWith(process.electronSequence, _with102XScale_sequence)
run2_miniAOD_80XLegacy.toReplaceWith(electronSequence, _withUpdateAnd80XLegacyScale_sequence) _with94XScale_sequence = electronSequence.copy() _with94XScale_sequence.replace( slimmedElectronsWithUserData, calibratedPatElectrons94X + slimmedElectronsWithUserData) _with94XScale_sequence.replace(bitmapVIDForEle, _updateTo106X_sequence + bitmapVIDForEle) run2_nanoAOD_94XMiniAODv1.toReplaceWith(electronSequence, _with94XScale_sequence) run2_nanoAOD_94XMiniAODv2.toReplaceWith(electronSequence, _with94XScale_sequence) _with_bitmapVIDForEleSpring15AndSum16_sequence = electronSequence.copy() _with_bitmapVIDForEleSpring15AndSum16_sequence.replace( slimmedElectronsWithUserData, bitmapVIDForEleSpring15 + bitmapVIDForEleSum16 + slimmedElectronsWithUserData) _with_bitmapVIDForEleSpring15AndSum16_sequence.replace( bitmapVIDForEle, _updateTo106X_sequence + bitmapVIDForEle) run2_nanoAOD_94X2016.toReplaceWith( electronSequence, _with_bitmapVIDForEleSpring15AndSum16_sequence) _with102XScale_sequence = electronSequence.copy() _with102XScale_sequence.replace(bitmapVIDForEle, _updateTo106X_sequence + bitmapVIDForEle) _with102XScale_sequence.replace( slimmedElectronsWithUserData, calibratedPatElectrons102X + slimmedElectronsWithUserData) run2_nanoAOD_102Xv1.toReplaceWith(electronSequence, _with102XScale_sequence)
_withULAndUpdate_sequence = cms.Sequence(slimmedElectronsUpdated + electronSequence.copy()) _withUL17AndUpdateScale_sequence = _withULAndUpdate_sequence.copy() _withUL17AndUpdateScale_sequence.replace(slimmedElectronsWithUserData, calibratedPatElectronsUL17 + slimmedElectronsWithUserData) run2_egamma_2017.toReplaceWith(electronSequence, _withUL17AndUpdateScale_sequence) _withUL18AndUpdateScale_sequence = _withULAndUpdate_sequence.copy() _withUL18AndUpdateScale_sequence.replace(slimmedElectronsWithUserData, calibratedPatElectronsUL18 + slimmedElectronsWithUserData) run2_egamma_2018.toReplaceWith(electronSequence, _withUL18AndUpdateScale_sequence) _withTo106XAndUpdateAnd80XLegacyScale_sequence = _withTo106XAndUpdate_sequence.copy() _withTo106XAndUpdateAnd80XLegacyScale_sequence.replace(slimmedElectronsWithUserData, calibratedPatElectrons80XLegacy + bitmapVIDForEleSpring15 +bitmapVIDForEleSum16 + slimmedElectronsWithUserData) run2_miniAOD_80XLegacy.toReplaceWith(electronSequence, _withTo106XAndUpdateAnd80XLegacyScale_sequence) _withTo106XAndUpdateAnd94XScale_sequence = _withTo106XAndUpdate_sequence.copy() _withTo106XAndUpdateAnd94XScale_sequence.replace(slimmedElectronsWithUserData, calibratedPatElectrons94X + slimmedElectronsWithUserData) run2_nanoAOD_94XMiniAODv1.toReplaceWith(electronSequence, _withTo106XAndUpdateAnd94XScale_sequence) run2_nanoAOD_94XMiniAODv2.toReplaceWith(electronSequence, _withTo106XAndUpdateAnd94XScale_sequence) _withTo106XAndUpdateAnd_bitmapVIDForEleSpring15AndSum16_sequence = _withTo106XAndUpdate_sequence.copy() _withTo106XAndUpdateAnd_bitmapVIDForEleSpring15AndSum16_sequence.replace(slimmedElectronsWithUserData, bitmapVIDForEleSpring15 + bitmapVIDForEleSum16 + slimmedElectronsWithUserData) run2_nanoAOD_94X2016.toReplaceWith(electronSequence, _withTo106XAndUpdateAnd_bitmapVIDForEleSpring15AndSum16_sequence) _withTo106XAndUpdateAnd102XScale_sequence = _withTo106XAndUpdate_sequence.copy() _withTo106XAndUpdateAnd102XScale_sequence.replace(slimmedElectronsWithUserData, calibratedPatElectrons102X + slimmedElectronsWithUserData) run2_nanoAOD_102Xv1.toReplaceWith(electronSequence, _withTo106XAndUpdateAnd102XScale_sequence) _withUpdate_sequence = electronSequence.copy() _withUpdate_sequence.replace(bitmapVIDForEle, slimmedElectronsUpdated + bitmapVIDForEle) run2_nanoAOD_106Xv1.toReplaceWith(electronSequence, _withUpdate_sequence)
photonMC = cms.Sequence(photonsMCMatchForTable + photonMCTable) from RecoEgamma.EgammaIsolationAlgos.egmPhotonIsolationMiniAOD_cff import egmPhotonIsolation from RecoEgamma.PhotonIdentification.photonIDValueMapProducer_cff import photonIDValueMapProducer _updatePhoTo106X_sequence = cms.Sequence(egmPhotonIsolation + photonIDValueMapProducer + slimmedPhotonsTo106X) _withUpdatePho_sequence = photonSequence.copy() _withUpdatePho_sequence.insert(0, _updatePhoTo106X_sequence) for modifier in run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1: modifier.toReplaceWith(photonSequence, _withUpdatePho_sequence) _with80XScale_sequence = _withUpdatePho_sequence.copy() _with80XScale_sequence.replace( slimmedPhotonsWithUserData, calibratedPatPhotons80XLegacy + slimmedPhotonsWithUserData) run2_miniAOD_80XLegacy.toReplaceWith(photonSequence, _with80XScale_sequence) _with94Xv1Scale_sequence = _withUpdatePho_sequence.copy() _with94Xv1Scale_sequence.replace( slimmedPhotonsWithUserData, calibratedPatPhotons94Xv1 + slimmedPhotonsWithUserData) run2_nanoAOD_94XMiniAODv1.toReplaceWith(photonSequence, _with94Xv1Scale_sequence) _with102Xv1Scale_sequence = photonSequence.copy() _with102Xv1Scale_sequence.replace( slimmedPhotonsWithUserData, calibratedPatPhotons102Xv1 + slimmedPhotonsWithUserData) run2_nanoAOD_102Xv1.toReplaceWith(photonSequence, _with102Xv1Scale_sequence)
modifier.toModify(calibratedPatPhotons80XLegacy, src = "slimmedPhotonsTo106X") modifier.toModify(slimmedPhotonsWithUserData, src = "slimmedPhotonsTo106X") modifier.toModify(seedGainPho, src = "slimmedPhotonsTo106X") photonSequence = cms.Sequence(bitmapVIDForPho + isoForPho + seedGainPho + slimmedPhotonsWithUserData + finalPhotons) photonTables = cms.Sequence ( photonTable) photonMC = cms.Sequence(photonsMCMatchForTable + photonMCTable) from RecoEgamma.EgammaIsolationAlgos.egmPhotonIsolationMiniAOD_cff import egmPhotonIsolation from RecoEgamma.PhotonIdentification.photonIDValueMapProducer_cff import photonIDValueMapProducer _updatePhoTo106X_sequence =cms.Sequence(egmPhotonIsolation + photonIDValueMapProducer + slimmedPhotonsTo106X) _withUpdatePho_sequence = photonSequence.copy() _withUpdatePho_sequence.insert(0,_updatePhoTo106X_sequence) for modifier in run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016 ,run2_nanoAOD_102Xv1: modifier.toReplaceWith(photonSequence, _withUpdatePho_sequence) _with80XScale_sequence = _withUpdatePho_sequence.copy() _with80XScale_sequence.replace(slimmedPhotonsWithUserData, calibratedPatPhotons80XLegacy + slimmedPhotonsWithUserData) run2_miniAOD_80XLegacy.toReplaceWith(photonSequence, _with80XScale_sequence) _with94Xv1Scale_sequence = _withUpdatePho_sequence.copy() _with94Xv1Scale_sequence.replace(slimmedPhotonsWithUserData, calibratedPatPhotons94Xv1 + slimmedPhotonsWithUserData) run2_nanoAOD_94XMiniAODv1.toReplaceWith(photonSequence, _with94Xv1Scale_sequence) _with102Xv1Scale_sequence = photonSequence.copy() _with102Xv1Scale_sequence.replace(slimmedPhotonsWithUserData, calibratedPatPhotons102Xv1 + slimmedPhotonsWithUserData) run2_nanoAOD_102Xv1.toReplaceWith(photonSequence, _with102Xv1Scale_sequence)