-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Integration of extended ParticleNet trainings for simultaneous jet flavor tagging, pT regression, and tau ID + reconstruction #40745
Changes from 13 commits
17471e8
30c3043
419dc21
5c0afbd
0659445
17457a5
06e0181
da0325f
7e5767b
8903fcd
ac075a6
3bca26d
57484c4
5e7f771
69a2c39
acbdc84
1ecd5da
71d3b02
4ceeb26
525aadc
61e61f4
0075526
d524a88
3c15acd
55daf9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,14 @@ | |
btagDeepFlavCvL = Var("?(bDiscriminator('pfDeepFlavourJetTags:probc')+bDiscriminator('pfDeepFlavourJetTags:probuds')+bDiscriminator('pfDeepFlavourJetTags:probg'))>0?bDiscriminator('pfDeepFlavourJetTags:probc')/(bDiscriminator('pfDeepFlavourJetTags:probc')+bDiscriminator('pfDeepFlavourJetTags:probuds')+bDiscriminator('pfDeepFlavourJetTags:probg')):-1",float,doc="DeepJet c vs uds+g discriminator",precision=10), | ||
btagDeepFlavCvB = Var("?(bDiscriminator('pfDeepFlavourJetTags:probc')+bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb'))>0?bDiscriminator('pfDeepFlavourJetTags:probc')/(bDiscriminator('pfDeepFlavourJetTags:probc')+bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb')):-1",float,doc="DeepJet c vs b+bb+lepb discriminator",precision=10), | ||
btagDeepFlavQG = Var("?(bDiscriminator('pfDeepFlavourJetTags:probg')+bDiscriminator('pfDeepFlavourJetTags:probuds'))>0?bDiscriminator('pfDeepFlavourJetTags:probg')/(bDiscriminator('pfDeepFlavourJetTags:probg')+bDiscriminator('pfDeepFlavourJetTags:probuds')):-1",float,doc="DeepJet g vs uds discriminator",precision=10), | ||
btagPNetB = Var("?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:BvsAll')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:BvsAll'):-1",float,precision=10,doc="ParticleNet b vs. udscg"), | ||
btagPNetCvL = Var("?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:CvsL')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:CvsL'):-1",float,precision=10,doc="ParticleNet c vs. udsg"), | ||
btagPNetCvB = Var("?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:CvsB')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:CvsB'):-1",float,precision=10,doc="ParticleNet c vs. b"), | ||
btagPNetQvG = Var("?abs(eta())<2.5?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:QvsG'):bDiscriminator('pfParticleNetFromMiniAODAK4PuppiForwardDiscriminatorsJetTags:QvsG')",float,precision=10,doc="ParticleNet q (udsbc) vs. g"), | ||
btagPNetTauVJet = Var("?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:TauVsJet')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:TauVsJet'):-1",float,precision=10,doc="ParticleNet tau vs. jet"), | ||
PNetRegPtRawCorr = Var("?abs(eta())<2.5?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:ptcorr'):bDiscriminator('pfParticleNetFromMiniAODAK4PuppiForwardJetTags:ptcorr')",float,precision=10,doc="ParticleNet universal flavor-aware visible pT regression (no neutrinos), correction relative to raw jet pT"), | ||
PNetRegPtRawCorrNeutrino = Var("?abs(eta())<2.5?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:ptnu'):bDiscriminator('pfParticleNetFromMiniAODAK4PuppiForwardJetTags:ptnu')",float,precision=10,doc="ParticleNet universal flavor-aware pT regression neutrino correction, relative to visible. To apply full regression, multiply raw jet pT by both PNetRegPtRawCorr and PNetRegPtRawCorrNeutrino."), | ||
PNetRegPtRawRes = Var("?abs(eta())<2.5?0.5*(bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:ptreshigh')-bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:ptreslow')):0.5*(bDiscriminator('pfParticleNetFromMiniAODAK4PuppiForwardJetTags:ptreshigh')-bDiscriminator('pfParticleNetFromMiniAODAK4PuppiForwardJetTags:ptreslow'))",float,precision=10,doc="ParticleNet universal flavor-aware jet pT resolution estimator, (q84 - q16)/2"), | ||
jetId = Var("userInt('tightId')*2+4*userInt('tightIdLepVeto')", "uint8",doc="Jet ID flag: bit2 is tight, bit3 is tightLepVeto"), | ||
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), | ||
|
@@ -111,6 +119,41 @@ | |
#jets are not as precise as muons | ||
jetPuppiTable.variables.pt.precision=10 | ||
|
||
############################################################## | ||
## DeepInfoAK4:Start | ||
## - To be used in nanoAOD_customizeCommon() in nano_cff.py | ||
############################################################### | ||
from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection | ||
def nanoAOD_addDeepInfoAK4(process,addParticleNet): | ||
_btagDiscriminators=[] | ||
if addParticleNet: | ||
print("Updating process to run ParticleNetAK4") | ||
from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK4_cff import _pfParticleNetFromMiniAODAK4CHSCentralJetTagsAll as pfParticleNetFromMiniAODAK4CHSCentralJetTagsAll | ||
from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK4_cff import _pfParticleNetFromMiniAODAK4CHSForwardJetTagsAll as pfParticleNetFromMiniAODAK4CHSForwardJetTagsAll | ||
_btagDiscriminators += pfParticleNetFromMiniAODAK4CHSCentralJetTagsAll | ||
_btagDiscriminators += pfParticleNetFromMiniAODAK4CHSForwardJetTagsAll | ||
if len(_btagDiscriminators)==0: return process | ||
print("Will recalculate the following discriminators: "+", ".join(_btagDiscriminators)) | ||
updateJetCollection( | ||
process, | ||
jetSource = cms.InputTag('slimmedJetsPuppi'), | ||
jetCorrections = ('AK4PFPuppi', cms.vstring(['L2Relative', 'L3Absolute']), 'None'), | ||
btagDiscriminators = _btagDiscriminators, | ||
postfix = 'WithDeepInfo', | ||
) | ||
process.load("Configuration.StandardSequences.MagneticField_cff") | ||
process.jetCorrFactorsNano.src="selectedUpdatedPatJetsWithDeepInfo" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks Sébastien, clearly this block of code was written too quickly :) Fixed. |
||
process.updatedJets.jetSource="selectedUpdatedPatJetsWithDeepInfo" | ||
return process | ||
|
||
nanoAOD_addDeepInfoAK4_switch = cms.PSet( | ||
nanoAOD_addParticleNet_switch = cms.untracked.bool(False), | ||
) | ||
|
||
################################################ | ||
## DeepInfoAK4CHS:End | ||
################################################# | ||
|
||
################################################################################ | ||
# JETS FOR MET type1 | ||
################################################################################ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not adding the L1 and L2L3 here? They are used above: https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py#L12-L15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that we no longer had L1 corrections for PUPPI jets? I borrowed the same logic as used here in the miniAOD step: https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py#L68. I agree though that it's strange to have two different lists of JEC corrections. Maybe JME can clarify the procedure? @abenecke @anmalara
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, L1 is not needed for Puppi and L2L3Res is only for data.
I'd also add a warning here. The current corrections won't be valid for the regressed jets, so why do we need them in the first place? I didn't check the code, but this should be valid for the mini step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @anmalara, the idea was to make the ParticleNet regression correction relative to the raw jet pT available in the MINIAOD and NANOAOD even if you're right that the current JEC won't apply to the regressed jets. The idea was that we embed the ParticleNet outputs in the jet collections including the raw pT regression correction as something that can be studied to assess the performance gain from the resolution improvement even if one cannot use the regression as-is for an analysis for the time being. Then on the longer term we either integrate the regression as part of the JERC, as you know well, or we deploy an updated training with the regression relative to the JEC-corrected pT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me. I wanted to make clear (this information should be propagated carefully in twikis and it will) that the pt-regression and the pt-corrected cannot be mixed and if one wants to use the regression, one would need to reapply JEC on the fly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since as you know the ParticleNet regression from the raw pT effectively approximates multiple aspects of the JEC corrections, I guess that if using the regression there is no good prescription for how to integrate that with the JEC other than having it as an input prior to the JERC derivation. I totally agree that we should make sure this is clear to the user - just saying that I don't think there is really much an on-the-fly solution available other than deploying a regression trained from the JEC-corrected pT. Since for now the priority is to provide the inputs for the POGs we figured this would be okay for the short term.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @anmalara , perhaps the L1FastJet could be removed here then? https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py#L12 and here: https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/jetsAK8_cff.py#L11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have a specific reason to remove this correction? The JERC group would make sure that if L1 is not needed for Puppi, a dummy file is created. Should we decide that we need L1 for Puppi, we should revert these changes. Maybe, it's safer to include this correction even in this PR.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that's fine then, if JERC would rather keep the dummy L1, we can leave it in, it's up to you.