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

[12_6_X] Nano: fix and additions to collection matching, remove cross-cleaning #40234

Merged
Merged
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
2 changes: 1 addition & 1 deletion PhysicsTools/NanoAOD/python/boostedTaus_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)

boostedTauTable = simpleCandidateFlatTableProducer.clone(
src = cms.InputTag("finalBoostedTaus"),
src = cms.InputTag("linkedObjects", "boostedTaus"),
name= cms.string("boostedTau"),
doc = cms.string("slimmedBoostedTaus after basic selection (" + finalBoostedTaus.cut.value()+")"),
variables = cms.PSet() # PSet defined below in era dependent way
Expand Down
3 changes: 2 additions & 1 deletion PhysicsTools/NanoAOD/python/electrons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints):
doc = cms.string("slimmedElectrons after basic selection (" + finalElectrons.cut.value()+")"),
variables = cms.PSet(CandVars,
jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"),
photonIdx = Var("?overlaps('photons').size()>0?overlaps('photons')[0].key():-1", int, doc="index of the associated photon (-1 if none)"),
photonIdx = Var("?overlaps('photons').size()>0?overlaps('photons')[0].key():-1", int, doc="index of the first associated photon (-1 if none)"),
svIdx = Var("?hasUserCand('vertex')?userCand('vertex').key():-1", int, doc="index of matching secondary vertex"),
energyErr = Var("p4Error('P4_COMBINATION')",float,doc="energy error of the cluster-track combination",precision=6),
dz = Var("dB('PVDZ')",float,doc="dz (with sign) wrt first PV, in cm",precision=10),
dzErr = Var("abs(edB('PVDZ'))",float,doc="dz uncertainty, in cm",precision=6),
Expand Down
3 changes: 3 additions & 0 deletions PhysicsTools/NanoAOD/python/jetsAK4_CHS_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@
electronIdx1 = Var("?overlaps('electrons').size()>0?overlaps('electrons')[0].key():-1", int, doc="index of first matching electron"),
electronIdx2 = Var("?overlaps('electrons').size()>1?overlaps('electrons')[1].key():-1", int, doc="index of second matching electron"),
nElectrons = Var("?hasOverlaps('electrons')?overlaps('electrons').size():0", int, doc="number of electrons in the jet"),
svIdx1 = Var("?overlaps('vertices').size()>0?overlaps('vertices')[0].key():-1", int, doc="index of first matching secondary vertex"),
svIdx2 = Var("?overlaps('vertices').size()>1?overlaps('vertices')[1].key():-1", int, doc="index of second matching secondary vertex"),
nSVs = Var("?hasOverlaps('vertices')?overlaps('vertices').size():0", int, doc="number of secondary vertices in the jet"),
btagDeepB = Var("?(bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb'))>=0?bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb'):-1",float,doc="DeepCSV b+bb tag discriminator",precision=10),
btagDeepFlavB = Var("bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb')",float,doc="DeepJet b+bb+lepb tag discriminator",precision=10),
btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10),
Expand Down
3 changes: 3 additions & 0 deletions PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
electronIdx1 = Var("?overlaps('electrons').size()>0?overlaps('electrons')[0].key():-1", int, doc="index of first matching electron"),
electronIdx2 = Var("?overlaps('electrons').size()>1?overlaps('electrons')[1].key():-1", int, doc="index of second matching electron"),
nElectrons = Var("?hasOverlaps('electrons')?overlaps('electrons').size():0", int, doc="number of electrons in the jet"),
svIdx1 = Var("?overlaps('vertices').size()>0?overlaps('vertices')[0].key():-1", int, doc="index of first matching secondary vertex"),
svIdx2 = Var("?overlaps('vertices').size()>1?overlaps('vertices')[1].key():-1", int, doc="index of second matching secondary vertex"),
nSVs = Var("?hasOverlaps('vertices')?overlaps('vertices').size():0", int, doc="number of secondary vertices in the jet"),
btagDeepB = Var("?(bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb'))>=0?bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb'):-1",float,doc="DeepCSV b+bb tag discriminator",precision=10),
btagDeepFlavB = Var("bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb')",float,doc="DeepJet b+bb+lepb tag discriminator",precision=10),
btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10),
Expand Down
6 changes: 2 additions & 4 deletions PhysicsTools/NanoAOD/python/lowPtElectrons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@
variables = cms.PSet(
# Basic variables
CandVars,
# Overlaps with PF electron
# Overlaps with PF electron and photon
electronIdx = Var("?overlaps('electrons').size()>0?overlaps('electrons')[0].key():-1", int, doc="index of the overlapping PF electron (-1 if none)"),
photonIdx = Var("?overlaps('photons').size()>0?overlaps('photons')[0].key():-1", int, doc="index of the first associated photon (-1 if none)"),
# BDT scores and WPs
ID = Var("electronID('ID')",float,doc="ID, BDT (raw) score"),
unbiased = Var("electronID('unbiased')",float,doc="ElectronSeed, pT- and dxy- agnostic BDT (raw) score"),
Expand Down Expand Up @@ -98,9 +99,6 @@
dxyErr = Var("edB('PV2D')",float,doc="dxy uncertainty, in cm",precision=6),
dz = Var("dB('PVDZ')",float,doc="dz (with sign) wrt first PV, in cm",precision=10),
dzErr = Var("abs(edB('PVDZ'))",float,doc="dz uncertainty, in cm",precision=6),
# Cross-referencing
#jetIdx
#photonIdx
),
)

Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/NanoAOD/python/muons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
nTrackerLayers = Var("?track.isNonnull?innerTrack().hitPattern().trackerLayersWithMeasurement():0", int, doc = "number of layers in the tracker"),
highPurity = Var("?track.isNonnull?innerTrack().quality('highPurity'):0", bool, doc = "inner track is high purity"),
jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"),
svIdx = Var("?hasUserCand('vertex')?userCand('vertex').key():-1", int, doc="index of matching secondary vertex"),
tkRelIso = Var("isolationR03().sumPt/tunePMuonBestTrack().pt",float,doc="Tracker-based relative isolation dR=0.3 for highPt, trkIso/tunePpt",precision=6),
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 Down
5 changes: 0 additions & 5 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
plots = cms.VPSet(
Count1D('_size', 8, -0.5, 7.5, 'slimmedElectrons after basic selection (pt > 5 )'),
Plot1D('charge', 'charge', 3, -1.5, 1.5, 'electric charge'),
Plot1D('cleanmask', 'cleanmask', 1, 0.5, 1.5, 'simple cleaning mask with priority to leptons'),
Plot1D('convVeto', 'convVeto', 2, -0.5, 1.5, 'pass conversion veto'),
Plot1D('cutBased', 'cutBased', 5, -0.5, 4.5, 'cut-based ID (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)'),
Plot1D('cutBased_Fall17V2', 'cutBased_Fall17V2', 5, -0.5, 4.5, 'cut-based ID Fall17 V2 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)'),
Expand Down Expand Up @@ -412,7 +411,6 @@
Plot1D('chEmEF', 'chEmEF', 20, 0, 1, 'charged Electromagnetic Energy Fraction'),
Plot1D('chFPV0EF', 'chFPV0EF', 20, 0, 2, 'charged fromPV==0 Energy Fraction (energy excluded from CHS jets). Previously called betastar.'),
Plot1D('chHEF', 'chHEF', 20, 0, 2, 'charged Hadron Energy Fraction'),
Plot1D('cleanmask', 'cleanmask', 2, -0.5, 1.5, 'simple cleaning mask with priority to leptons'),
NoPlot('electronIdx1'),
NoPlot('electronIdx2'),
Plot1D('eta', 'eta', 20, -6, 6, 'eta'),
Expand Down Expand Up @@ -491,7 +489,6 @@
plots = cms.VPSet(
Count1D('_size', 5, -0.5, 4.5, 'slimmedMuons after basic selection (pt > 3 && track.isNonnull && isLooseMuon)'),
Plot1D('charge', 'charge', 3, -1.5, 1.5, 'electric charge'),
Plot1D('cleanmask', 'cleanmask', 2, -0.5, 1.5, 'simple cleaning mask with priority to leptons'),
Plot1D('dxy', 'dxy', 20, -0.1, 0.1, 'dxy (with sign) wrt first PV, in cm'),
Plot1D('dxyErr', 'dxyErr', 20, 0, 0.1, 'dxy uncertainty, in cm'),
Plot1D('dxybs', 'dxybs', 20, -0.1, 0.1, 'dxy (with sign) wrt the beam spot, in cm'),
Expand Down Expand Up @@ -596,7 +593,6 @@
plots = cms.VPSet(
Count1D('_size', 9, -0.5, 8.5, 'slimmedPhotons after basic selection (pt > 5 )'),
Plot1D('charge', 'charge', 1, -0.5, 0.5, 'electric charge'),
Plot1D('cleanmask', 'cleanmask', 1, 0.5, 1.5, 'simple cleaning mask with priority to leptons'),
Plot1D('cutBased', 'cutBased', 4, -0.5, 3.5,'cut-based ID bitmap, (0:fail, 1:loose, 2:medium, 3:tight)'),
Plot1D('cutBased_Fall17V2', 'cutBased_Fall17V2', 4, -0.5, 3.5, 'cut-based ID bitmap, Fall17V2, (0:fail, 1:loose, 2:medium, 3:tight)'),
NoPlot('electronIdx'),
Expand Down Expand Up @@ -775,7 +771,6 @@
Count1D('_size', 7, -0.5, 6.5, "slimmedTaus after basic selection (pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT')))"),
Plot1D('charge', 'charge', 3, -1.5, 1.5, 'electric charge'),
Plot1D('chargedIso', 'chargedIso', 20, 0, 200, 'charged isolation'),
Plot1D('cleanmask', 'cleanmask', 1, 0.5, 1.5, 'simple cleaning mask with priority to leptons'),
Plot1D('decayMode', 'decayMode', 12, -0.5, 11.5, 'decayMode()'),
Plot1D('dxy', 'dxy', 20, -1000, 1000, 'd_{xy} of lead track with respect to PV, in cm (with sign)'),
Plot1D('dz', 'dz', 20, -20, 20, 'd_{z} of lead track with respect to PV, in cm (with sign)'),
Expand Down
26 changes: 6 additions & 20 deletions PhysicsTools/NanoAOD/python/nano_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,21 @@
electrons=cms.InputTag("finalElectrons"),
lowPtElectrons=cms.InputTag("finalLowPtElectrons"),
taus=cms.InputTag("finalTaus"),
boostedTaus=cms.InputTag("finalBoostedTaus"),
photons=cms.InputTag("finalPhotons"),
vertices=cms.InputTag("slimmedSecondaryVertices")
)

# Switch to AK4 CHS jets for Run-2
run2_nanoAOD_ANY.toModify(
linkedObjects, jets="finalJets"
)

simpleCleanerTable = cms.EDProducer("NanoAODSimpleCrossCleaner",
name=cms.string("cleanmask"),
doc=cms.string("simple cleaning mask with priority to leptons"),
jets=cms.InputTag("linkedObjects","jets"),
muons=cms.InputTag("linkedObjects","muons"),
electrons=cms.InputTag("linkedObjects","electrons"),
lowPtElectrons=cms.InputTag("linkedObjects","lowPtElectrons"),
taus=cms.InputTag("linkedObjects","taus"),
photons=cms.InputTag("linkedObjects","photons"),
jetSel=cms.string("pt>15"),
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(""),
lowPtElectronSel=cms.string(""),
tauSel=cms.string(""),
photonSel=cms.string(""),
jetName=cms.string("Jet"),muonName=cms.string("Muon"),electronName=cms.string("Electron"),
lowPtElectronName=cms.string("LowPtElectron"),
tauName=cms.string("Tau"),photonName=cms.string("Photon")
# boosted taus don't exist in 122X MINI
run3_nanoAOD_122.toModify(
linkedObjects, boostedTaus=None,
)


lhcInfoTable = cms.EDProducer("LHCInfoProducer")

nanoTableTaskCommon = cms.Task(
Expand All @@ -82,7 +68,7 @@
jetPuppiTablesTask, jetAK8TablesTask,
muonTablesTask, fsrTablesTask, tauTablesTask, boostedTauTablesTask,
electronTablesTask, lowPtElectronTablesTask, photonTablesTask,
globalTablesTask, vertexTablesTask, metTablesTask, simpleCleanerTable, extraFlagsTableTask,
globalTablesTask, vertexTablesTask, metTablesTask, extraFlagsTableTask,
isoTrackTablesTask,softActivityTablesTask
)

Expand Down
5 changes: 5 additions & 0 deletions PhysicsTools/NanoAOD/python/taus_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ def _tauIdWPMask(pattern, choices, doc="", from_raw=False, wp_thrs=None):
_tauVarsBase = cms.PSet(P4Vars,
charge = Var("charge", int, doc="electric charge"),
jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"),
eleIdx = Var("?overlaps('electrons').size()>0?overlaps('electrons')[0].key():-1", int, doc="index of first matching electron"),
muIdx = Var("?overlaps('muons').size()>0?overlaps('muons')[0].key():-1", int, doc="index of first matching muon"),
svIdx1 = Var("?overlaps('vertices').size()>0?overlaps('vertices')[0].key():-1", int, doc="index of first matching secondary vertex"),
svIdx2 = Var("?overlaps('vertices').size()>1?overlaps('vertices')[1].key():-1", int, doc="index of second matching secondary vertex"),
nSVs = Var("?hasOverlaps('vertices')?overlaps('vertices').size():0", int, doc="number of secondary vertices in the tau"),
decayMode = Var("decayMode()",int),
idDecayModeOldDMs = Var("tauID('decayModeFinding')", bool),

Expand Down
4 changes: 2 additions & 2 deletions PhysicsTools/NanoAOD/python/vertices_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
vertexTable = cms.EDProducer("VertexTableProducer",
pvSrc = cms.InputTag("offlineSlimmedPrimaryVertices"),
goodPvCut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
svSrc = cms.InputTag("slimmedSecondaryVertices"),
svCut = cms.string(""),
svSrc = cms.InputTag("linkedObjects", "vertices"),
svCut = cms.string(""), # careful: adding a cut here would make the collection matching inconsistent with the SV table
dlenMin = cms.double(0),
dlenSigMin = cms.double(3),
pvName = cms.string("PV"),
Expand Down
Loading