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

[JMENanoAOD] Setup DQM and increase precision of PileUp ID & QGL input variables #40232

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions DQMOffline/Configuration/python/DQMOfflineMC_cff.py
Expand Up @@ -33,3 +33,5 @@
from PhysicsTools.NanoAOD.nanoDQM_cff import nanoDQMMC
DQMOfflineNanoAOD.replace(nanoDQM, nanoDQMMC)
#PostDQMOfflineNanoAOD.replace(nanoDQM, nanoDQMMC)
from PhysicsTools.NanoAOD.nanojmeDQM_cff import nanojmeDQMMC
DQMOfflineNanoJME.replace(nanojmeDQM, nanojmeDQMMC)
2 changes: 2 additions & 0 deletions DQMOffline/Configuration/python/DQMOffline_cff.py
Expand Up @@ -275,3 +275,5 @@
#PostDQMOfflineNanoAOD = cms.Sequence(nanoDQM)
from PhysicsTools.NanoAOD.nanogenDQM_cff import nanogenDQM
DQMOfflineNanoGen = cms.Sequence(nanogenDQM)
from PhysicsTools.NanoAOD.nanojmeDQM_cff import nanojmeDQM
DQMOfflineNanoJME = cms.Sequence(nanojmeDQM)
4 changes: 4 additions & 0 deletions DQMOffline/Configuration/python/autoDQM.py
Expand Up @@ -206,6 +206,10 @@
'PostDQMOffline',
'DQMHarvestNanoAOD'],

'nanojmeDQM': ['DQMOfflineNanoJME',
'PostDQMOffline',
'DQMHarvestNanoAOD'],

'pfDQM': ['DQMOfflinePF+DQMOfflinePFExtended',
'PostDQMOffline',
'DQMHarvestPF'],
Expand Down
54 changes: 38 additions & 16 deletions PhysicsTools/NanoAOD/python/custom_jme_cff.py
Expand Up @@ -105,7 +105,7 @@
nanoInfo_recojets = {
"ak4calo" : {
"name": "JetCalo",
"doc" : "AK4 Calo jets with JECs applied",
"doc" : "AK4 Calo jets (slimmedCaloJets)",
},
"ak4pf" : {
"name" : "JetPF",
Expand Down Expand Up @@ -144,23 +144,23 @@
nConstPhotons = Var("photonMultiplicity()",int,doc="number of photons in the jet"),
)
PUIDVARS = cms.PSet(
puId_dR2Mean = Var("?(pt>=10)?userFloat('puId_dR2Mean'):-1",float,doc="pT^2-weighted average square distance of jet constituents from the jet axis (PileUp ID BDT input variable)", precision=6),
puId_majW = Var("?(pt>=10)?userFloat('puId_majW'):-1",float,doc="major axis of jet ellipsoid in eta-phi plane (PileUp ID BDT input variable)", precision=6),
puId_minW = Var("?(pt>=10)?userFloat('puId_minW'):-1",float,doc="minor axis of jet ellipsoid in eta-phi plane (PileUp ID BDT input variable)", precision=6),
puId_frac01 = Var("?(pt>=10)?userFloat('puId_frac01'):-1",float,doc="fraction of constituents' pT contained within dR <0.1 (PileUp ID BDT input variable)", precision=6),
puId_frac02 = Var("?(pt>=10)?userFloat('puId_frac02'):-1",float,doc="fraction of constituents' pT contained within 0.1< dR <0.2 (PileUp ID BDT input variable)", precision=6),
puId_frac03 = Var("?(pt>=10)?userFloat('puId_frac03'):-1",float,doc="fraction of constituents' pT contained within 0.2< dR <0.3 (PileUp ID BDT input variable)", precision=6),
puId_frac04 = Var("?(pt>=10)?userFloat('puId_frac04'):-1",float,doc="fraction of constituents' pT contained within 0.3< dR <0.4 (PileUp ID BDT input variable)", precision=6),
puId_ptD = Var("?(pt>=10)?userFloat('puId_ptD'):-1",float,doc="pT-weighted average pT of constituents (PileUp ID BDT input variable)", precision=6),
puId_beta = Var("?(pt>=10)?userFloat('puId_beta'):-1",float,doc="fraction of pT of charged constituents associated to PV (PileUp ID BDT input variable)", precision=6),
puId_pull = Var("?(pt>=10)?userFloat('puId_pull'):-1",float,doc="magnitude of pull vector (PileUp ID BDT input variable)", precision=6),
puId_jetR = Var("?(pt>=10)?userFloat('puId_jetR'):-1",float,doc="fraction of jet pT carried by the leading constituent (PileUp ID BDT input variable)", precision=6),
puId_jetRchg = Var("?(pt>=10)?userFloat('puId_jetRchg'):-1",float,doc="fraction of jet pT carried by the leading charged constituent (PileUp ID BDT input variable)", precision=6),
puId_dR2Mean = Var("?(pt>=10)?userFloat('puId_dR2Mean'):-1",float,doc="pT^2-weighted average square distance of jet constituents from the jet axis (PileUp ID BDT input variable)", precision=14),
puId_majW = Var("?(pt>=10)?userFloat('puId_majW'):-1",float,doc="major axis of jet ellipsoid in eta-phi plane (PileUp ID BDT input variable)", precision=14),
puId_minW = Var("?(pt>=10)?userFloat('puId_minW'):-1",float,doc="minor axis of jet ellipsoid in eta-phi plane (PileUp ID BDT input variable)", precision=14),
puId_frac01 = Var("?(pt>=10)?userFloat('puId_frac01'):-1",float,doc="fraction of constituents' pT contained within dR <0.1 (PileUp ID BDT input variable)", precision=14),
puId_frac02 = Var("?(pt>=10)?userFloat('puId_frac02'):-1",float,doc="fraction of constituents' pT contained within 0.1< dR <0.2 (PileUp ID BDT input variable)", precision=14),
puId_frac03 = Var("?(pt>=10)?userFloat('puId_frac03'):-1",float,doc="fraction of constituents' pT contained within 0.2< dR <0.3 (PileUp ID BDT input variable)", precision=14),
puId_frac04 = Var("?(pt>=10)?userFloat('puId_frac04'):-1",float,doc="fraction of constituents' pT contained within 0.3< dR <0.4 (PileUp ID BDT input variable)", precision=14),
puId_ptD = Var("?(pt>=10)?userFloat('puId_ptD'):-1",float,doc="pT-weighted average pT of constituents (PileUp ID BDT input variable)", precision=14),
puId_beta = Var("?(pt>=10)?userFloat('puId_beta'):-1",float,doc="fraction of pT of charged constituents associated to PV (PileUp ID BDT input variable)", precision=14),
puId_pull = Var("?(pt>=10)?userFloat('puId_pull'):-1",float,doc="magnitude of pull vector (PileUp ID BDT input variable)", precision=14),
puId_jetR = Var("?(pt>=10)?userFloat('puId_jetR'):-1",float,doc="fraction of jet pT carried by the leading constituent (PileUp ID BDT input variable)", precision=14),
puId_jetRchg = Var("?(pt>=10)?userFloat('puId_jetRchg'):-1",float,doc="fraction of jet pT carried by the leading charged constituent (PileUp ID BDT input variable)", precision=14),
puId_nCharged = Var("?(pt>=10)?userInt('puId_nCharged'):-1",int,doc="number of charged constituents (PileUp ID BDT input variable)"),
)
QGLVARS = cms.PSet(
qgl_axis2 = Var("?(pt>=10)?userFloat('qgl_axis2'):-1",float,doc="ellipse minor jet axis (Quark vs Gluon likelihood input variable)", precision=10),
qgl_ptD = Var("?(pt>=10)?userFloat('qgl_ptD'):-1",float,doc="pT-weighted average pT of constituents (Quark vs Gluon likelihood input variable)", precision=10),
qgl_axis2 = Var("?(pt>=10)?userFloat('qgl_axis2'):-1",float,doc="ellipse minor jet axis (Quark vs Gluon likelihood input variable)", precision=14),
qgl_ptD = Var("?(pt>=10)?userFloat('qgl_ptD'):-1",float,doc="pT-weighted average pT of constituents (Quark vs Gluon likelihood input variable)", precision=14),
qgl_mult = Var("?(pt>=10)?userInt('qgl_mult'):-1", int,doc="PF candidates multiplicity (Quark vs Gluon likelihood input variable)"),
)
BTAGVARS = cms.PSet(
Expand All @@ -183,6 +183,7 @@
particleNetAK4_CvsL = Var("?(pt>=15)?bDiscriminator('pfParticleNetAK4DiscriminatorsJetTags:CvsL'):-1",float,doc="ParticleNetAK4 tagger c vs udsg discriminator",precision=10),
particleNetAK4_CvsB = Var("?(pt>=15)?bDiscriminator('pfParticleNetAK4DiscriminatorsJetTags:CvsB'):-1",float,doc="ParticleNetAK4 tagger c vs b discriminator",precision=10),
particleNetAK4_QvsG = Var("?(pt>=15)?bDiscriminator('pfParticleNetAK4DiscriminatorsJetTags:QvsG'):-1",float,doc="ParticleNetAK4 tagger uds vs g discriminator",precision=10),
particleNetAK4_G = Var("?(pt>=15)?bDiscriminator('pfParticleNetAK4DiscriminatorsJetTags:probg'):-1",float,doc="ParticleNetAK4 tagger g raw score",precision=10),
particleNetAK4_puIdDisc = Var("?(pt>=15)?1-bDiscriminator('pfParticleNetAK4JetTags:probpu'):-1",float,doc="ParticleNetAK4 tagger pileup jet discriminator",precision=10),
)

Expand All @@ -205,7 +206,7 @@ def AddJetID(proc, jetName="", jetSrc="", jetTableName="", jetTaskName=""):
Setup modules to calculate PF jet ID
"""

isPUPPIJet = True if "Puppi" in jetName else False
isPUPPIJet = True if "PUPPI" in jetName.upper() else False

looseJetId = "looseJetId{}".format(jetName)
setattr(proc, looseJetId, proc.looseJetId.clone(
Expand Down Expand Up @@ -234,6 +235,12 @@ def AddJetID(proc, jetName="", jetSrc="", jetTableName="", jetTaskName=""):
)
)

run2_jme_2016.toModify(
getattr(proc, tightJetId).filterParams, version = "RUN2UL16{}".format("PUPPI" if isPUPPIJet else "CHS")
).toModify(
getattr(proc, tightJetIdLepVeto).filterParams, version = "RUN2UL16{}".format("PUPPI" if isPUPPIJet else "CHS")
)

#
# Save variables as userInts in each jet
#
Expand Down Expand Up @@ -386,6 +393,7 @@ def AddParticleNetAK4Scores(proc, jetTableName=""):
getattr(proc, jetTableName).variables.particleNetAK4_CvsL = PARTICLENETAK4VARS.particleNetAK4_CvsL
getattr(proc, jetTableName).variables.particleNetAK4_CvsB = PARTICLENETAK4VARS.particleNetAK4_CvsB
getattr(proc, jetTableName).variables.particleNetAK4_QvsG = PARTICLENETAK4VARS.particleNetAK4_QvsG
getattr(proc, jetTableName).variables.particleNetAK4_G = PARTICLENETAK4VARS.particleNetAK4_G
getattr(proc, jetTableName).variables.particleNetAK4_puIdDisc = PARTICLENETAK4VARS.particleNetAK4_puIdDisc

return proc
Expand Down Expand Up @@ -480,6 +488,9 @@ def SavePatJets(proc, jetName, payload, patJetFinalColl, jetTablePrefix, jetTabl
if runOnMC:
jetTableDocDefault += "For jets with pt < {ptcut:.0f} GeV, only those matched to gen jets are stored.".format(ptcut=ptcut)

if doCalo:
jetTableDocDefault = jetTableDoc

jetTableName = "jet{}Table".format(jetName)
setattr(proc,jetTableName, simpleCandidateFlatTableProducer.clone(
src = cms.InputTag(finalJetsForTable),
Expand Down Expand Up @@ -578,6 +589,15 @@ def ReclusterAK4PuppiJets(proc, recoJA, runOnMC):
jetName = recoJetInfo.jetUpper
patJetFinalColl = recoJetInfo.patJetFinalCollection

#
# Set the jetID for UL 16 era
#
run2_jme_2016.toModify(
proc.tightJetPuppiId.filterParams, version = "RUN2UL16PUPPI"
).toModify(
proc.tightJetIdLepVeto.filterParams, version = "RUN2UL16PUPPI"
)

#
# Change the input jet source for jetCorrFactorsNano
# and updatedJets
Expand Down Expand Up @@ -683,6 +703,7 @@ def ReclusterAK4PuppiJets(proc, recoJA, runOnMC):
proc.jetPuppiTable.variables.particleNetAK4_CvsL = PARTICLENETAK4VARS.particleNetAK4_CvsL
proc.jetPuppiTable.variables.particleNetAK4_CvsB = PARTICLENETAK4VARS.particleNetAK4_CvsB
proc.jetPuppiTable.variables.particleNetAK4_QvsG = PARTICLENETAK4VARS.particleNetAK4_QvsG
proc.jetPuppiTable.variables.particleNetAK4_G = PARTICLENETAK4VARS.particleNetAK4_G
proc.jetPuppiTable.variables.particleNetAK4_puIdDisc = PARTICLENETAK4VARS.particleNetAK4_puIdDisc

#
Expand Down Expand Up @@ -857,6 +878,7 @@ def ReclusterAK4CHSJets(proc, recoJA, runOnMC):
proc.jetTable.variables.particleNetAK4_CvsL = PARTICLENETAK4VARS.particleNetAK4_CvsL
proc.jetTable.variables.particleNetAK4_CvsB = PARTICLENETAK4VARS.particleNetAK4_CvsB
proc.jetTable.variables.particleNetAK4_QvsG = PARTICLENETAK4VARS.particleNetAK4_QvsG
proc.jetTable.variables.particleNetAK4_G = PARTICLENETAK4VARS.particleNetAK4_G
proc.jetTable.variables.particleNetAK4_puIdDisc = PARTICLENETAK4VARS.particleNetAK4_puIdDisc

#Adding hf shower shape producer to the jet sequence. By default this producer is not automatically rerun at the NANOAOD step
Expand Down