Skip to content

[MiniAOD, NanoAOD] Update AK8 subjet b-taggers, add pileup jet ID #46191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
UParTAK4RegPtRawCorr = Var("?bDiscriminator('pfUnifiedParticleTransformerAK4JetTags:ptcorr')>0?bDiscriminator('pfUnifiedParticleTransformerAK4JetTags:ptcorr'):-1",float,precision=10,doc="UnifiedParT universal flavor-aware visible pT regression (no neutrinos), correction relative to raw jet pT"),
UParTAK4RegPtRawCorrNeutrino = Var("?bDiscriminator('pfUnifiedParticleTransformerAK4JetTags:ptnu')>0?bDiscriminator('pfUnifiedParticleTransformerAK4JetTags:ptnu'):-1",float,precision=10,doc="UnifiedParT universal flavor-aware pT regression neutrino correction, relative to visible. To apply full regression, multiply raw jet pT by both UParTAK4RegPtRawCorr and UParTAK4RegPtRawCorrNeutrino."),
UParTAK4RegPtRawRes = Var("?(bDiscriminator('pfUnifiedParticleTransformerAK4JetTags:ptreshigh')+bDiscriminator('pfUnifiedParticleTransformerAK4JetTags:ptreslow'))>0?0.5*(bDiscriminator('pfUnifiedParticleTransformerAK4JetTags:ptreshigh')-bDiscriminator('pfUnifiedParticleTransformerAK4JetTags:ptreslow')):-1",float,precision=10,doc="UnifiedParT universal flavor-aware jet pT resolution estimator, (q84 - q16)/2"),
puIdDisc = Var("userFloat('pileupJetIdPuppi:fullDiscriminant')", float,doc="Pileup ID BDT discriminant with 133X Winter24 PuppiV18 training",precision=10),
hfsigmaEtaEta = Var("userFloat('hfsigmaEtaEta')",float,doc="sigmaEtaEta for HF jets (noise discriminating variable)",precision=10),
hfsigmaPhiPhi = Var("userFloat('hfsigmaPhiPhi')",float,doc="sigmaPhiPhi for HF jets (noise discriminating variable)",precision=10),
hfcentralEtaStripSize = Var("userInt('hfcentralEtaStripSize')", int, doc="eta size of the central tower strip in HF (noise discriminating variable)"),
Expand Down Expand Up @@ -134,6 +135,12 @@
hfEmEF = None
)

run3_nanoAOD_pre142X.toModify(
jetPuppiTable.variables,
puIdDisc = None,
)


#jets are not as precise as muons
jetPuppiTable.variables.pt.precision=10

Expand Down
11 changes: 10 additions & 1 deletion PhysicsTools/NanoAOD/python/jetsAK8_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubl
name = cms.string("SubJet"),
doc = cms.string("slimmedJetsAK8PFPuppiSoftDropPacked::SubJets, i.e. soft-drop subjets for ak8 fat jets for boosted analysis"),
variables = cms.PSet(P4Vars,
btagDeepB = Var("bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')",float,doc="DeepCSV b+bb tag discriminator",precision=10),
btagDeepFlavB = Var("bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb')",float,doc="DeepJet b+bb+lepb tag discriminator",precision=10),
btagUParTAK4B = Var("?bDiscriminator('pfUnifiedParticleTransformerAK4DiscriminatorsJetTags:BvsAll')>0?bDiscriminator('pfUnifiedParticleTransformerAK4DiscriminatorsJetTags:BvsAll'):-1",float,precision=10,doc="UnifiedParT b vs. udscg"),
rawFactor = Var("1.-jecFactor('Uncorrected')",float,doc="1 - Factor to get back to raw pT",precision=6),
area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
tau1 = Var("userFloat('NjettinessAK8Subjets:tau1')",float, doc="Nsubjettiness (1 axis)",precision=10),
Expand All @@ -268,6 +269,14 @@ def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubl
area = None,
)

run3_nanoAOD_pre142X.toModify(
subJetTable.variables,
btagDeepFlavB = None,
btagUParTAK4B = None,
btagDeepB = Var("bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')",float,doc="DeepCSV b+bb tag discriminator",precision=10),
)


#jets are not as precise as muons
fatJetTable.variables.pt.precision=10
subJetTable.variables.pt.precision=10
Expand Down
20 changes: 20 additions & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ def _match(name):
and 'hfHEF' not in plot.name.value() and 'hfEmEF' not in plot.name.value():
_Jet_EarlyRun3_plots.append(plot)

_Jet_pre142X_plots = cms.VPSet()
for plot in nanoDQM.vplots.Jet.plots:
if 'puIdDisc' not in plot.name.value():
_Jet_pre142X_plots.append(plot)

_SubJet_Run2_plots = cms.VPSet()
for plot in nanoDQM.vplots.SubJet.plots:
Expand All @@ -234,6 +238,15 @@ def _match(name):
if 'area' not in plot.name.value():
_SubJet_EarlyRun3_plots.append(plot)

_SubJet_pre142X_plots = cms.VPSet()
for plot in nanoDQM.vplots.SubJet.plots:
if 'btagDeepFlavB' not in plot.name.value() and 'btagUParTAK4B' not in plot.name.value():
_SubJet_pre142X_plots.append(plot)
_SubJet_pre142X_plots.extend([
Plot1D('btagCMVA', 'btagCMVA', 20, -1, 1, 'CMVA V2 btag discriminator'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have btagCMVA for subjets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not anymore. Will remove this.

Plot1D('btagDeepB', 'btagDeepB', 20, -1, 1, 'Deep B+BB btag discriminator'),
])

run2_nanoAOD_ANY.toModify(
nanoDQM.vplots.FatJet,
plots = _FatJet_Run2_plots
Expand All @@ -256,6 +269,13 @@ def _match(name):
plots = _SubJet_EarlyRun3_plots
)

run3_nanoAOD_pre142X.toModify(
nanoDQM.vplots.Jet,
plots = _Jet_pre142X_plots
).toModify(
nanoDQM.vplots.SubJet,
plots = _SubJet_pre142X_plots
)

_Pileup_pre13X_plots = cms.VPSet()
for plot in nanoDQM.vplots.Pileup.plots:
Expand Down
3 changes: 3 additions & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@
Plot1D('PNetRegPtRawCorr', 'PNetRegPtRawCorr', 20, 0, 2, 'ParticleNet visible pT regression, correction relative to raw pT'),
Plot1D('PNetRegPtRawCorrNeutrino', 'PNetRegPtRawCorrNeutrino', 20, 0, 2, 'ParticleNet neutrino pT correction, relative to regressed visible pT'),
Plot1D('PNetRegPtRawRes', 'PNetRegPtRawRes', 20, 0, 0.5, 'ParticleNet per-jet resolution estimator: (q84 - q16)/2'),
Plot1D('puIdDisc', 'puIdDisc', 20, -1., 1., 'Pileup ID BDT discriminant with 133X Winter24 PuppiV18 training'),
Plot1D('chEmEF', 'chEmEF', 20, 0, 1, 'charged Electromagnetic Energy Fraction'),
Plot1D('chFPV0EF', 'chFPV0EF', 20, 0, 2, 'charged fromPV==0 Energy Fraction (energy excluded from CHS jets). Previously called betastar.'),
Plot1D('chHEF', 'chHEF', 20, 0, 2, 'charged Hadron Energy Fraction'),
Expand Down Expand Up @@ -817,6 +818,8 @@
Count1D('_size', 9, -0.5, 8.5, 'slimmedJetsAK8PFPuppiSoftDropPacked::SubJets, i.e. soft-drop subjets for ak8 fat jets for boosted'),
Plot1D('btagCMVA', 'btagCMVA', 20, -1, 1, 'CMVA V2 btag discriminator'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think btagCMVA can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this also.

Plot1D('btagDeepB', 'btagDeepB', 20, -1, 1, 'Deep B+BB btag discriminator'),
Plot1D('btagDeepFlavB', 'btagDeepFlavB', 20, -1, 1, 'DeepJet b+bb+lepb tag discriminator'),
Plot1D('btagUParTAK4B', 'btagUParTAK4B', 20, -1, 1, 'UnifiedParT b vs. udscg'),
Plot1D('eta', 'eta', 20, -4, 4, 'eta'),
Plot1D('hadronFlavour', 'hadronFlavour', 6, -0.5, 5.5, 'flavour from hadron ghost clustering'),
Plot1D('mass', 'mass', 20, -200, 200, 'mass'),
Expand Down
21 changes: 12 additions & 9 deletions PhysicsTools/PatAlgos/python/slimming/applySubstructure_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,26 @@ def applySubstructure( process, postfix="" ) :
jetCorrections = ('AK8PFPuppi', ['L2Relative', 'L3Absolute'], 'None'),
getJetMCFlavour = False # jet flavor disabled
)

## PATify soft drop subjets
from RecoBTag.ONNXRuntime.pfUnifiedParticleTransformerAK4_cff import _pfUnifiedParticleTransformerAK4JetTagsAll as pfUnifiedParticleTransformerAK4JetTagsAll
_btagDiscriminatorsSubjets = cms.PSet(
names=cms.vstring(
'pfDeepFlavourJetTags:probb',
'pfDeepFlavourJetTags:probbb',
'pfDeepFlavourJetTags:problepb',
'pfUnifiedParticleTransformerAK4DiscriminatorsJetTags:BvsAll'
)
)

addJetCollection(
process,
postfix=postfix,
labelName = 'AK8PFPuppiSoftDropSubjets',
jetSource = cms.InputTag('ak8PFJetsPuppiSoftDrop'+postfix,'SubJets'),
algo = 'ak', # needed for subjet flavor clustering
rParam = 0.8, # needed for subjet flavor clustering
btagDiscriminators = ['pfDeepCSVJetTags:probb', 'pfDeepCSVJetTags:probbb', 'pfCombinedInclusiveSecondaryVertexV2BJetTags','pfCombinedMVAV2BJetTags'],
btagDiscriminators = _btagDiscriminatorsSubjets.names.value(),
jetCorrections = ('AK4PFPuppi', ['L2Relative', 'L3Absolute'], 'None'),
explicitJTA = True, # needed for subjet b tagging
svClustering = True, # needed for subjet b tagging
Expand All @@ -80,14 +91,6 @@ def applySubstructure( process, postfix="" ) :
groomedFatJets=cms.InputTag('ak8PFJetsPuppiSoftDrop') # needed for subjet flavor clustering
)

from Configuration.Eras.Modifier_run3_common_cff import run3_common
run3_common.toModify(process.patJetsAK8PFPuppiSoftDropSubjets,
discriminatorSources = cms.VInputTag(
cms.InputTag("pfDeepCSVJetTagsAK8PFPuppiSoftDropSubjets","probb"),
cms.InputTag("pfDeepCSVJetTagsAK8PFPuppiSoftDropSubjets","probbb")
)
)

# add groomed ECFs and N-subjettiness to soft dropped pat::Jets for fat jets and subjets
process.load('RecoJets.JetProducers.ECF_cff')
addToProcessAndTask('nb1AK8PuppiSoftDrop'+postfix, process.ecfNbeta1.clone(src = cms.InputTag("ak8PFJetsPuppiSoftDrop"+postfix), cuts = cms.vstring('', '', 'pt > 250')), process, task)
Expand Down