Skip to content

Commit

Permalink
Merge pull request cms-sw#360 from sscruz/POG_muon_loose
Browse files Browse the repository at this point in the history
Pog muon loose
  • Loading branch information
peruzzim authored May 15, 2019
2 parents 5d36548 + f2989b9 commit 3f603c6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion PhysicsTools/NanoAOD/python/isotracks_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cut = cms.string("((pt>5 && (abs(pdgId) == 11 || abs(pdgId) == 13)) || pt > 10) && (abs(pdgId) < 15 || abs(eta) < 2.5) && abs(dxy) < 0.2 && abs(dz) < 0.1 && ((pfIsolationDR03().chargedHadronIso < 5 && pt < 25) || pfIsolationDR03().chargedHadronIso/pt < 0.2)"),
finalLeptons = cms.VInputTag(
cms.InputTag("finalElectrons"),
cms.InputTag("finalMuons"),
cms.InputTag("finalLooseMuons"),
),
)

Expand Down
19 changes: 16 additions & 3 deletions PhysicsTools/NanoAOD/python/muons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
run2_miniAOD_80XLegacy.toModify(slimmedMuonsWithUserData, src = "slimmedMuonsUpdated")

finalMuons = cms.EDFilter("PATMuonRefSelector",
src = cms.InputTag("slimmedMuonsWithUserData"),
cut = cms.string("pt > 3 && (passed('CutBasedIdLoose') || passed('SoftCutBasedId') || passed('SoftMvaId') || passed('CutBasedIdGlobalHighPt') || passed('CutBasedIdTrkHighPt'))")
)

finalLooseMuons = cms.EDFilter("PATMuonRefSelector", # for isotrack cleaning
src = cms.InputTag("slimmedMuonsWithUserData"),
cut = cms.string("pt > 3 && track.isNonnull && isLooseMuon")
)
Expand Down Expand Up @@ -74,6 +79,12 @@
)
)

muonMVALowPt = muonMVATTH.clone(
weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/mu_BDTG_lowpt.weights.xml"),
name = cms.string("muonMVALowPt"),
)


for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016:
modifier.toModify(muonMVATTH,
weightFile = "PhysicsTools/NanoAOD/data/mu_BDTG_2016.weights.xml",
Expand All @@ -96,7 +107,7 @@
sip3d = Var("abs(dB('PV3D')/edB('PV3D'))",float,doc="3D impact parameter significance wrt first PV",precision=10),
segmentComp = Var("segmentCompatibility()", float, doc = "muon segment compatibility", precision=14), # keep higher precision since people have cuts with 3 digits on this
nStations = Var("numberOfMatchedStations", int, doc = "number of matched stations with default arbitration (segment & track)"),
nTrackerLayers = Var("innerTrack().hitPattern().trackerLayersWithMeasurement()", int, doc = "number of layers in the tracker"),
nTrackerLayers = Var("?track.isNonnull?innerTrack().hitPattern().trackerLayersWithMeasurement():0", int, doc = "number of layers in the tracker"),
jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"),
miniPFRelIso_chg = Var("userFloat('miniIsoChg')/pt",float,doc="mini PF relative isolation, charged component"),
miniPFRelIso_all = Var("userFloat('miniIsoAll')/pt",float,doc="mini PF relative isolation, total (with scaled rho*EA PU corrections)"),
Expand All @@ -106,6 +117,7 @@
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),
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),
tightCharge = Var("?(muonBestTrack().ptError()/muonBestTrack().pt() < 0.2)?2:0",int,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"),
isGlobal = Var("isGlobalMuon",bool,doc="muon is global muon"),
isTracker = Var("isTrackerMuon",bool,doc="muon is tracker muon"),
Expand All @@ -125,6 +137,7 @@
),
externalVariables = cms.PSet(
mvaTTH = ExtVar(cms.InputTag("muonMVATTH"),float, doc="TTH MVA lepton ID score",precision=14),
mvaLowPt = ExtVar(cms.InputTag("muonMVALowPt"),float, doc="Low pt muon ID score",precision=14),
),
)

Expand All @@ -150,9 +163,9 @@
docString = cms.string("MC matching to status==1 muons"),
)

muonSequence = cms.Sequence(isoForMu + ptRatioRelForMu + slimmedMuonsWithUserData + finalMuons)
muonSequence = cms.Sequence(isoForMu + ptRatioRelForMu + slimmedMuonsWithUserData + finalMuons + finalLooseMuons)
muonMC = cms.Sequence(muonsMCMatchForTable + muonMCTable)
muonTables = cms.Sequence(muonMVATTH + muonTable)
muonTables = cms.Sequence(muonMVATTH + muonMVALowPt + muonTable)

_withUpdate_sequence = muonSequence.copy()
_withUpdate_sequence.replace(isoForMu, slimmedMuonsUpdated+isoForMu)
Expand Down
2 changes: 2 additions & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@
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('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)'),
Plot1D('mediumPromptId', 'mediumPromptId', 2, -0.5, 1.5, 'cut-based ID, medium prompt WP'),
Expand All @@ -357,6 +358,7 @@
Plot1D('miniPFRelIso_chg', 'miniPFRelIso_chg', 20, 0, 1, 'mini PF relative isolation, charged component'),
Plot1D('multiIsoId', 'multiIsoId', 3, -0.5, 2.5, 'MultiIsoId from miniAOD selector (1=MultiIsoLoose, 2=MultiIsoMedium)'),
Plot1D('mvaId', 'mvaId', 4, -0.5, 3.5, 'Mva ID from miniAOD selector (1=MvaLoose, 2=MvaMedium, 3=MvaTight)'),
Plot1D('mvaLowPt', 'mvaLowPt', 20, -1, 1, 'Low pt muon ID score'),
Plot1D('mvaTTH', 'mvaTTH', 20, -1, 1, 'TTH MVA lepton ID score'),
Plot1D('nStations', 'nStations', 5, -0.5, 4.5, 'number of matched stations with default arbitration (segment & track)'),
Plot1D('nTrackerLayers', 'nTrackerLayers', 15, 2.5, 17.5, 'number of layers in the tracker'),
Expand Down
2 changes: 1 addition & 1 deletion PhysicsTools/NanoAOD/python/nano_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
taus=cms.InputTag("linkedObjects","taus"),
photons=cms.InputTag("linkedObjects","photons"),
jetSel=cms.string("pt>15"),
muonSel=cms.string("isPFMuon && innerTrack.validFraction >= 0.49 && ( isGlobalMuon && globalTrack.normalizedChi2 < 3 && combinedQuality.chi2LocalPosition < 12 && combinedQuality.trkKink < 20 && segmentCompatibility >= 0.303 || segmentCompatibility >= 0.451 )"),
muonSel=cms.string("track.isNonnull && isLooseMuon && isPFMuon && innerTrack.validFraction >= 0.49 && ( isGlobalMuon && globalTrack.normalizedChi2 < 3 && combinedQuality.chi2LocalPosition < 12 && combinedQuality.trkKink < 20 && segmentCompatibility >= 0.303 || segmentCompatibility >= 0.451 )"),
electronSel=cms.string(""),
tauSel=cms.string(""),
photonSel=cms.string(""),
Expand Down

0 comments on commit 3f603c6

Please sign in to comment.