Skip to content
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

Minor fixes to variables for lepton MVA #45754

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 4 additions & 2 deletions PhysicsTools/NanoAOD/python/electrons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,10 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints):
miniPFRelIso_all = Var("userFloat('miniIsoAll')/pt",float,doc="mini PF relative isolation, total (with scaled rho*EA PU Winter22V1 corrections)"),
pfRelIso03_chg = Var("userFloat('PFIsoChg')/pt",float,doc="PF relative isolation dR=0.3, charged component"),
pfRelIso03_all = Var("userFloat('PFIsoAll')/pt",float,doc="PF relative isolation dR=0.3, total (with rho*EA PU Winter22V1 corrections)"),
jetRelIso = Var("?userCand('jetForLepJetVar').isNonnull()?(1./userFloat('ptRatio'))-1.:userFloat('PFIsoAll04')/pt",float,doc="Relative isolation in matched jet (1/ptRatio-1, pfRelIso04_all if no matched jet)",precision=8),
pfRelIso04_all = Var("userFloat('PFIsoAll04')/pt",float,doc="PF relative isolation dR=0.4, total (with rho*EA PU Winter22V1 corrections)", precision=10),
jetPtRatio = Var("?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRatio'):-1.",float,doc="ratio of electron pt to the associated jet pt (-1. if none)",precision=10),
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that PFIsoAll04 is not stored in NanoAOD, so if we make this change we will need to add it.

Copy link
Contributor Author

@namapane namapane Aug 23, 2024

Choose a reason for hiding this comment

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

Good catch, @hqucms. I assumed that was included in the same way as it it for muons.

But actually, there is somewhat an inconsistency as of now. Electron_jetRelIso takes PFIsoAll04 for Run3 and
PFIsoAll04_Fall17V2 for Run2, but what is used for LepGood_jetPtRatio in the electronPROMPTMVA is PFIsoAll04_Fall17V2 in all cases. I suppose that this is because the MVA training was done witth the Fall17V2 version, but then Electron_jetRelIso is inconsistent with the MVA input for Run3.
I'm unsure on how to proceed then: it depends if the goal is to be able to recover the variable used as input in the electronPROMPTMVA (then we need to add PFIsoAll04_Fall17V2), or to be able to recover the current Electron_jetRelIso (then we have to add PFIsoAll04 for Run3 or PFIsoAll04_Fall17V2 for Run2, but then I miss what's the point of having this variable).

Copy link
Contributor

Choose a reason for hiding this comment

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

The current code suggests that one should use PFIsoAll04 for Run3 and PFIsoAll04_Fall17V2 for Run2, so I suppose when the electronPROMPTMVA is re-trained for Run3 it should move to using PFIsoAll04?

Maybe @cms-sw/egamma-pog-l2 could comment and clarify on the plans for the update of electronPROMPTMVA for Run3?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added pfRelIso04_all.

jetPtRelv2 = Var("?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRel'):0",float,doc="Relative momentum of the lepton with respect to the closest jet after subtracting the lepton",precision=8),
jetDF = Var("?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probbb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:problepb'),0.0):0.0",float,doc="value of the DEEPJET b tagging algorithm discriminator of the associated jet (0 if none)",precision=8,lazyEval=True),
dr03TkSumPt = Var("?pt>35?dr03TkSumPt():0",float,doc="Non-PF track isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8),
dr03TkSumPtHEEP = Var("?pt>35?dr03TkSumPtHEEP():0",float,doc="Non-PF track isolation within a delta R cone of 0.3 with electron pt > 35 GeV used in HEEP ID",precision=8),
dr03EcalRecHitSumEt = Var("?pt>35?dr03EcalRecHitSumEt():0",float,doc="Non-PF Ecal isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8),
Expand Down Expand Up @@ -453,7 +455,7 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints):
miniPFRelIso_all = Var("userFloat('miniIsoAll_Fall17V2')/pt",float,doc="mini PF relative isolation, total (with scaled rho*EA Fall17V2 PU corrections) in Run2"),
pfRelIso03_chg = Var("userFloat('PFIsoChg_Fall17V2')/pt",float,doc="PF relative isolation dR=0.3 with 94 EffArea, charged component in Run2"),
pfRelIso03_all = Var("userFloat('PFIsoAll_Fall17V2')/pt",float,doc="PF relative isolation dR=0.3 with 94 EffArea, total (with rho*EA Fall17V2 PU corrections) in Run2"),
jetRelIso = Var("?userCand('jetForLepJetVar').isNonnull()?(1./userFloat('ptRatio'))-1.:userFloat('PFIsoAll04_Fall17V2')/pt",float,doc="Relative isolation in matched jet (1/ptRatio-1, pfRelIso04_all if no matched jet in Run2)",precision=8),
pfRelIso04_all = Var("userFloat('PFIsoAll04_Fall17V2')/pt",float,doc="PF relative isolation dR=0.4, total (with rho*EA PU Fall17V2 PU corrections)", precision=10),
)

#############electron Table END#####################
Expand Down
3 changes: 2 additions & 1 deletion PhysicsTools/NanoAOD/python/muons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@
pfRelIso03_chg = Var("pfIsolationR03().sumChargedHadronPt/pt",float,doc="PF relative isolation dR=0.3, charged component"),
pfRelIso03_all = Var("(pfIsolationR03().sumChargedHadronPt + max(pfIsolationR03().sumNeutralHadronEt + pfIsolationR03().sumPhotonEt - pfIsolationR03().sumPUPt/2,0.0))/pt",float,doc="PF relative isolation dR=0.3, total (deltaBeta corrections)"),
pfRelIso04_all = Var("(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))/pt",float,doc="PF relative isolation dR=0.4, total (deltaBeta corrections)"),
jetRelIso = Var("?userCand('jetForLepJetVar').isNonnull()?(1./userFloat('ptRatio'))-1.:(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))/pt",float,doc="Relative isolation in matched jet (1/ptRatio-1, pfRelIso04_all if no matched jet)",precision=8),
jetPtRatio = Var("?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRatio'):-1.",float,doc="ratio of muon pt to the associated jet pt (-1. if none)",precision=10),
jetPtRelv2 = Var("?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRel'):0",float,doc="Relative momentum of the lepton with respect to the closest jet after subtracting the lepton",precision=8),
jetDF = Var("?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probbb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:problepb'),0.0):0.0",float,doc="value of the DEEPJET b tagging algorithm discriminator of the associated jet (0 if none)",precision=8,lazyEval=True),
tightCharge = Var("?(muonBestTrack().ptError()/muonBestTrack().pt() < 0.2)?2:0", "uint8", doc="Tight charge criterion using pterr/pt of muonBestTrack (0:fail, 2:pass)"),
looseId = Var("passed('CutBasedIdLoose')",bool, doc="muon is loose muon"),
isPFcand = Var("isPFMuon",bool,doc="muon is PF candidate"),
Expand Down
8 changes: 5 additions & 3 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
Plot1D('isPFcand', 'isPFcand', 2, -0.5, 1.5, 'electron is PF candidate'),
NoPlot('jetIdx'),
Plot1D('jetPtRelv2', 'jetPtRelv2', 20, 0, 60, 'Relative momentum of the lepton with respect to the closest jet after subtracting the lepton'),
Plot1D('jetRelIso', 'jetRelIso', 20, -0.2, 1.8, 'Relative isolation in matched jet (1/ptRatio-1, pfRelIso04_all if no matched jet)'),
Plot1D('jetRelIso_Fall17V2', 'jetRelIso_Fall17V2', 20, -0.2, 1.8, 'Relative isolation in matched jet (1/ptRatio-1, pfRelIso04_all if no matched jet)'),
Plot1D('jetPtRatio', 'jetPtRatio', 20, 0., 1., 'ratio of electron pt to the associated jet pt (-1. if none)'),
Plot1D('jetDF', 'jetDF', 20, 0., 1., 'value of the DEEPJET b tagging algorithm discriminator of the associated jet (0 if none)'),
Plot1D('lostHits', 'lostHits', 4, -0.5, 3.5, 'number of missing inner hits'),
Plot1D('jetNDauCharged', 'jetNDauCharged', 20, -0.5, 19.5, 'number of charged daughters of the closest jet'),
NoPlot('mass'),
Expand All @@ -107,6 +107,7 @@
Plot1D('miniPFRelIso_chg', 'miniPFRelIso_chg', 20, 0, 1, 'mini PF relative isolation, charged component'),
Plot1D('pfRelIso03_all', 'pfRelIso03_all', 20, 0, 2, 'PF relative isolation dR=0.3, total (with rho*EA PU corrections)'),
Plot1D('pfRelIso03_chg', 'pfRelIso03_chg', 20, 0, 2, 'PF relative isolation dR=0.3, charged component'),
Plot1D('pfRelIso04_all', 'pfRelIso04_all', 20, 0, 2, 'PF relative isolation dR=0.4, total (with rho*EA PU corrections)'),
Plot1D('miniPFRelIso_all_Fall17V2', 'miniPFRelIso_all_Fall17V2', 20, 0, 1, 'mini PF relative isolation, total (with scaled rho*EA PU corrections)'),
Plot1D('miniPFRelIso_chg_Fall17V2', 'miniPFRelIso_chg_Fall17V2', 20, 0, 1, 'mini PF relative isolation, charged component'),
Plot1D('pfRelIso03_all_Fall17V2', 'pfRelIso03_all_Fall17V2', 20, 0, 2, 'PF relative isolation dR=0.3 with 94 EffArea, total (with rho*EA PU corrections)'),
Expand Down Expand Up @@ -548,7 +549,8 @@
Plot1D('isStandalone', 'isStandalone', 2, -0.5, 1.5, 'muon is a standalone muon'),
NoPlot('jetIdx'),
Plot1D('jetPtRelv2', 'jetPtRelv2', 20, 0, 30, 'Relative momentum of the lepton with respect to the closest jet after subtracting the lepton'),
Plot1D('jetRelIso', 'jetRelIso', 20, -0.2, 1.8, 'Relative isolation in matched jet (1/ptRatio-1, pfRelIso04_all if no matched jet)'),
Plot1D('jetPtRatio', 'jetPtRatio', 20, 0., 1., 'ratio of muon pt to the associated jet pt (-1. if none)'),
Plot1D('jetDF', 'jetDF', 20, 0., 1., 'value of the DEEPJET b tagging algorithm discriminator of the associated jet (0 if none)'),
Plot1D('looseId', 'looseId', 2, -0.5, 1.5, 'muon is loose muon'),
NoPlot('mass'),
Profile1D('mediumId', 'mediumId', 'pt', 16, 0, 80, 'POG Medium muon ID (using the relaxed cuts in the data Run 2016 B-F periods, and standard cuts elsewhere)'),
Expand Down