From 97b2f61cbd86b30d59502479e88a767d12931921 Mon Sep 17 00:00:00 2001 From: Congqiao Li Date: Mon, 28 Oct 2024 09:19:10 +0100 Subject: [PATCH] Adapt to nano workflow --- PhysicsTools/NanoAOD/python/custom_jme_cff.py | 2 ++ PhysicsTools/NanoAOD/python/jetsAK8_cff.py | 14 ++++++++++---- PhysicsTools/NanoAOD/python/nano_cff.py | 1 + .../puppiJetMETReclusteringFromMiniAOD_cff.py | 2 ++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/custom_jme_cff.py b/PhysicsTools/NanoAOD/python/custom_jme_cff.py index 28aca19965ff3..fa6f47da2fa13 100644 --- a/PhysicsTools/NanoAOD/python/custom_jme_cff.py +++ b/PhysicsTools/NanoAOD/python/custom_jme_cff.py @@ -1298,9 +1298,11 @@ def RecomputePuppiWeightsMETAK8(proc): from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassRegressionOutputs as pfParticleNetMassRegressionOutputs from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassCorrelatedJetTagsAll as pfParticleNetMassCorrelatedJetTagsAll from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK8_cff import _pfParticleNetFromMiniAODAK8JetTagsAll as pfParticleNetFromMiniAODAK8JetTagsAll + from RecoBTag.ONNXRuntime.pfGlobalParticleTransformerAK8_cff import _pfGlobalParticleTransformerAK8JetTagsAll as pfGlobalParticleTransformerAK8JetTagsAll btagDiscriminatorsAK8 = cms.PSet(names = cms.vstring( pfParticleNetMassCorrelatedJetTagsAll+ + pfGlobalParticleTransformerAK8JetTagsAll+ pfParticleNetFromMiniAODAK8JetTagsAll+ pfParticleNetJetTagsAll+ pfParticleNetMassRegressionOutputs diff --git a/PhysicsTools/NanoAOD/python/jetsAK8_cff.py b/PhysicsTools/NanoAOD/python/jetsAK8_cff.py index 48734a83da593..ca1b924b8f407 100644 --- a/PhysicsTools/NanoAOD/python/jetsAK8_cff.py +++ b/PhysicsTools/NanoAOD/python/jetsAK8_cff.py @@ -59,7 +59,7 @@ globalParT3_Xbb = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probXbb')",float,doc="Mass-decorrelated GlobalParT-3 X->bb score. Note: For sig vs bkg (e.g. bkg=QCD) tagging, use sig/(sig+bkg) to construct the discriminator",precision=10), globalParT3_Xcc = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probXcc')",float,doc="Mass-decorrelated GlobalParT-3 X->cc score",precision=10), globalParT3_Xcs = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probXcs')",float,doc="Mass-decorrelated GlobalParT-3 X->cs score",precision=10), - globalParT3_Xqq = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probXqq')",float,doc="Mass-decorrelated GlobalParT-3 X->qq score",precision=10), + globalParT3_Xqq = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probXqq')",float,doc="Mass-decorrelated GlobalParT-3 X->qq (ss/dd/uu) score",precision=10), globalParT3_Xtauhtaue = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probXtauhtaue')",float,doc="Mass-decorrelated GlobalParT-3 X->tauhtaue score",precision=10), globalParT3_Xtauhtaum = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probXtauhtaum')",float,doc="Mass-decorrelated GlobalParT-3 X->tauhtaum score",precision=10), globalParT3_Xtauhtauh = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probXtauhtauh')",float,doc="Mass-decorrelated GlobalParT-3 X->tauhtauh score",precision=10), @@ -73,7 +73,7 @@ globalParT3_TopbWmv = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probTopbWmv')",float,doc="Mass-decorrelated GlobalParT-3 Top->bWmv score",precision=10), globalParT3_TopbWtauhv = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probTopbWtauhv')",float,doc="Mass-decorrelated GlobalParT-3 Top->bWtauhv score",precision=10), globalParT3_QCD = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probQCD')",float,doc="Mass-decorrelated GlobalParT-3 QCD score.",precision=10), - globalParT3_massCorrX2p = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:massCorrX2p')",float,doc="GlobalParT-3 mass regression corrector with respect to the original jet mass, optimised for X->bb/cc/qq jets. Use (massCorrX2p * mass * (1 - rawFactor)) to get the regressed mass",precision=10), + globalParT3_massCorrX2p = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:massCorrX2p')",float,doc="GlobalParT-3 mass regression corrector with respect to the original jet mass, optimised for resonance 2-prong (bb/cc/cs/ss/qq) jets. Use (massCorrX2p * mass * (1 - rawFactor)) to get the regressed mass",precision=10), globalParT3_massCorrGeneric = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:massCorrGeneric')",float,doc="GlobalParT-3 mass regression corrector with respect to the original jet mass, optimised for generic jet cases. Use (massCorrGeneric * mass * (1 - rawFactor)) to get the regressed mass",precision=10), globalParT3_withMassTopvsQCD = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probWithMassTopvsQCD')",float,doc="GlobalParT-3 tagger (w/mass) Top vs QCD discriminator",precision=10), globalParT3_withMassWvsQCD = Var("bDiscriminator('pfGlobalParticleTransformerAK8JetTags:probWithMassWvsQCD')",float,doc="GlobalParT-3 tagger (w/mass) W vs QCD discriminator",precision=10), @@ -169,7 +169,7 @@ ## - To be used in nanoAOD_customizeCommon() in nano_cff.py ############################################################### from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection -def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNetMassLegacy, addParticleNet, jecPayload): +def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNetMassLegacy, addParticleNet, addGlobalParT, jecPayload): _btagDiscriminators=[] if addDeepBTag: print("Updating process to run DeepCSV btag to AK8 jets") @@ -178,6 +178,10 @@ def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubl print("Updating process to run DeepBoostedJet on datasets before 103X") from RecoBTag.ONNXRuntime.pfDeepBoostedJet_cff import _pfDeepBoostedJetTagsAll as pfDeepBoostedJetTagsAll _btagDiscriminators += pfDeepBoostedJetTagsAll + if addGlobalParT: + print("Updating process to run GlobalParT") + from RecoBTag.ONNXRuntime.pfGlobalParticleTransformerAK8_cff import _pfGlobalParticleTransformerAK8JetTagsAll as pfGlobalParticleTransformerAK8JetTagsAll + _btagDiscriminators += pfGlobalParticleTransformerAK8JetTagsAll if addParticleNet: print("Updating process to run ParticleNet joint classification and mass regression") from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK8_cff import _pfParticleNetFromMiniAODAK8JetTagsAll as pfParticleNetFromMiniAODAK8JetTagsAll @@ -222,16 +226,18 @@ def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubl nanoAOD_addDeepDoubleXV2_switch = cms.untracked.bool(False), nanoAOD_addParticleNetMassLegacy_switch = cms.untracked.bool(False), nanoAOD_addParticleNet_switch = cms.untracked.bool(False), + nanoAOD_addGlobalParT_switch = cms.untracked.bool(False), jecPayload = cms.untracked.string('AK8PFPuppi') ) # ParticleNet legacy jet tagger is already in 106Xv2 MINIAOD, -# add ParticleNet legacy mass regression and new combined tagger + mass regression +# add ParticleNet legacy mass regression, new combined tagger + mass regression, and GlobalParT run2_nanoAOD_106Xv2.toModify( nanoAOD_addDeepInfoAK8_switch, nanoAOD_addParticleNetMassLegacy_switch = True, nanoAOD_addParticleNet_switch = True, + nanoAOD_addGlobalParT_switch = True, ) ################################################ diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index bfbac52ed933d..5e55613bfb41d 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -233,6 +233,7 @@ def nanoAOD_customizeCommon(process): addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch, addParticleNetMassLegacy=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMassLegacy_switch, addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch, + addGlobalParT=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addGlobalParT_switch, jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload ) diff --git a/PhysicsTools/PatAlgos/python/tools/puppiJetMETReclusteringFromMiniAOD_cff.py b/PhysicsTools/PatAlgos/python/tools/puppiJetMETReclusteringFromMiniAOD_cff.py index 5772dafc56560..ceb9c648b8f90 100644 --- a/PhysicsTools/PatAlgos/python/tools/puppiJetMETReclusteringFromMiniAOD_cff.py +++ b/PhysicsTools/PatAlgos/python/tools/puppiJetMETReclusteringFromMiniAOD_cff.py @@ -44,8 +44,10 @@ def puppiJetMETReclusterFromMiniAOD(process, runOnMC, useExistingWeights=False, from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassRegressionOutputs as pfParticleNetMassRegressionOutputs from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassCorrelatedJetTagsAll as pfParticleNetMassCorrelatedJetTagsAll from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK8_cff import _pfParticleNetFromMiniAODAK8JetTagsAll as pfParticleNetFromMiniAODAK8JetTagsAll + from RecoBTag.ONNXRuntime.pfGlobalParticleTransformerAK8_cff import _pfGlobalParticleTransformerAK8JetTagsAll as pfGlobalParticleTransformerAK8JetTagsAll btagDiscriminatorsAK8 = cms.PSet(names = cms.vstring( pfParticleNetMassCorrelatedJetTagsAll+ + pfGlobalParticleTransformerAK8JetTagsAll+ pfParticleNetFromMiniAODAK8JetTagsAll+ pfParticleNetJetTagsAll+ pfParticleNetMassRegressionOutputs