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

Enabling re-application of Type1 Corrections for PuppiMET and adding PUPPI MET Uncertainties #30922

Merged
merged 11 commits into from Sep 16, 2020
8 changes: 8 additions & 0 deletions PhysicsTools/NanoAOD/python/met_cff.py
Expand Up @@ -61,9 +61,17 @@
variables = cms.PSet(PTVars,
sumEt = Var("sumEt()", float, doc="scalar sum of Et",precision=10),
ptJERUp = Var("shiftedPt('JetResUp')", float, doc="JER up pt",precision=10),
ptJERDown = Var("shiftedPt('JetResDown')", float, doc="JER down pt",precision=10),
phiJERUp = Var("shiftedPhi('JetResUp')", float, doc="JER up phi",precision=10),
phiJERDown = Var("shiftedPhi('JetResDown')", float, doc="JER down phi",precision=10),
ptJESUp = Var("shiftedPt('JetEnUp')", float, doc="JES up pt",precision=10),
ptJESDown = Var("shiftedPt('JetEnDown')", float, doc="JES down pt",precision=10),
phiJESUp = Var("shiftedPhi('JetEnUp')", float, doc="JES up phi",precision=10),
phiJESDown = Var("shiftedPhi('JetEnDown')", float, doc="JES down phi",precision=10),
ptUnclusteredUp = Var("shiftedPt('UnclusteredEnUp')", float, doc="Unclustered up pt",precision=10),
ptUnclusteredDown = Var("shiftedPt('UnclusteredEnDown')", float, doc="Unclustered down pt",precision=10),
phiUnclusteredUp = Var("shiftedPhi('UnclusteredEnUp')", float, doc="Unclustered up phi",precision=10),
phiUnclusteredDown = Var("shiftedPhi('UnclusteredEnDown')", float, doc="Unclustered down phi",precision=10),
),
)

Expand Down
8 changes: 8 additions & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Expand Up @@ -502,10 +502,18 @@
plots = cms.VPSet(
Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'),
Plot1D('phiJERUp', 'phiJERUp', 20, -3.14159, 3.14159, 'JER up phi'),
Plot1D('phiJERDown', 'phiJERDown', 20, -3.14159, 3.14159, 'JER down phi'),
Plot1D('phiJESUp', 'phiJESUp', 20, -3.14159, 3.14159, 'JES up phi'),
Plot1D('phiJESDown', 'phiJESDown', 20, -3.14159, 3.14159, 'JES down phi'),
Plot1D('phiUnclusteredUp', 'phiUnclusteredUp', 20, -3.14159, 3.14159, 'Unclustered up phi'),
Plot1D('phiUnclusteredDown', 'phiUnclusteredDown', 20, -3.14159, 3.14159, 'Unclustered down phi'),
Plot1D('pt', 'pt', 20, 0, 400, 'pt'),
Plot1D('ptJERUp', 'ptJERUp', 20, 0, 400, 'JER up pt'),
Plot1D('ptJERDown', 'ptJERDown', 20, 0, 400, 'JER down pt'),
Plot1D('ptJESUp', 'ptJESUp', 20, 0, 400, 'JES up pt'),
Plot1D('ptJESDown', 'ptJESDown', 20, 0, 400, 'JES down pt'),
Plot1D('ptUnclusteredUp', 'ptUnclusteredUp', 20, 0, 400, 'Unclustered up pt'),
Plot1D('ptUnclusteredDown', 'ptUnclusteredDown', 20, 0, 400, 'Unclustered down pt'),
Plot1D('sumEt', 'sumEt', 20, 200, 3000, 'scalar sum of Et'),
)
),
Expand Down
14 changes: 8 additions & 6 deletions PhysicsTools/NanoAOD/python/nano_cff.py
Expand Up @@ -177,7 +177,7 @@ def nanoAOD_addDeepInfo(process,addDeepBTag,addDeepFlavour):
return process

from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD
#from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD
from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD
def nanoAOD_recalibrateMETs(process,isData):
runMetCorAndUncFromMiniAOD(process,isData=isData)
process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.fullPatMetSequence))
Expand All @@ -195,10 +195,8 @@ def nanoAOD_recalibrateMETs(process,isData):
table.variables.muonSubtrFactor = Var("1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc="1-(muon-subtracted raw pt)/(raw pt)",precision=6)
process.metTables += process.corrT1METJetTable
# makePuppiesFromMiniAOD(process,True) # call this before in the global customizer otherwise it would reset photon IDs in VID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we clean up this call ? same lines
process.puppiNoLep.useExistingWeights = False
process.puppi.useExistingWeights = False

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have now modified this part to explicitly set as True the useExistingWeights as per the previous comment thread

# runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi")
# process.puppiNoLep.useExistingWeights = False
# process.puppi.useExistingWeights = False
# process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(jetSequence),cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi))
runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the followup PR to switch to PUPPI v15 for run2_nanoAOD_106Xv1 consistently for MET, AK4 and AK8, please considered adding the switches "recoMetFromPFCs=True, reclusterJets=True" to runMetCorAndUncFromMiniAOD for run2_nanoAOD_106Xv1 (to recompute MET and Type-1 with v15). And test if it has the desired effect.
@mariadalfonso @alefisico

process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi))
return process

from PhysicsTools.SelectorUtils.tools.vid_id_tools import *
Expand Down Expand Up @@ -266,7 +264,11 @@ def nanoAOD_runMETfixEE2017(process,isData):
process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(jetSequence),process.fullPatMetSequenceFixEE2017)

def nanoAOD_customizeCommon(process):
# makePuppiesFromMiniAOD(process,True) # call this here as it calls switchOnVIDPhotonIdProducer
makePuppiesFromMiniAOD(process,True)
process.puppiNoLep.useExistingWeights = True
process.puppi.useExistingWeights = True
run2_nanoAOD_106Xv1.toModify(process.puppiNoLep, useExistingWeights = False)
run2_nanoAOD_106Xv1.toModify(process.puppi, useExistingWeights = False)
process = nanoAOD_activateVID(process)
nanoAOD_addDeepInfo_switch = cms.PSet(
nanoAOD_addDeepBTag_switch = cms.untracked.bool(False),
Expand Down