From fbed391dc2bfc40402490f25f6977760161818f7 Mon Sep 17 00:00:00 2001 From: Nurfikri Norjoharuddeen Date: Thu, 26 Sep 2024 15:18:06 +0200 Subject: [PATCH 1/2] Set up Pileup Jet ID for AK4 Puppi(V18) jets. BDT trained using 13_3_X Winter24 JMENanoV14 DYto2L sample. --- .../python/PileupJetIDCutParams_cfi.py | 30 +++++++++++++++++++ .../python/PileupJetIDParams_cfi.py | 15 ++++++++++ .../JetProducers/python/PileupJetID_cfi.py | 15 ++++++++++ 3 files changed, 60 insertions(+) diff --git a/RecoJets/JetProducers/python/PileupJetIDCutParams_cfi.py b/RecoJets/JetProducers/python/PileupJetIDCutParams_cfi.py index 08fe71768084f..cedc3c3ee43a3 100644 --- a/RecoJets/JetProducers/python/PileupJetIDCutParams_cfi.py +++ b/RecoJets/JetProducers/python/PileupJetIDCutParams_cfi.py @@ -106,6 +106,36 @@ ########################################################### full_106x_UL16APV_chs_wp = full_106x_UL16_chs_wp.clone() +########################################################### +## Working points for the 133X trainig for AK4 Puppi jets +########################################################### +full_133x_Winter24_puppiv18_wp = cms.PSet( + # 4 Eta Categories 0-2.5 2.5-2.75 2.75-3.0 3.0-5.0 + # 5 Pt Categories 0-10, 10-20, 20-30, 30-40, 40-50 + + #Tight Id + Pt010_Tight = cms.vdouble(-1.00, -1.00, -1.00, -1.00), + Pt1020_Tight = cms.vdouble(0.038, 0.219, -0.220, -0.254), + Pt2030_Tight = cms.vdouble(0.033, 0.060, -0.154, -0.154), + Pt3040_Tight = cms.vdouble(0.056, 0.103, -0.159, -0.109), + Pt4050_Tight = cms.vdouble(0.043, 0.127, -0.067, -0.059), + + #Medium Id + Pt010_Medium = cms.vdouble(-1.00, - 1.00, -1.00, -1.00), + Pt1020_Medium = cms.vdouble(-0.200, -0.068, -0.158, -0.384), + Pt2030_Medium = cms.vdouble(-0.109, -0.179, -0.293, -0.322), + Pt3040_Medium = cms.vdouble(-0.043, -0.124, -0.259, -0.286), + Pt4050_Medium = cms.vdouble(-0.034, -0.071, -0.198, -0.235), + + #Loose Id + Pt010_Loose = cms.vdouble( -1.00, -1.00, -1.00, -1.00), + Pt1020_Loose = cms.vdouble(-0.723, -0.392, -0.277, -0.516), + Pt2030_Loose = cms.vdouble(-0.548, -0.347, -0.313, -0.489), + Pt3040_Loose = cms.vdouble(-0.413, -0.289, -0.322, -0.438), + Pt4050_Loose = cms.vdouble(-0.279, -0.219, -0.279, -0.384), +) + + ######################################################### ## Empty cutbased WP for compatibility ########################################################### diff --git a/RecoJets/JetProducers/python/PileupJetIDParams_cfi.py b/RecoJets/JetProducers/python/PileupJetIDParams_cfi.py index 26945b07ba3e7..47fffb23e1894 100644 --- a/RecoJets/JetProducers/python/PileupJetIDParams_cfi.py +++ b/RecoJets/JetProducers/python/PileupJetIDParams_cfi.py @@ -166,6 +166,21 @@ for train in full_106x_UL16APV_chs.trainings: train.tmvaWeights = train.tmvaWeights.value().replace("UL17", "UL16APV") +#################################################################################################################### +full_133x_Winter24_puppi_v18_wp = full_106x_UL17_chs.clone( + JetIdParams = full_133x_Winter24_puppiv18_wp, + trainings = {0: dict(tmvaWeights = "RecoJets/JetProducers/data/pileupJetId_133X_Winter24_Eta0p0To2p5_puppiV18_BDT.weights.xml.gz", + tmvaVariables = trainingVariables_102X_Eta0To3), + 1: dict(tmvaWeights = "RecoJets/JetProducers/data/pileupJetId_133X_Winter24_Eta2p5To2p75_puppiV18_BDT.weights.xml.gz", + tmvaVariables = trainingVariables_102X_Eta0To3), + 2: dict(tmvaWeights = "RecoJets/JetProducers/data/pileupJetId_133X_Winter24_Eta2p75To3p0_puppiV18_BDT.weights.xml.gz", + tmvaVariables = trainingVariables_102X_Eta0To3), + 3: dict(tmvaWeights = "RecoJets/JetProducers/data/pileupJetId_133X_Winter24_Eta3p0To5p0_puppiV18_BDT.weights.xml.gz", + tmvaVariables = trainingVariables_102X_Eta3To5) + } +) + + #################################################################################################################### cutbased = cms.PSet( impactParTkThreshold = cms.double(1.), diff --git a/RecoJets/JetProducers/python/PileupJetID_cfi.py b/RecoJets/JetProducers/python/PileupJetID_cfi.py index 0241908603c3e..5921ca128f6a9 100644 --- a/RecoJets/JetProducers/python/PileupJetID_cfi.py +++ b/RecoJets/JetProducers/python/PileupJetID_cfi.py @@ -52,3 +52,18 @@ pileupJetIdCalculator, pileupJetIdEvaluator ) + +# +# +# +_puppiV18algos_133X_Winter24 = cms.VPSet(full_133x_Winter24_puppi_v18_wp,cutbased) + +pileupJetIdPuppi = pileupJetId.clone( + jets = "ak4PFJetsPuppi", + jec = "AK4PFPuppi", + srcConstituentWeights = "puppi", + algos = cms.VPSet(_puppiV18algos_133X_Winter24), +) + +pileUpJetIDPuppiTask = cms.Task(pileupJetIdPuppi) + From 298c23288d8955874dd8e4a1285ec9de70719d2d Mon Sep 17 00:00:00 2001 From: Nurfikri Norjoharuddeen Date: Thu, 26 Sep 2024 15:18:59 +0200 Subject: [PATCH 2/2] Add Pileup Jet ID for AK4 Puppi jets --- .../PatAlgos/python/slimming/miniAOD_tools.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index 889ed5c9ca83b..7ac0a8c05378a 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -361,7 +361,7 @@ def _add_deepFlavour(process): (pp_on_AA).toReplaceWith( process.makePatTausTask, _makePatTausTaskWithTauReReco ) - + # Adding puppi jets process.load('CommonTools.PileupAlgos.Puppi_cff') process.load('RecoJets.JetProducers.ak4PFJets_cfi') @@ -383,6 +383,10 @@ def _add_deepFlavour(process): ) task.add(process.patJetPuppiCharge) + ## PUJetID for ak4PFJetsPuppi + process.load("RecoJets.JetProducers.PileupJetID_cfi") + task.add(process.pileUpJetIDPuppiTask) + def _add_jetsPuppi(process): from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection noDeepFlavourDiscriminators = [x.value() if isinstance(x, cms.InputTag) else x for x in process.patJets.discriminatorSources @@ -394,9 +398,13 @@ def _add_jetsPuppi(process): ) process.patJetGenJetMatchPuppi.matched = 'slimmedGenJets' - + process.patJetsPuppi.jetChargeSource = cms.InputTag("patJetPuppiCharge") - + + ## Store PUJetID variables in patJetsPuppi + process.patJetsPuppi.userData.userFloats.src += [cms.InputTag("pileupJetIdPuppi:fullDiscriminant")] + process.patJetsPuppi.userData.userInts.src += [cms.InputTag("pileupJetIdPuppi:fullId")] + process.selectedPatJetsPuppi.cut = cms.string("pt > 10") from PhysicsTools.PatAlgos.slimming.applyDeepBtagging_cff import applyDeepBtagging