-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Implemented new modifiers for mvaTTH Run 3 #44322
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
Changes from 3 commits
ba550c0
c4a8961
63f02c4
f8ae986
5cee24d
bafee58
7dcfa1b
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import FWCore.ParameterSet.Config as cms | ||
|
|
||
| run3_muon_2022=cms.Modifier() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import FWCore.ParameterSet.Config as cms | ||
|
|
||
| run3_muon_2023=cms.Modifier() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -263,11 +263,11 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): | |
| ) | ||
| #################################################finalElectrons##################### | ||
|
|
||
| ################################################electronMVATTH##################### | ||
| electronMVATTH= cms.EDProducer("EleBaseMVAValueMapProducer", | ||
| ################################################electronPROMPTMVA##################### | ||
| electronPROMPTMVA= cms.EDProducer("EleBaseMVAValueMapProducer", | ||
| src = cms.InputTag("linkedObjects","electrons"), | ||
| weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/el_BDTG_2017.weights.xml"), | ||
| name = cms.string("electronMVATTH"), | ||
| name = cms.string("electronPROMPTMVA"), | ||
| isClassifier = cms.bool(True), | ||
| variablesOrder = cms.vstring(["LepGood_pt","LepGood_eta","LepGood_jetNDauChargedMVASel","LepGood_miniRelIsoCharged","LepGood_miniRelIsoNeutral","LepGood_jetPtRelv2","LepGood_jetDF","LepGood_jetPtRatio","LepGood_dxy","LepGood_sip3d","LepGood_dz","LepGood_mvaFall17V2noIso"]), | ||
| variables = cms.PSet( | ||
|
|
@@ -287,10 +287,10 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): | |
| ) | ||
| ) | ||
| run2_egamma_2016.toModify( | ||
| electronMVATTH, | ||
| electronPROMPTMVA, | ||
| weightFile = "PhysicsTools/NanoAOD/data/el_BDTG_2016.weights.xml", | ||
| ) | ||
| ################################################electronMVATTH end##################### | ||
| ################################################electronPROMPTMVA end##################### | ||
|
|
||
| ################################################electronTable defn ##################### | ||
| electronTable = simpleCandidateFlatTableProducer.clone( | ||
|
|
@@ -359,7 +359,7 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): | |
| jetNDauCharged = Var("?userCand('jetForLepJetVar').isNonnull()?userFloat('jetNDauChargedMVASel'):0", "uint8", doc="number of charged daughters of the closest jet"), | ||
| ), | ||
| externalVariables = cms.PSet( | ||
| mvaTTH = ExtVar(cms.InputTag("electronMVATTH"),float, doc="TTH MVA lepton ID score",precision=14), | ||
| promptMVA = ExtVar(cms.InputTag("muonPROMPTMVA"),float, doc="Prompt MVA lepton ID score. Corresponds to the previous mvaTTH",precision=14), | ||
|
||
| fsrPhotonIdx = ExtVar(cms.InputTag("leptonFSRphotons:eleFsrIndex"), "int16", doc="Index of the lowest-dR/ET2 among associated FSR photons"), | ||
| ), | ||
| ) | ||
|
|
@@ -442,7 +442,7 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): | |
| ) | ||
|
|
||
| electronTask = cms.Task(bitmapVIDForEle,bitmapVIDForEleFall17V2,bitmapVIDForEleHEEP,isoForEle,isoForEleFall17V2,ptRatioRelForEle,seedGainEle,calibratedPatElectronsNano,slimmedElectronsWithUserData,finalElectrons) | ||
| electronTablesTask = cms.Task(electronMVATTH, electronTable) | ||
| electronTablesTask = cms.Task(electronPROMPTMVA, electronTable) | ||
| electronMCTask = cms.Task(tautaggerForMatching, matchingElecPhoton, electronsMCMatchForTable, electronsMCMatchForTableAlt, electronMCTable) | ||
|
|
||
| _electronTask_Run2 = electronTask.copy() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,39 +86,76 @@ | |
| cut = cms.string("pt > 3 && track.isNonnull && isLooseMuon") | ||
| ) | ||
|
|
||
| muonMVATTH= cms.EDProducer("MuonBaseMVAValueMapProducer", | ||
| muonPROMPTMVA= cms.EDProducer("MuonBaseMVAValueMapProducer", | ||
| src = cms.InputTag("linkedObjects","muons"), | ||
| weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/mu_BDTG_2017.weights.xml"), | ||
| name = cms.string("muonMVATTH"), | ||
| weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/mu_BDTG_2022.weights.xml"), | ||
| name = cms.string("muonPROMPTMVA"), | ||
| isClassifier = cms.bool(True), | ||
| variablesOrder = cms.vstring(["LepGood_pt","LepGood_eta","LepGood_jetNDauChargedMVASel","LepGood_miniRelIsoCharged","LepGood_miniRelIsoNeutral","LepGood_jetPtRelv2","LepGood_jetDF","LepGood_jetPtRatio","LepGood_dxy","LepGood_sip3d","LepGood_dz","LepGood_segmentComp"]), | ||
| variablesOrder = cms.vstring(["LepGood_pt","LepGood_eta","LepGood_pfRelIso03_all","LepGood_miniRelIsoCharged","LepGood_miniRelIsoNeutral","LepGood_jetNDauChargedMVASel","LepGood_jetPtRelv2","LepGood_jetDF","LepGood_jetPtRatio","LepGood_sip3d","LepGood_dxy","LepGood_dz","LepGood_segmentComp"]), | ||
| variables = cms.PSet( | ||
| LepGood_pt = cms.string("pt"), | ||
| LepGood_eta = cms.string("eta"), | ||
| LepGood_jetNDauChargedMVASel = cms.string("?userCand('jetForLepJetVar').isNonnull()?userFloat('jetNDauChargedMVASel'):0"), | ||
| LepGood_pfRelIso03_all = cms.string("(pfIsolationR03().sumChargedHadronPt + max(pfIsolationR03().sumNeutralHadronEt + pfIsolationR03().sumPhotonEt - pfIsolationR03().sumPUPt/2,0.0))/pt"), | ||
| LepGood_miniRelIsoCharged = cms.string("userFloat('miniIsoChg')/pt"), | ||
| LepGood_miniRelIsoNeutral = cms.string("(userFloat('miniIsoAll')-userFloat('miniIsoChg'))/pt"), | ||
| LepGood_jetNDauChargedMVASel = cms.string("?userCand('jetForLepJetVar').isNonnull()?userFloat('jetNDauChargedMVASel'):0"), | ||
| LepGood_jetPtRelv2 = cms.string("?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRel'):0"), | ||
| LepGood_jetDF = cms.string("?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probbb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:problepb'),0.0):0.0"), | ||
| LepGood_jetPtRatio = cms.string("?userCand('jetForLepJetVar').isNonnull()?min(userFloat('ptRatio'),1.5):1.0/(1.0+(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))/pt)"), | ||
| LepGood_dxy = cms.string("log(abs(dB('PV2D')))"), | ||
| LepGood_sip3d = cms.string("abs(dB('PV3D')/edB('PV3D'))"), | ||
| LepGood_dxy = cms.string("log(abs(dB('PV2D')))"), | ||
| LepGood_dz = cms.string("log(abs(dB('PVDZ')))"), | ||
| LepGood_segmentComp = cms.string("segmentCompatibility"), | ||
|
|
||
| ) | ||
| ) | ||
|
|
||
| muonMVALowPt = muonMVATTH.clone( | ||
| muonMVALowPt = muonPROMPTMVA.clone( | ||
| weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/mu_BDTG_lowpt.weights.xml"), | ||
| name = cms.string("muonMVALowPt"), | ||
| variablesOrder = cms.vstring(["LepGood_pt","LepGood_eta","LepGood_jetNDauChargedMVASel","LepGood_miniRelIsoCharged","LepGood_miniRelIsoNeutral","LepGood_jetPtRelv2","LepGood_jetDF","LepGood_jetPtRatio","LepGood_dxy","LepGood_sip3d","LepGood_dz","LepGood_segmentComp"]), | ||
|
Contributor
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. how about writing the
Contributor
Author
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. You mean to add this inside the
Contributor
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. hard to write down what I meant ; in essence with the least re-writing of the same string is preferred. please note #44392 that I created in a view to streamline that module configuration
Contributor
Author
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. I'm still not sure how to properly do this, although I get the idea and I think it looks better if we simplify it. I have two questions:
|
||
| variables = cms.PSet( | ||
| LepGood_pt = cms.string("pt"), | ||
| LepGood_eta = cms.string("eta"), | ||
| LepGood_jetNDauChargedMVASel = cms.string("?userCand('jetForLepJetVar').isNonnull()?userFloat('jetNDauChargedMVASel'):0"), | ||
| LepGood_miniRelIsoCharged = cms.string("userFloat('miniIsoChg')/pt"), | ||
| LepGood_miniRelIsoNeutral = cms.string("(userFloat('miniIsoAll')-userFloat('miniIsoChg'))/pt"), | ||
| LepGood_jetPtRelv2 = cms.string("?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRel'):0"), | ||
| LepGood_jetDF = cms.string("?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probbb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:problepb'),0.0):0.0"), | ||
| LepGood_jetPtRatio = cms.string("?userCand('jetForLepJetVar').isNonnull()?min(userFloat('ptRatio'),1.5):1.0/(1.0+(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))/pt)"), | ||
| LepGood_dxy = cms.string("log(abs(dB('PV2D')))"), | ||
| LepGood_sip3d = cms.string("abs(dB('PV3D')/edB('PV3D'))"), | ||
| LepGood_dz = cms.string("log(abs(dB('PVDZ')))"), | ||
| LepGood_segmentComp = cms.string("segmentCompatibility"), | ||
| ) | ||
| ) | ||
|
|
||
| run2_muon_2016.toModify( | ||
| muonMVATTH, | ||
| muonPROMPTMVA, | ||
| weightFile = "PhysicsTools/NanoAOD/data/mu_BDTG_2016.weights.xml", | ||
| ) | ||
|
Comment on lines
133
to
136
Contributor
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. Given the
Contributor
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. In the present setup this |
||
|
|
||
| ~run3_muon.toModify( | ||
| muonPROMPTMVA, | ||
| weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/mu_BDTG_2017.weights.xml"), | ||
| variablesOrder = cms.vstring(["LepGood_pt","LepGood_eta","LepGood_jetNDauChargedMVASel","LepGood_miniRelIsoCharged","LepGood_miniRelIsoNeutral","LepGood_jetPtRelv2","LepGood_jetDF","LepGood_jetPtRatio","LepGood_dxy","LepGood_sip3d","LepGood_dz","LepGood_segmentComp"]), | ||
| variables = cms.PSet( | ||
| LepGood_pt = cms.string("pt"), | ||
| LepGood_eta = cms.string("eta"), | ||
| LepGood_jetNDauChargedMVASel = cms.string("?userCand('jetForLepJetVar').isNonnull()?userFloat('jetNDauChargedMVASel'):0"), | ||
| LepGood_miniRelIsoCharged = cms.string("userFloat('miniIsoChg')/pt"), | ||
| LepGood_miniRelIsoNeutral = cms.string("(userFloat('miniIsoAll')-userFloat('miniIsoChg'))/pt"), | ||
| LepGood_jetPtRelv2 = cms.string("?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRel'):0"), | ||
| LepGood_jetDF = cms.string("?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probbb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:problepb'),0.0):0.0"), | ||
| LepGood_jetPtRatio = cms.string("?userCand('jetForLepJetVar').isNonnull()?min(userFloat('ptRatio'),1.5):1.0/(1.0+(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))/pt)"), | ||
| LepGood_dxy = cms.string("log(abs(dB('PV2D')))"), | ||
| LepGood_sip3d = cms.string("abs(dB('PV3D')/edB('PV3D'))"), | ||
| LepGood_dz = cms.string("log(abs(dB('PVDZ')))"), | ||
| LepGood_segmentComp = cms.string("segmentCompatibility"), | ||
|
|
||
| ) | ||
| ) | ||
|
|
||
| from TrackingTools.TransientTrack.TransientTrackBuilder_cfi import * | ||
| muonBSConstrain = cms.EDProducer("MuonBeamspotConstraintValueMapProducer", | ||
| src = cms.InputTag("linkedObjects","muons"), | ||
|
|
@@ -178,7 +215,7 @@ | |
| jetNDauCharged = Var("?userCand('jetForLepJetVar').isNonnull()?userFloat('jetNDauChargedMVASel'):0", "uint8", doc="number of charged daughters of the closest jet"), | ||
| ), | ||
| externalVariables = cms.PSet( | ||
| mvaTTH = ExtVar(cms.InputTag("muonMVATTH"),float, doc="TTH MVA lepton ID score",precision=14), | ||
| promptMVA = ExtVar(cms.InputTag("muonPROMPTMVA"),float, doc="Prompt MVA lepton ID score. Corresponds to the previous mvaTTH",precision=14), | ||
| mvaLowPt = ExtVar(cms.InputTag("muonMVALowPt"),float, doc="Low pt muon ID score",precision=14), | ||
| fsrPhotonIdx = ExtVar(cms.InputTag("leptonFSRphotons:muFsrIndex"), "int16", doc="Index of the lowest-dR/ET2 among associated FSR photons"), | ||
| bsConstrainedPt = ExtVar(cms.InputTag("muonBSConstrain:muonBSConstrainedPt"),float, doc="pT with beamspot constraint",precision=-1), | ||
|
|
@@ -224,5 +261,5 @@ | |
|
|
||
| muonTask = cms.Task(slimmedMuonsUpdated,isoForMu,ptRatioRelForMu,slimmedMuonsWithUserData,finalMuons,finalLooseMuons ) | ||
| muonMCTask = cms.Task(muonsMCMatchForTable,muonMCTable) | ||
| muonTablesTask = cms.Task(muonMVATTH,muonMVALowPt,muonBSConstrain,muonTable,muonMVAID) | ||
| muonTablesTask = cms.Task(muonPROMPTMVA,muonMVALowPt,muonBSConstrain,muonTable,muonMVAID) | ||
|
|
||
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.
How about just defining one
run3_muonModifier? There doesn't seem to be any need (at least in this PR) to define two.