Skip to content

Commit 594115f

Browse files
committed
adding PUPPIv15 to PUPPIMET
1 parent 3c9bd1b commit 594115f

File tree

2 files changed

+80
-74
lines changed

2 files changed

+80
-74
lines changed

PhysicsTools/NanoAOD/python/nano_cff.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
discNames = cms.vstring(
6565
"pfCombinedInclusiveSecondaryVertexV2BJetTags",
6666
"pfDeepCSVJetTags:probb+pfDeepCSVJetTags:probbb", #if multiple MiniAOD branches need to be summed up (e.g., DeepCSV b+bb), separate them using '+' delimiter
67-
"pfCombinedMVAV2BJetTags"
67+
"pfCombinedMVAV2BJetTags"
6868
),
6969
discShortNames = cms.vstring(
7070
"CSVV2",
@@ -73,7 +73,7 @@
7373
),
7474
weightFiles = cms.vstring( #default settings are for 2017 94X. toModify function is called later for other eras.
7575
btagSFdir+"CSVv2_94XSF_V2_B_F.csv",
76-
btagSFdir+"DeepCSV_94XSF_V2_B_F.csv",
76+
btagSFdir+"DeepCSV_94XSF_V2_B_F.csv",
7777
"unavailable" #if SFs for an algorithm in an era is unavailable, the corresponding branch will not be stored
7878
),
7979
operatingPoints = cms.vstring("3","3","3"), #loose = 0, medium = 1, tight = 2, reshaping = 3
@@ -84,20 +84,20 @@
8484
)
8585

8686
for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016: # to be updated when SF for Summer16MiniAODv3 MC will be available
87-
modifier.toModify(btagWeightTable,
87+
modifier.toModify(btagWeightTable,
8888
cut = cms.string("pt > 25. && abs(eta) < 2.4"), #80X corresponds to 2016, |eta| < 2.4
8989
weightFiles = cms.vstring( #80X corresponds to 2016 SFs
90-
btagSFdir+"CSVv2_Moriond17_B_H.csv",
91-
"unavailable",
92-
btagSFdir+"cMVAv2_Moriond17_B_H.csv"
90+
btagSFdir+"CSVv2_Moriond17_B_H.csv",
91+
"unavailable",
92+
btagSFdir+"cMVAv2_Moriond17_B_H.csv"
9393
)
9494
)
9595

9696

9797
lheInfoTable = cms.EDProducer("LHETablesProducer",
9898
lheInfo = cms.VInputTag(cms.InputTag("externalLHEProducer"), cms.InputTag("source")),
9999
precision = cms.int32(14),
100-
storeLHEParticles = cms.bool(True)
100+
storeLHEParticles = cms.bool(True)
101101
)
102102

103103
l1bits=cms.EDProducer("L1TriggerResultsConverter", src=cms.InputTag("gtStage2Digis"), legacyL1=cms.bool(False),
@@ -106,7 +106,7 @@
106106

107107
nanoSequenceCommon = cms.Sequence(
108108
nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+
109-
isoTrackSequence + jetLepSequence + # must be after all the leptons
109+
isoTrackSequence + jetLepSequence + # must be after all the leptons
110110
linkedObjects +
111111
jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + isoTrackTables
112112
)
@@ -208,7 +208,13 @@ def nanoAOD_recalibrateMETs(process,isData):
208208
table.variables.muonSubtrFactor = Var("1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc="1-(muon-subtracted raw pt)/(raw pt)",precision=6)
209209
process.metTables += process.corrT1METJetTable
210210
# makePuppiesFromMiniAOD(process,True) # call this before in the global customizer otherwise it would reset photon IDs in VID
211-
runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi")
211+
nanoAOD_PuppiV15_switch = cms.PSet(
212+
recoMetFromPFCs = cms.untracked.bool(False),
213+
reclusterJets = cms.untracked.bool(False),
214+
)
215+
run2_nanoAOD_106Xv1.toModify( nanoAOD_PuppiV15_switch, recoMetFromPFCs=True, reclusterJets=True )
216+
runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets))
217+
#if not isData: process.patJetPartons.particles = 'prunedGenParticles'
212218
process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi))
213219
return process
214220

@@ -284,7 +290,7 @@ def nanoAOD_runMETfixEE2017(process,isData):
284290
process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(jetSequence),process.fullPatMetSequenceFixEE2017)
285291

286292
def nanoAOD_customizeCommon(process):
287-
makePuppiesFromMiniAOD(process,True)
293+
makePuppiesFromMiniAOD(process,True)
288294
process.puppiNoLep.useExistingWeights = True
289295
process.puppi.useExistingWeights = True
290296
run2_nanoAOD_106Xv1.toModify(process.puppiNoLep, useExistingWeights = False)
@@ -352,7 +358,7 @@ def nanoAOD_customizeMC(process):
352358

353359
### Era dependent customization
354360
_80x_sequence = nanoSequenceCommon.copy()
355-
#remove stuff
361+
#remove stuff
356362
_80x_sequence.remove(isoTrackTables)
357363
_80x_sequence.remove(isoTrackSequence)
358364
#add stuff

0 commit comments

Comments
 (0)