Skip to content

Commit

Permalink
Merge pull request #1 from sroychow/vars106x
Browse files Browse the repository at this point in the history
Backport of new variables for muons and isotracks & customize func of increased gen precision
  • Loading branch information
mdunser committed Apr 7, 2021
2 parents c6de68d + 22aff3a commit ebf5f93
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions PhysicsTools/NanoAOD/python/isotracks_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
fromPV = Var("fromPV", int, doc="isolated track comes from PV"),
pdgId = Var("pdgId",int,doc="PDG id of PF cand"),
isHighPurityTrack = Var("isHighPurityTrack",bool,doc="track is high purity"),
charge = Var("charge", int, doc="electric charge"),
),
externalVariables = cms.PSet(
miniPFRelIso_chg = ExtVar("isoForIsoTk:miniIsoChg",float,doc="mini PF relative isolation, charged component",precision=10),
Expand All @@ -50,6 +51,8 @@
),
)

(run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(isoTrackTable.variables, charge = None)

isoTrackSequence = cms.Sequence(finalIsolatedTracks + isoForIsoTk + isFromLostTrackForIsoTk)
isoTrackTables = cms.Sequence(isoTrackTable)

2 changes: 2 additions & 0 deletions PhysicsTools/NanoAOD/python/muons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
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"),
isStandalone = Var("isStandAloneMuon",bool,doc="muon is a standalone muon"),
mediumId = Var("passed('CutBasedIdMedium')",bool,doc="cut-based ID, medium WP"),
mediumPromptId = Var("passed('CutBasedIdMediumPrompt')",bool,doc="cut-based ID, medium prompt WP"),
tightId = Var("passed('CutBasedIdTight')",bool,doc="cut-based ID, tight WP"),
Expand Down Expand Up @@ -184,6 +185,7 @@

run2_nanoAOD_102Xv1.toModify(muonTable.variables, puppiIsoId = None)

(run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(muonTable.variables, isStandalone = None)

muonsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR
src = muonTable.src, # final reco collection
Expand Down
7 changes: 7 additions & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@

run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots, IsoTrack = None)

#remove new plots from old campaign
_Muon_noIsStandalone = [plot for plot in nanoDQM.vplots.Muon.plots if plot.name.value() != 'isStandalone']
(run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.Muon, plots = _Muon_noIsStandalone)
_Isotk_nocharge = [plot for plot in nanoDQM.vplots.IsoTrack.plots if plot.name.value() != 'charge']
(run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.IsoTrack, plots = _Isotk_nocharge)


## MC
nanoDQMMC = nanoDQM.clone()
nanoDQMMC.vplots.Electron.sels.Prompt = cms.string("genPartFlav == 1")
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 @@ -330,6 +330,7 @@
Plot1D('pfRelIso03_chg', 'pfRelIso03_chg', 20, 0, 2, 'PF relative isolation dR=0.3, charged component'),
Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'),
Plot1D('pt', 'pt', 20, 0, 200, 'pt'),
Plot1D('charge', 'charge', 3, -1.5, 1.5, 'electric charge'),
)
),
Jet = cms.PSet(
Expand Down Expand Up @@ -457,6 +458,7 @@
Plot1D('isGlobal', 'isGlobal', 2, -0.5, 1.5, 'muon is global muon'),
Plot1D('isPFcand', 'isPFcand', 2, -0.5, 1.5, 'muon is PF candidate'),
Plot1D('isTracker', 'isTracker', 2, -0.5, 1.5, 'muon is tracker muon'),
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)'),
Expand Down
11 changes: 11 additions & 0 deletions PhysicsTools/NanoAOD/python/nano_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,17 @@ def nanoAOD_customizeMC(process):
modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False))
return process

def nanoWmassGenCustomize(process):
pdgSelection="?(abs(pdgId) == 11|| abs(pdgId)==13 || abs(pdgId)==15 ||abs(pdgId)== 12 || abs(pdgId)== 14 || abs(pdgId)== 16|| abs(pdgId)==24|| pdgId== 23)"
# Keep precision same as default RECO for selected particles
ptPrecision="{}?{}:{}".format(pdgSelection, CandVars.pt.precision.value(),genParticleTable.variables.pt.precision.value())
process.genParticleTable.variables.pt.precision=cms.string(ptPrecision)
phiPrecision="{} ? {} : {}".format(pdgSelection, CandVars.phi.precision.value(), genParticleTable.variables.phi.precision.value())
process.genParticleTable.variables.phi.precision=cms.string(phiPrecision)
etaPrecision="{} ? {} : {}".format(pdgSelection, CandVars.eta.precision.value(), genParticleTable.variables.eta.precision.value())
process.genParticleTable.variables.eta.precision=cms.string(etaPrecision)
return process

### Era dependent customization
_80x_sequence = nanoSequenceCommon.copy()
#remove stuff
Expand Down

0 comments on commit ebf5f93

Please sign in to comment.