diff --git a/Configuration/Eras/python/Modifier_run2_nanoAOD_LowPU_cff.py b/Configuration/Eras/python/Modifier_run2_nanoAOD_LowPU_cff.py new file mode 100644 index 0000000000000..3f70268239f60 --- /dev/null +++ b/Configuration/Eras/python/Modifier_run2_nanoAOD_LowPU_cff.py @@ -0,0 +1,3 @@ +import FWCore.ParameterSet.Config as cms + +run2_nanoAOD_LowPU = cms.Modifier() diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index b42373f49c005..dcb7319f0fb19 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -62,7 +62,7 @@ def __init__(self): 'trackingLowPU', 'trackingPhase1', 'ctpps_2016', 'trackingPhase2PU140','highBetaStar_2018', 'tracker_apv_vfp30_2016', 'pf_badHcalMitigation', 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_92X', 'run2_nanoAOD_94XMiniAODv1', 'run2_nanoAOD_94XMiniAODv2', 'run2_nanoAOD_94X2016', - 'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', + 'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', 'run2_nanoAOD_LowPU', 'run2_tau_ul_2016', 'run2_tau_ul_2018', 'hcalHardcodeConditions', 'hcalSkipPacker', 'run2_HLTconditions_2016','run2_HLTconditions_2017','run2_HLTconditions_2018', diff --git a/PhysicsTools/NanoAOD/data/ScalesSmearings/Run2017_LowPU_v2_scales.dat b/PhysicsTools/NanoAOD/data/ScalesSmearings/Run2017_LowPU_v2_scales.dat new file mode 100644 index 0000000000000..66ded21bb5d7a --- /dev/null +++ b/PhysicsTools/NanoAOD/data/ScalesSmearings/Run2017_LowPU_v2_scales.dat @@ -0,0 +1,48 @@ +absEta_0_1-R9_0.940_1.000-gainEle_12 runNumber 307042 307063 1.002 0.00059 0.0 0.00086 0.0 +absEta_0_1-R9_0.000_0.940-gainEle_12 runNumber 307042 307063 1.0053 0.00059 0.0 0.00068 0.0 +absEta_0_1-R9_0.940_1.000-gainEle_12 runNumber 306929 306929 1.0099 0.00542 0.0 0.00086 0.0 +absEta_0_1-R9_0.000_0.940-gainEle_12 runNumber 306929 306929 1.0132 0.00542 0.0 0.00068 0.0 +absEta_0_1-R9_0.940_1.000-gainEle_12 runNumber 307082 307082 1.0016 0.001 0.0 0.00086 0.0 +absEta_0_1-R9_0.000_0.940-gainEle_12 runNumber 307082 307082 1.0049 0.001 0.0 0.00068 0.0 +absEta_0_1-R9_0.940_1.000-gainEle_12 runNumber 306936 306936 1.0055 0.001 0.0 0.00086 0.0 +absEta_0_1-R9_0.000_0.940-gainEle_12 runNumber 306936 306936 1.0088 0.001 0.0 0.00068 0.0 +absEta_0_1-R9_0.940_1.000-gainEle_12 runNumber 307073 307076 1.0018 0.00083 0.0 0.00086 0.0 +absEta_0_1-R9_0.000_0.940-gainEle_12 runNumber 307073 307076 1.0051 0.00083 0.0 0.00068 0.0 +absEta_0_1-R9_0.940_1.000-gainEle_12 runNumber 307014 307017 1.0017 0.00074 0.0 0.00086 0.0 +absEta_0_1-R9_0.000_0.940-gainEle_12 runNumber 307014 307017 1.005 0.00074 0.0 0.00068 0.0 +absEta_1.566_2-R9_0.940_1.000-gainEle_12 runNumber 307042 307063 1.0195 0.00205 0.0 0.00122 0.0 +absEta_1.566_2-R9_0.000_0.940-gainEle_12 runNumber 307042 307063 1.0292 0.00205 0.0 0.00152 0.0 +absEta_1.566_2-R9_0.940_1.000-gainEle_12 runNumber 306929 306929 1.0175 0.01018 0.0 0.00122 0.0 +absEta_1.566_2-R9_0.000_0.940-gainEle_12 runNumber 306929 306929 1.0272 0.01018 0.0 0.00152 0.0 +absEta_1.566_2-R9_0.940_1.000-gainEle_12 runNumber 307082 307082 1.0165 0.00403 0.0 0.00122 0.0 +absEta_1.566_2-R9_0.000_0.940-gainEle_12 runNumber 307082 307082 1.0262 0.00403 0.0 0.00152 0.0 +absEta_1.566_2-R9_0.940_1.000-gainEle_12 runNumber 306936 306936 1.0197 0.00332 0.0 0.00122 0.0 +absEta_1.566_2-R9_0.000_0.940-gainEle_12 runNumber 306936 306936 1.0294 0.00332 0.0 0.00152 0.0 +absEta_1.566_2-R9_0.940_1.000-gainEle_12 runNumber 307073 307076 1.0162 0.00266 0.0 0.00122 0.0 +absEta_1.566_2-R9_0.000_0.940-gainEle_12 runNumber 307073 307076 1.0259 0.00266 0.0 0.00152 0.0 +absEta_1.566_2-R9_0.940_1.000-gainEle_12 runNumber 307014 307017 1.015 0.00268 0.0 0.00122 0.0 +absEta_1.566_2-R9_0.000_0.940-gainEle_12 runNumber 307014 307017 1.0247 0.00268 0.0 0.00152 0.0 +absEta_1_1.4442-R9_0.000_0.940-gainEle_12 runNumber 307042 307063 1.0024 0.00194 0.0 0.00049 0.0 +absEta_1_1.4442-R9_0.940_1.000-gainEle_12 runNumber 307042 307063 0.9958 0.00194 0.0 0.0017 0.0 +absEta_1_1.4442-R9_0.000_0.940-gainEle_12 runNumber 306929 306929 1.0035 0.02043 0.0 0.00049 0.0 +absEta_1_1.4442-R9_0.940_1.000-gainEle_12 runNumber 306929 306929 0.9969 0.02043 0.0 0.0017 0.0 +absEta_1_1.4442-R9_0.000_0.940-gainEle_12 runNumber 307082 307082 1.0056 0.00407 0.0 0.00049 0.0 +absEta_1_1.4442-R9_0.940_1.000-gainEle_12 runNumber 307082 307082 0.999 0.00407 0.0 0.0017 0.0 +absEta_1_1.4442-R9_0.000_0.940-gainEle_12 runNumber 306936 306936 1.0087 0.003 0.0 0.00049 0.0 +absEta_1_1.4442-R9_0.940_1.000-gainEle_12 runNumber 306936 306936 1.0021 0.003 0.0 0.0017 0.0 +absEta_1_1.4442-R9_0.000_0.940-gainEle_12 runNumber 307073 307076 1.0056 0.00312 0.0 0.00049 0.0 +absEta_1_1.4442-R9_0.940_1.000-gainEle_12 runNumber 307073 307076 0.999 0.00312 0.0 0.0017 0.0 +absEta_1_1.4442-R9_0.000_0.940-gainEle_12 runNumber 307014 307017 1.0014 0.00234 0.0 0.00049 0.0 +absEta_1_1.4442-R9_0.940_1.000-gainEle_12 runNumber 307014 307017 0.9948 0.00234 0.0 0.0017 0.0 +absEta_2_2.5-R9_0.000_0.940-gainEle_12 runNumber 307082 307082 1.0367 0.0044 0.0 0.00198 0.0 +absEta_2_2.5-R9_0.940_1.000-gainEle_12 runNumber 307082 307082 1.0224 0.0044 0.0 0.00223 0.0 +absEta_2_2.5-R9_0.000_0.940-gainEle_12 runNumber 306929 306929 1.0196 0.01017 0.0 0.00198 0.0 +absEta_2_2.5-R9_0.940_1.000-gainEle_12 runNumber 306929 306929 1.0056 0.01017 0.0 0.00223 0.0 +absEta_2_2.5-R9_0.000_0.940-gainEle_12 runNumber 306936 306936 1.0351 0.00371 0.0 0.00198 0.0 +absEta_2_2.5-R9_0.940_1.000-gainEle_12 runNumber 306936 306936 1.0208 0.00371 0.0 0.00223 0.0 +absEta_2_2.5-R9_0.000_0.940-gainEle_12 runNumber 307073 307076 1.0362 0.00349 0.0 0.00198 0.0 +absEta_2_2.5-R9_0.940_1.000-gainEle_12 runNumber 307073 307076 1.0219 0.00349 0.0 0.00223 0.0 +absEta_2_2.5-R9_0.000_0.940-gainEle_12 runNumber 307014 307017 1.036 0.003 0.0 0.00198 0.0 +absEta_2_2.5-R9_0.940_1.000-gainEle_12 runNumber 307014 307017 1.0217 0.003 0.0 0.00223 0.0 +absEta_2_2.5-R9_0.000_0.940-gainEle_12 runNumber 307042 307063 1.0438 0.00226 0.0 0.00198 0.0 +absEta_2_2.5-R9_0.940_1.000-gainEle_12 runNumber 307042 307063 1.0294 0.00226 0.0 0.00223 0.0 diff --git a/PhysicsTools/NanoAOD/data/ScalesSmearings/Run2017_LowPU_v2_smearings.dat b/PhysicsTools/NanoAOD/data/ScalesSmearings/Run2017_LowPU_v2_smearings.dat new file mode 100644 index 0000000000000..9aa7cd652f618 --- /dev/null +++ b/PhysicsTools/NanoAOD/data/ScalesSmearings/Run2017_LowPU_v2_smearings.dat @@ -0,0 +1,9 @@ +#category Emean err_Emean rho err_rho phi err_phi +absEta_0_1-R9_0.940_1.000 6.60 0 0.0155 0.003339 M_PI_2 M_PI_2 +absEta_0_1-R9_0.000_0.940 6.73 0 0.0163 0.001009 M_PI_2 M_PI_2 +absEta_1_1.4442-R9_0.940_1.000 6.76 0 0.0196 0.005245 M_PI_2 M_PI_2 +absEta_1_1.4442-R9_0.000_0.940 6.77 0 0.024266 0.000458 M_PI_2 M_PI_2 +absEta_1.566_2-R9_0.940_1.000 6.52 0 0.028676 0.001985 M_PI_2 M_PI_2 +absEta_1.566_2-R9_0.000_0.940 6.72 0 0.030133 0.002296 M_PI_2 M_PI_2 +absEta_2_2.5-R9_0.940_1.000 6.54 0 0.03625 0.000041 M_PI_2 M_PI_2 +absEta_2_2.5-R9_0.000_0.940 6.73 0 0.034610 0.001928 M_PI_2 M_PI_2 diff --git a/PhysicsTools/NanoAOD/data/deepmetmodel/deepmet_lowPU.pb b/PhysicsTools/NanoAOD/data/deepmetmodel/deepmet_lowPU.pb new file mode 100644 index 0000000000000..e001790adb1e9 Binary files /dev/null and b/PhysicsTools/NanoAOD/data/deepmetmodel/deepmet_lowPU.pb differ diff --git a/PhysicsTools/NanoAOD/data/deepmetmodel/deepmet_lowPU_Resp.pb b/PhysicsTools/NanoAOD/data/deepmetmodel/deepmet_lowPU_Resp.pb new file mode 100644 index 0000000000000..e66193bad62f1 Binary files /dev/null and b/PhysicsTools/NanoAOD/data/deepmetmodel/deepmet_lowPU_Resp.pb differ diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index 0299739056b0e..2a9346d75efe4 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -8,6 +8,8 @@ from Configuration.Eras.Modifier_run2_nanoAOD_106Xv1_cff import run2_nanoAOD_106Xv1 from Configuration.Eras.Modifier_run2_egamma_2017_cff import run2_egamma_2017 from Configuration.Eras.Modifier_run2_egamma_2018_cff import run2_egamma_2018 +from Configuration.Eras.Modifier_run2_nanoAOD_LowPU_cff import run2_nanoAOD_LowPU + from PhysicsTools.NanoAOD.common_cff import * import PhysicsTools.PatAlgos.producersLayer1.electronProducer_cfi @@ -47,7 +49,7 @@ run2_egamma_2018.toModify(slimmedElectronsUpdated, src = cms.InputTag("slimmedElectrons")) run2_nanoAOD_106Xv1.toModify(slimmedElectronsUpdated, src = cms.InputTag("slimmedElectrons")) ####because run2_egamma_2017 and run2_egamma_2018 can modify things further, need the following line to resort back -for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1: +for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1,run2_nanoAOD_LowPU: modifier.toModify(slimmedElectronsUpdated, src = cms.InputTag("slimmedElectronsTo106X")) @@ -136,7 +138,7 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): _bitmapVIDForEleHEEP_docstring = _get_bitmapVIDForEle_docstring(electron_id_modules_WorkingPoints_nanoAOD.modules,bitmapVIDForEleHEEP.WorkingPoints) -for modifier in run2_egamma_2017,run2_egamma_2018,run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: +for modifier in run2_egamma_2017,run2_egamma_2018,run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1,run2_nanoAOD_LowPU: modifier.toModify(bitmapVIDForEle, src = "slimmedElectronsUpdated") modifier.toModify(bitmapVIDForEleSpring15, src = "slimmedElectronsUpdated") modifier.toModify(bitmapVIDForEleSum16, src = "slimmedElectronsUpdated") @@ -157,7 +159,7 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): run2_nanoAOD_94X2016.toModify(isoForEle, EAFile_MiniIso = "RecoEgamma/ElectronIdentification/data/Spring15/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_25ns.txt", EAFile_PFIso = "RecoEgamma/ElectronIdentification/data/Summer16/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_80X.txt") -for modifier in run2_egamma_2017,run2_egamma_2018,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: +for modifier in run2_egamma_2017,run2_egamma_2018,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1,run2_nanoAOD_LowPU: modifier.toModify(isoForEle, src = "slimmedElectronsUpdated") ptRatioRelForEle = cms.EDProducer("ElectronJetVarProducer", @@ -165,11 +167,11 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): srcLep = cms.InputTag("slimmedElectrons"), srcVtx = cms.InputTag("offlineSlimmedPrimaryVertices"), ) -for modifier in run2_egamma_2017,run2_egamma_2018,run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: +for modifier in run2_egamma_2017,run2_egamma_2018,run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1,run2_nanoAOD_LowPU: modifier.toModify(ptRatioRelForEle, srcLep = "slimmedElectronsUpdated") seedGainEle = cms.EDProducer("ElectronSeedGainProducer", src = cms.InputTag("slimmedElectrons")) -for modifier in run2_egamma_2017,run2_egamma_2018,run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: +for modifier in run2_egamma_2017,run2_egamma_2018,run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1,run2_nanoAOD_LowPU: modifier.toModify(seedGainEle, src = "slimmedElectronsUpdated") import RecoEgamma.EgammaTools.calibratedEgammas_cff @@ -205,6 +207,13 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): ) run2_nanoAOD_102Xv1.toModify(calibratedPatElectrons102X, src = "slimmedElectronsUpdated") +# use the dedicated electron energy and scale corrections +calibratedPatElectronsLowPU = RecoEgamma.EgammaTools.calibratedEgammas_cff.calibratedPatElectrons.clone( + produceCalibratedObjs = False, + correctionFile = cms.string("PhysicsTools/NanoAOD/data/ScalesSmearings/Run2017_LowPU_v2"), +) +run2_nanoAOD_LowPU.toModify(calibratedPatElectronsLowPU, src = "slimmedElectronsUpdated") + slimmedElectronsWithUserData = cms.EDProducer("PATElectronUserDataEmbedder", src = cms.InputTag("slimmedElectrons"), userFloats = cms.PSet( @@ -256,7 +265,7 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): jetForLepJetVar = cms.InputTag("ptRatioRelForEle:jetForLepJetVar") # warning: Ptr is null if no match is found ), ) -for modifier in run2_egamma_2017,run2_egamma_2018,run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: +for modifier in run2_egamma_2017,run2_egamma_2018,run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1,run2_nanoAOD_LowPU: modifier.toModify(slimmedElectronsWithUserData, src = "slimmedElectronsUpdated") run2_egamma_2017.toModify(slimmedElectronsWithUserData.userFloats, @@ -296,6 +305,14 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): ecalTrkEnergyPostCorrNew = cms.InputTag("calibratedPatElectrons94X","ecalTrkEnergyPostCorr"), ) +run2_nanoAOD_LowPU.toModify(slimmedElectronsWithUserData.userFloats, + ecalTrkEnergyErrPostCorrNew = cms.InputTag("calibratedPatElectronsLowPU","ecalTrkEnergyErrPostCorr"), + ecalTrkEnergyPreCorrNew = cms.InputTag("calibratedPatElectronsLowPU","ecalTrkEnergyPreCorr"), + ecalTrkEnergyPostCorrNew = cms.InputTag("calibratedPatElectronsLowPU","ecalTrkEnergyPostCorr"), + ecalEnergyPreCorrNew = cms.InputTag("calibratedPatElectronsLowPU","ecalEnergyPreCorr"), + ecalEnergyPostCorrNew = cms.InputTag("calibratedPatElectronsLowPU","ecalEnergyPostCorr"), +) + run2_nanoAOD_102Xv1.toModify(slimmedElectronsWithUserData.userFloats, ecalTrkEnergyErrPostCorrNew = cms.InputTag("calibratedPatElectrons102X","ecalTrkEnergyErrPostCorr"), ecalTrkEnergyPreCorrNew = cms.InputTag("calibratedPatElectrons102X","ecalTrkEnergyPreCorr"), @@ -442,7 +459,7 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): #the94X miniAOD V2 had a bug in the scale and smearing for electrons in the E/p comb #therefore we redo it but but we need use a new name for the userFloat as we cant override existing userfloats #for technical reasons -for modifier in run2_egamma_2017,run2_egamma_2018,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_miniAOD_80XLegacy,run2_nanoAOD_102Xv1: +for modifier in run2_egamma_2017,run2_egamma_2018,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_miniAOD_80XLegacy,run2_nanoAOD_102Xv1,run2_nanoAOD_LowPU: modifier.toModify(electronTable.variables, pt = Var("pt*userFloat('ecalTrkEnergyPostCorrNew')/userFloat('ecalTrkEnergyPreCorrNew')", float, precision=-1, doc="p_{T}"), energyErr = Var("userFloat('ecalTrkEnergyErrPostCorrNew')", float, precision=6, doc="energy error of the cluster-track combination"), @@ -450,6 +467,11 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): scEtOverPt = Var("(superCluster().energy()/(pt*userFloat('ecalTrkEnergyPostCorrNew')/userFloat('ecalTrkEnergyPreCorrNew')*cosh(superCluster().eta())))-1",float,doc="(supercluster transverse energy)/pt-1",precision=8), ) +run2_nanoAOD_LowPU.toModify(electronTable.variables, + ecalCorr = Var("userFloat('ecalEnergyPostCorrNew')/userFloat('ecalEnergyPreCorrNew')",float, doc="ratio of the calibrated ecal energy / miniaod ecal energy"), + pfIso03_all = Var("userFloat('PFIsoAll')",float,doc="PF isolation dR=0.3, total (with rho*EA PU corrections)"), +) + # scale and smearing only when available for modifier in run2_nanoAOD_94X2016,: modifier.toModify(electronTable.variables, @@ -548,6 +570,10 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): run2_nanoAOD_94XMiniAODv1.toReplaceWith(electronSequence, _withTo106XAndUpdateAnd94XScale_sequence) run2_nanoAOD_94XMiniAODv2.toReplaceWith(electronSequence, _withTo106XAndUpdateAnd94XScale_sequence) +_withTo106XAndUpdateAndLowPUScale_sequence = _withTo106XAndUpdate_sequence.copy() +_withTo106XAndUpdateAndLowPUScale_sequence.replace(slimmedElectronsWithUserData, calibratedPatElectronsLowPU + slimmedElectronsWithUserData) +run2_nanoAOD_LowPU.toReplaceWith(electronSequence, _withTo106XAndUpdateAndLowPUScale_sequence) + _withTo106XAndUpdateAnd_bitmapVIDForEleSpring15AndSum16_sequence = _withTo106XAndUpdate_sequence.copy() _withTo106XAndUpdateAnd_bitmapVIDForEleSpring15AndSum16_sequence.replace(slimmedElectronsWithUserData, bitmapVIDForEleSpring15 + bitmapVIDForEleSum16 + slimmedElectronsWithUserData) run2_nanoAOD_94X2016.toReplaceWith(electronSequence, _withTo106XAndUpdateAnd_bitmapVIDForEleSpring15AndSum16_sequence) diff --git a/PhysicsTools/NanoAOD/python/extraflags_cff.py b/PhysicsTools/NanoAOD/python/extraflags_cff.py index 6d782122f8bec..d8c4374da0bb0 100644 --- a/PhysicsTools/NanoAOD/python/extraflags_cff.py +++ b/PhysicsTools/NanoAOD/python/extraflags_cff.py @@ -1,4 +1,5 @@ import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Modifier_run2_nanoAOD_LowPU_cff import run2_nanoAOD_LowPU from PhysicsTools.NanoAOD.common_cff import * # Bad/clone muon filters - tagging mode to keep the event @@ -40,8 +41,10 @@ extraFlagsProducers = cms.Sequence(badGlobalMuonTagger + cloneGlobalMuonTagger + BadPFMuonTagger + BadChargedCandidateTagger) from RecoMET.METFilters.ecalBadCalibFilter_cfi import * +run2_nanoAOD_LowPU.toModify(ecalBadCalibFilter, EcalRecHitSource = 'reducedEgamma:reducedEERecHits') + ecalBadCalibFilterNanoTagger = ecalBadCalibFilter.clone( - taggingMode = cms.bool(True) + taggingMode = cms.bool(True), ) extraFlagsProducers102x = cms.Sequence(ecalBadCalibFilterNanoTagger) diff --git a/PhysicsTools/NanoAOD/python/muons_cff.py b/PhysicsTools/NanoAOD/python/muons_cff.py index c6e15af57f762..3079f6729e46e 100644 --- a/PhysicsTools/NanoAOD/python/muons_cff.py +++ b/PhysicsTools/NanoAOD/python/muons_cff.py @@ -4,6 +4,7 @@ from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff import run2_nanoAOD_94X2016 from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv2_cff import run2_nanoAOD_94XMiniAODv2 +from Configuration.Eras.Modifier_run2_nanoAOD_LowPU_cff import run2_nanoAOD_LowPU from Configuration.Eras.Modifier_run2_nanoAOD_102Xv1_cff import run2_nanoAOD_102Xv1 from PhysicsTools.NanoAOD.common_cff import * import PhysicsTools.PatAlgos.producersLayer1.muonProducer_cfi @@ -243,9 +244,11 @@ ) -for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: +for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_LowPU: modifier.toModify(muonTable.variables, puppiIsoId = None, softMva = None) +run2_nanoAOD_LowPU.toModify(muonTable, externalVariables = cms.PSet()) + run2_nanoAOD_102Xv1.toModify(muonTable.variables, puppiIsoId = None) @@ -274,3 +277,5 @@ muonMC = cms.Sequence(muonsMCMatchForTable + muonMCTable) muonTables = cms.Sequence(muonFSRphotons + muonFSRassociation + muonMVATTH + muonMVALowPt + geopro + tracksfrommuons + trackrefit + trackrefitbs + muonTable + muonExternalVecVarsTable + fsrTable) +run2_nanoAOD_LowPU.toReplaceWith(muonTables, muonTables.copyAndExclude([geopro, tracksfrommuons, trackrefit, trackrefitbs, muonExternalVecVarsTable])) + diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 285f62adc12b3..d2b6024370acd 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -31,6 +31,7 @@ from Configuration.Eras.Modifier_run2_tau_ul_2018_cff import run2_tau_ul_2018 from Configuration.Eras.Modifier_run2_egamma_2017_cff import run2_egamma_2017 from Configuration.Eras.Modifier_run2_egamma_2018_cff import run2_egamma_2018 +from Configuration.Eras.Modifier_run2_nanoAOD_LowPU_cff import run2_nanoAOD_LowPU nanoMetadata = cms.EDProducer("UniqueStringProducer", strings = cms.PSet( @@ -110,7 +111,7 @@ l1bits=cms.EDProducer("L1TriggerResultsConverter", src=cms.InputTag("gtStage2Digis"), legacyL1=cms.bool(False), storeUnprefireableBit=cms.bool(True), src_ext=cms.InputTag("gtStage2Digis")) -(run2_miniAOD_80XLegacy | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1).toModify(l1bits, storeUnprefireableBit=False) +(run2_miniAOD_80XLegacy | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_LowPU).toModify(l1bits, storeUnprefireableBit=False) nanoSequenceCommon = cms.Sequence( nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+ @@ -133,7 +134,7 @@ nanoSequenceMC.insert(nanoSequenceFS.index(nanoSequenceCommon)+1,nanoSequenceOnlyFullSim) # modify extraFlagsTable to store ecalBadCalibFilter decision which is re-run with updated bad crystal list for 2017 and 2018 samples -for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_102Xv1: +for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_102Xv1, run2_nanoAOD_LowPU: modifier.toModify(extraFlagsTable, variables= cms.PSet()) modifier.toModify(extraFlagsTable, variables = dict(Flag_ecalBadCalibFilterV2 = ExtVar(cms.InputTag("ecalBadCalibFilterNanoTagger"), bool, doc = "Bad ECAL calib flag (updated xtal list)"))) @@ -200,6 +201,12 @@ def nanoAOD_recalibrateMETs(process,isData): process = nanoAOD_addDeepMET(process, addDeepMETProducer=nanoAOD_DeepMET_switch.nanoAOD_produceDeepMET_switch, ResponseTune_Graph=nanoAOD_DeepMET_switch.ResponseTune_Graph) + # modify the graph for the low PU era + run2_nanoAOD_LowPU.toModify(process.deepMETsResolutionTune, graph_path='PhysicsTools/NanoAOD/data/deepmetmodel/deepmet_lowPU.pb') + run2_nanoAOD_LowPU.toModify(process.deepMETsResponseTune, graph_path='PhysicsTools/NanoAOD/data/deepmetmodel/deepmet_lowPU_Resp.pb') + # no leptons in the training. so remove leptons from the dnn input + run2_nanoAOD_LowPU.toModify(process.deepMETsResolutionTune, ignore_leptons=cms.bool(True)) + run2_nanoAOD_LowPU.toModify(process.deepMETsResponseTune, ignore_leptons=cms.bool(True)) # if included in Nano, and not computed in the fly, then it should be extracted from minAOD extractDeepMETs = nanoAOD_DeepMET_switch.nanoAOD_addDeepMET_switch and not nanoAOD_DeepMET_switch.nanoAOD_produceDeepMET_switch @@ -258,7 +265,7 @@ def nanoAOD_activateVID(process): for modname in electron_id_modules_WorkingPoints_nanoAOD.modules: setupAllVIDIdsInModule(process,modname,setupVIDElectronSelection) process.electronSequence.insert(process.electronSequence.index(process.bitmapVIDForEle),process.egmGsfElectronIDSequence) - for modifier in run2_egamma_2017,run2_egamma_2018,run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1: + for modifier in run2_egamma_2017,run2_egamma_2018,run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1,run2_nanoAOD_LowPU: modifier.toModify(process.electronMVAValueMapProducer, srcMiniAOD = "slimmedElectronsUpdated") modifier.toModify(process.egmGsfElectronIDs, physicsObjectSrc = "slimmedElectronsUpdated") @@ -334,7 +341,7 @@ def nanoAOD_customizeCommon(process): nanoAOD_addDeepFlavourTag_switch = cms.untracked.bool(False), ) run2_miniAOD_80XLegacy.toModify(nanoAOD_addDeepInfo_switch, nanoAOD_addDeepBTag_switch = cms.untracked.bool(True)) - for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: + for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_LowPU: modifier.toModify(nanoAOD_addDeepInfo_switch, nanoAOD_addDeepFlavourTag_switch = cms.untracked.bool(True)) process = nanoAOD_addDeepInfo(process, addDeepBTag=nanoAOD_addDeepInfo_switch.nanoAOD_addDeepBTag_switch, @@ -381,7 +388,7 @@ def nanoAOD_customizeCommon(process): ) run2_miniAOD_80XLegacy.toModify(addTauIds_switch, nanoAOD_addTauIds_switch = cms.untracked.bool(False)) ((run2_miniAOD_devel | run2_tau_ul_2016 | run2_tau_ul_2018) & \ - (~(run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1))).toModify(addTauIds_switch, + (~(run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1 | run2_nanoAOD_LowPU))).toModify(addTauIds_switch, nanoAOD_addTauIds_switch = cms.untracked.bool(False)) if addTauIds_switch.nanoAOD_addTauIds_switch: process = nanoAOD_addTauIds(process) @@ -448,5 +455,5 @@ def nanoGenWmassCustomize(process): _102x_sequence.insert(_102x_sequence.index(jetSequence),extraFlagsProducers102x) _102x_sequence.insert(_102x_sequence.index(simpleCleanerTable)+1,extraFlagsTable) -for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_102Xv1: +for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_102Xv1, run2_nanoAOD_LowPU: modifier.toReplaceWith(nanoSequenceCommon, _102x_sequence) diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index edcf7ecc92439..765e72c564423 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -16,7 +16,8 @@ ) from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 -for era in [run2_nanoAOD_94XMiniAODv1,]: +from Configuration.Eras.Modifier_run2_nanoAOD_LowPU_cff import run2_nanoAOD_LowPU +for era in [run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_LowPU]: era.toModify(finalTaus, cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2') || tauID('byVVVLooseDeepTau2017v2p1VSjet'))") ) @@ -159,7 +160,7 @@ def _tauId8WPMask(pattern,doc): tauTable.variables = _variablesMiniV2 -for era in [run2_nanoAOD_94XMiniAODv1,]: +for era in [run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_LowPU]: era.toModify(tauTable, variables = _variablesMiniV1 ) diff --git a/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py b/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py index de9eef5e4fb23..7bc9c0affff7d 100644 --- a/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py @@ -447,7 +447,8 @@ _patTauMVAIDsSeqWith2017v1 = _patTauMVAIDsSeq2017v2.copy() _patTauMVAIDsSeqWith2017v1 += patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Seq from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 -for era in [run2_nanoAOD_94XMiniAODv1,]: +from Configuration.Eras.Modifier_run2_nanoAOD_LowPU_cff import run2_nanoAOD_LowPU +for era in [run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_LowPU]: era.toReplaceWith(patTauMVAIDsSeq,_patTauMVAIDsSeqWith2017v1) # embed new MVA tau-Ids into new tau collection @@ -513,7 +514,7 @@ ) slimmedTausUpdated.tauIDSources = _tauIDSourcesWith2015 -for era in [run2_nanoAOD_94XMiniAODv1,]: +for era in [run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_LowPU]: era.toModify(slimmedTausUpdated, tauIDSources = _tauIDSourcesWith2017v1 ) diff --git a/PhysicsTools/NanoAOD/python/triggerObjects_cff.py b/PhysicsTools/NanoAOD/python/triggerObjects_cff.py index 735ed63562bb9..c7258d2b7e118 100644 --- a/PhysicsTools/NanoAOD/python/triggerObjects_cff.py +++ b/PhysicsTools/NanoAOD/python/triggerObjects_cff.py @@ -2,6 +2,7 @@ from Configuration.Eras.Modifier_run2_HLTconditions_2016_cff import run2_HLTconditions_2016 from Configuration.Eras.Modifier_run2_HLTconditions_2017_cff import run2_HLTconditions_2017 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy +from Configuration.Eras.Modifier_run2_nanoAOD_LowPU_cff import run2_nanoAOD_LowPU from PhysicsTools.NanoAOD.common_cff import ExtVar import copy @@ -218,6 +219,37 @@ selections = selections2016 ) +# trigger bits for lowPU dataset +selections_lowPU = cms.VPSet( + cms.PSet( + name = cms.string("Electron (PixelMatched e/gamma)"), # this selects also photons for the moment! + id = cms.int32(11), + sel = cms.string("type(92) && pt > 7 && coll('hltEgammaCandidates') && filter('*PixelMatchFilter')"), + l1seed = cms.string("type(-98)"), l1deltaR = cms.double(0.3), + #l2seed = cms.string("type(92) && coll('')"), l2deltaR = cms.double(0.5), + skipObjectsNotPassingQualityBits = cms.bool(True), + # change electron trigger bits for lowPU + qualityBits = cms.string("filter('hltEle20WPLoose1GsfTrackIsoFilter*') + 2*filter('hltEle17WPLoose1GsfTrackIsoFilterForHI')"), + qualityBitsDoc = cms.string('1 = Ele20, 2 = Ele17HI'), + ), + cms.PSet( + name = cms.string("Muon"), + id = cms.int32(13), + sel = cms.string("type(83) && pt > 5 && (coll('hltIterL3MuonCandidates') || (pt > 45 && coll('hltHighPtTkMuonCands')) || (pt > 95 && coll('hltOldL3MuonCandidates')))"), + l1seed = cms.string("type(-81)"), l1deltaR = cms.double(0.5), + l2seed = cms.string("type(83) && coll('hltL2MuonCandidates')"), l2deltaR = cms.double(0.3), + skipObjectsNotPassingQualityBits = cms.bool(True), + qualityBits = cms.string("filter('hltL3fL1sMu10lqL1f0L2f10L3Filtered17')"), + qualityBitsDoc = cms.string("1 = Mu17"), + ), +) + +run2_nanoAOD_LowPU.toModify( + triggerObjectTable, + selections = selections_lowPU +) + + from PhysicsTools.PatUtils.L1ECALPrefiringWeightProducer_cff import prefiringweight run2_HLTconditions_2016.toModify(prefiringweight, DataEra = cms.string("2016BtoH"))