From 4e92c62eb62793aad4f65044af60d3da8207ff8c Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Tue, 1 Mar 2022 16:03:19 +0100 Subject: [PATCH 01/11] Added cfis for new MET XY corrections into CMSSW --- .../python/multPhiCorr_Run2_EOYMC_cfi.py | 61 +++++ .../python/multPhiCorr_Run2_ULDATA_cfi.py | 256 ++++++++++++++++++ .../python/multPhiCorr_Run2_ULMC_cfi.py | 61 +++++ 3 files changed, 378 insertions(+) create mode 100644 JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py create mode 100644 JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py create mode 100644 JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py new file mode 100644 index 0000000000000..bea8a15ac0c2b --- /dev/null +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py @@ -0,0 +1,61 @@ +import FWCore.ParameterSet.Config as cms + +# EOY 2018 MC corrections +multPhiCorr_EOY2018MC = cms.VPSet( + cms.PSet( + name=cms.string("EOY2018MC"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.296713,-0.141506), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.115685,0.0128193), + ), +) + +# EOY 2017 MC corrections without METv2 fix +multPhiCorr_EOY2017MC = cms.VPSet( + cms.PSet( + name=cms.string("EOY2017MC"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.217714,0.493361), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.177058,-0.336648), + ), +) + +# EOY 2017 MC corrections with METv2 fix +multPhiCorr_EOY2017MC_METv2 = cms.VPSet( + cms.PSet( + name=cms.string("EOY2017MC_METv2"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.182569,0.276542), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.155652,-0.417633), + ), +) + +# EOY 2016 MC corrections +multPhiCorr_EOY2016MC = cms.VPSet( + cms.PSet( + name=cms.string("EOY2016MC"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.195191,-0.170948), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.0311891,0.787627), + ), +) diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py new file mode 100644 index 0000000000000..1ce625a58034b --- /dev/null +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py @@ -0,0 +1,256 @@ +import FWCore.ParameterSet.Config as cms + +# UL 2018A DATA corrections +multPhiCorr_UL2018ADATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2018ADATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.263733,-1.91115), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0431304,-0.112043), + ), +) + +# UL 2018B DATA corrections +multPhiCorr_UL2018BDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2018BDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.400466,-3.05914), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.146125,-0.533233), + ), +) + +# UL 2018C DATA corrections +multPhiCorr_UL2018CDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2018CDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.430911,-1.42865), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0620083,-1.46021), + ), +) + +# UL 2018D DATA corrections +multPhiCorr_UL2018DDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2018DDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.457327,-1.56856), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0684071,-0.928372), + ), +) + +# UL 2017B DATA corrections +multPhiCorr_UL2017BDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2017BDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.211161,0.419333), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.251789,-1.28089), + ), +) + +# UL 2017C DATA corrections +multPhiCorr_UL2017CDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2017CDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.185184,-0.164009), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.200941,-0.56853), + ), +) + +# UL 2017D DATA corrections +multPhiCorr_UL2017DDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2017DDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.201606,0.426502), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.188208,-0.58313), + ), +) + +# UL 2017E DATA corrections +multPhiCorr_UL2017EDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2017EDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.162472,0.176329), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.138076,-0.250239), + ), +) + +# UL 2017F DATA corrections +multPhiCorr_UL2017FDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2017FDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.210639,0.72934), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.198626,1.028), + ), +) + +# UL 2016preVFPB DATA corrections +multPhiCorr_UL2016preVFPBDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2016preVFPBDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.0214894,-0.188255), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0876624,0.812885), + ), +) + +# UL 2016preVFPC DATA corrections +multPhiCorr_UL2016preVFPCDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2016preVFPCDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.032209,0.067288), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.113917,0.743906), + ), +) + +# UL 2016preVFPD DATA corrections +multPhiCorr_UL2016preVFPDDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2016preVFPDDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.0293663,0.21106), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.11331,0.815787), + ), +) + +# UL 2016preVFPE DATA corrections +multPhiCorr_UL2016preVFPEDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2016preVFPEDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.0132046,0.20073), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.134809,0.679068), + ), +) + +# UL 2016preVFPF DATA corrections +multPhiCorr_UL2016preVFPFDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2016preVFPFDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.0543566,0.816597), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.114225,1.17266), + ), +) + +# UL 2016ostVFPF DATA corrections +multPhiCorr_UL2016postVFPFDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2016postVFPFDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.134616,-0.89965), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0397736,1.0385), + ), +) + +# UL 2016ostVFPG DATA corrections +multPhiCorr_UL2016postVFPGDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2016postVFPGDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.121809,-0.584893), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0558974,0.891234), + ), +) + +# UL 2016ostVFPH DATA corrections +multPhiCorr_UL2016postVFPHDATA = cms.VPSet( + cms.PSet( + name=cms.string("UL2016postVFPHDATA"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.0868828,-0.703489), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0888774,0.902632), + ), +) diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py new file mode 100644 index 0000000000000..5a4d606f0a097 --- /dev/null +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py @@ -0,0 +1,61 @@ +import FWCore.ParameterSet.Config as cms + +# UL 2018 MC corrections +multPhiCorr_UL2018MC = cms.VPSet( + cms.PSet( + name=cms.string("UL2018MC"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.183518,0.546754), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.192263,-0.42121), + ), +) + +# UL 2017 MC corrections +multPhiCorr_UL2017MC = cms.VPSet( + cms.PSet( + name=cms.string("UL2017MC"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.300155,1.90608), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.300213,-2.02232), + ), +) + +# UL 2016preVFP MC corrections +multPhiCorr_UL2016preVFPMC = cms.VPSet( + cms.PSet( + name=cms.string("UL2016preVFPMC"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.188743,0.136539), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0127927,0.117747), + ), +) + +# UL 2016postVFP MC corrections +multPhiCorr_UL2016postVFPMC = cms.VPSet( + cms.PSet( + name=cms.string("UL2016postVFPMC"), + type=cms.int32(0), + varType=cms.int32(1), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.153497,-0.231751), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.00731978,0.243323), + ), +) From e8dd8e784ed67402b62582649650158140b65d12 Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Mon, 21 Mar 2022 18:10:52 +0100 Subject: [PATCH 02/11] Do not perform the loop over PF candidates if not necessary --- .../plugins/MultShiftMETcorrInputProducer.cc | 41 ++++++++++++------- .../plugins/MultShiftMETcorrInputProducer.h | 1 + 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc index 21d588ac4a7ca..7252a4e2e5703 100644 --- a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc +++ b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc @@ -38,6 +38,11 @@ MultShiftMETcorrInputProducer::MultShiftMETcorrInputProducer(const edm::Paramete : moduleLabel_(cfg.getParameter("@module_label")) { pflow_ = consumes>(cfg.getParameter("srcPFlow")); vertices_ = consumes>(cfg.getParameter("vertexCollection")); + + // if the parameter exsits use the value how it was set + if(cfg.existsAs("useGoodVertices")) useGoodVertices_ = cfg.getParameter("useGoodVertices"); + // if not, reproduce the previous behaviour of this module, which corresponds to 'true' + else useGoodVertices_ = true; edm::InputTag srcWeights = cfg.getParameter("srcWeights"); if (!srcWeights.label().empty()) @@ -88,12 +93,16 @@ void MultShiftMETcorrInputProducer::produce(edm::Event& evt, const edm::EventSet if (!hpv.isValid()) { edm::LogError("MultShiftMETcorrInputProducer::produce") << "could not find vertex collection "; } - std::vector goodVertices; - for (unsigned i = 0; i < hpv->size(); i++) { - if ((*hpv)[i].ndof() > 4 && (fabs((*hpv)[i].z()) <= 24.) && (fabs((*hpv)[i].position().rho()) <= 2.0)) - goodVertices.push_back((*hpv)[i]); + uint ngoodVertices = 0; + if(useGoodVertices_) { + for (unsigned i = 0; i < hpv->size(); i++) { + if ((*hpv)[i].ndof() > 4 && (fabs((*hpv)[i].z()) <= 24.) && (fabs((*hpv)[i].position().rho()) <= 2.0)) + ngoodVertices += 1; + } + } + else { + ngoodVertices = hpv->size(); } - int ngoodVertices = goodVertices.size(); for (unsigned i = 0; i < counts_.size(); i++) counts_[i] = 0; @@ -106,18 +115,20 @@ void MultShiftMETcorrInputProducer::produce(edm::Event& evt, const edm::EventSet edm::Handle> weights; if (!weightsToken_.isUninitialized()) evt.getByToken(weightsToken_, weights); - for (unsigned i = 0; i < particleFlow->size(); ++i) { - const reco::Candidate& c = particleFlow->at(i); - for (unsigned j = 0; j < type_.size(); j++) { - if (abs(c.pdgId()) == translateTypeToAbsPdgId(reco::PFCandidate::ParticleType(type_[j]))) { - if ((c.eta() > etaMin_[j]) and (c.eta() < etaMax_[j])) { - float weight = (!weightsToken_.isUninitialized()) ? (*weights)[particleFlow->ptrAt(i)] : 1.0; - counts_[j] += (weight > 0); - sumPt_[j] += c.pt() * weight; - continue; + if(std::find(varType_.begin(),varType_.end(),0)!=varType_.end() || std::find(varType_.begin(),varType_.end(),2)!=varType_.end()) { + for (unsigned i = 0; i < particleFlow->size(); ++i) { + const reco::Candidate& c = particleFlow->at(i); + for (unsigned j = 0; j < type_.size(); j++) { + if (abs(c.pdgId()) == translateTypeToAbsPdgId(reco::PFCandidate::ParticleType(type_[j]))) { + if ((c.eta() > etaMin_[j]) and (c.eta() < etaMax_[j])) { + float weight = (!weightsToken_.isUninitialized()) ? (*weights)[particleFlow->ptrAt(i)] : 1.0; + counts_[j] += (weight > 0); + sumPt_[j] += c.pt() * weight; + continue; + } + } } } - } } //MM: loop over all constituent types and sum each correction diff --git a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.h b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.h index 94771e74481ad..975214ca5150f 100644 --- a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.h +++ b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.h @@ -42,6 +42,7 @@ class MultShiftMETcorrInputProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT> vertices_; std::string moduleLabel_; edm::EDGetTokenT> weightsToken_; + bool useGoodVertices_; std::vector cfgCorrParameters_; From 9ffaa8bf806b276be2a9cd7ba647b619ddad6b89 Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Wed, 23 Mar 2022 15:28:21 +0100 Subject: [PATCH 03/11] change naming scheme for xy corrections --- .../python/multPhiCorr_Run2_EOYMC_cfi.py | 16 +-- .../python/multPhiCorr_Run2_ULDATA_cfi.py | 102 +++++++++--------- .../python/multPhiCorr_Run2_ULMC_cfi.py | 16 +-- 3 files changed, 67 insertions(+), 67 deletions(-) diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py index bea8a15ac0c2b..608e335192142 100644 --- a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py @@ -1,9 +1,9 @@ import FWCore.ParameterSet.Config as cms # EOY 2018 MC corrections -multPhiCorr_EOY2018MC = cms.VPSet( +multPhiCorr_EOYMC2018 = cms.VPSet( cms.PSet( - name=cms.string("EOY2018MC"), + name=cms.string("EOYMC2018"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -16,9 +16,9 @@ ) # EOY 2017 MC corrections without METv2 fix -multPhiCorr_EOY2017MC = cms.VPSet( +multPhiCorr_EOYMC2017 = cms.VPSet( cms.PSet( - name=cms.string("EOY2017MC"), + name=cms.string("EOYMC2017"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -31,9 +31,9 @@ ) # EOY 2017 MC corrections with METv2 fix -multPhiCorr_EOY2017MC_METv2 = cms.VPSet( +multPhiCorr_EOYMC2017_METv2 = cms.VPSet( cms.PSet( - name=cms.string("EOY2017MC_METv2"), + name=cms.string("EOYMC2017_METv2"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -46,9 +46,9 @@ ) # EOY 2016 MC corrections -multPhiCorr_EOY2016MC = cms.VPSet( +multPhiCorr_EOYMC2016 = cms.VPSet( cms.PSet( - name=cms.string("EOY2016MC"), + name=cms.string("EOYMC2016"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py index 1ce625a58034b..3efd91c38c7a5 100644 --- a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py @@ -1,9 +1,9 @@ import FWCore.ParameterSet.Config as cms -# UL 2018A DATA corrections -multPhiCorr_UL2018ADATA = cms.VPSet( +# ULDATA 2018A corrections +multPhiCorr_ULDATA2018A = cms.VPSet( cms.PSet( - name=cms.string("UL2018ADATA"), + name=cms.string("ULDATA2018A"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -15,10 +15,10 @@ ), ) -# UL 2018B DATA corrections -multPhiCorr_UL2018BDATA = cms.VPSet( +# ULDATA 2018B corrections +multPhiCorr_ULDATA2018B = cms.VPSet( cms.PSet( - name=cms.string("UL2018BDATA"), + name=cms.string("ULDATA2018B"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -30,10 +30,10 @@ ), ) -# UL 2018C DATA corrections -multPhiCorr_UL2018CDATA = cms.VPSet( +# ULDATA 2018C corrections +multPhiCorr_ULDATA2018C = cms.VPSet( cms.PSet( - name=cms.string("UL2018CDATA"), + name=cms.string("ULDATA2018C"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -45,10 +45,10 @@ ), ) -# UL 2018D DATA corrections -multPhiCorr_UL2018DDATA = cms.VPSet( +# ULDATA 2018D corrections +multPhiCorr_ULDATA2018D = cms.VPSet( cms.PSet( - name=cms.string("UL2018DDATA"), + name=cms.string("ULDATA2018D"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -60,10 +60,10 @@ ), ) -# UL 2017B DATA corrections -multPhiCorr_UL2017BDATA = cms.VPSet( +# ULDATA 2017B corrections +multPhiCorr_ULDATA2017B = cms.VPSet( cms.PSet( - name=cms.string("UL2017BDATA"), + name=cms.string("ULDATA2017B"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -75,10 +75,10 @@ ), ) -# UL 2017C DATA corrections -multPhiCorr_UL2017CDATA = cms.VPSet( +# ULDATA 2017C corrections +multPhiCorr_ULDATA2017C = cms.VPSet( cms.PSet( - name=cms.string("UL2017CDATA"), + name=cms.string("ULDATA2017C"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -90,10 +90,10 @@ ), ) -# UL 2017D DATA corrections -multPhiCorr_UL2017DDATA = cms.VPSet( +# ULDATA 2017D corrections +multPhiCorr_ULDATA2017D = cms.VPSet( cms.PSet( - name=cms.string("UL2017DDATA"), + name=cms.string("ULDATA2017D"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -105,10 +105,10 @@ ), ) -# UL 2017E DATA corrections -multPhiCorr_UL2017EDATA = cms.VPSet( +# ULDATA 2017E corrections +multPhiCorr_ULDATA2017E = cms.VPSet( cms.PSet( - name=cms.string("UL2017EDATA"), + name=cms.string("ULDATA2017E"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -120,10 +120,10 @@ ), ) -# UL 2017F DATA corrections -multPhiCorr_UL2017FDATA = cms.VPSet( +# ULDATA 2017F corrections +multPhiCorr_ULDATA2017F = cms.VPSet( cms.PSet( - name=cms.string("UL2017FDATA"), + name=cms.string("ULDATA2017F"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -135,10 +135,10 @@ ), ) -# UL 2016preVFPB DATA corrections -multPhiCorr_UL2016preVFPBDATA = cms.VPSet( +# ULDATA 2016preVFPB corrections +multPhiCorr_ULDATA2016preVFPB = cms.VPSet( cms.PSet( - name=cms.string("UL2016preVFPBDATA"), + name=cms.string("ULDATA2016preVFPB"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -150,10 +150,10 @@ ), ) -# UL 2016preVFPC DATA corrections -multPhiCorr_UL2016preVFPCDATA = cms.VPSet( +# ULDATA 2016preVFPC corrections +multPhiCorr_ULDATA2016preVFPC = cms.VPSet( cms.PSet( - name=cms.string("UL2016preVFPCDATA"), + name=cms.string("ULDATA2016preVFPC"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -165,10 +165,10 @@ ), ) -# UL 2016preVFPD DATA corrections -multPhiCorr_UL2016preVFPDDATA = cms.VPSet( +# ULDATA 2016preVFPD corrections +multPhiCorr_ULDATA2016preVFPD = cms.VPSet( cms.PSet( - name=cms.string("UL2016preVFPDDATA"), + name=cms.string("ULDATA2016preVFPD"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -180,10 +180,10 @@ ), ) -# UL 2016preVFPE DATA corrections -multPhiCorr_UL2016preVFPEDATA = cms.VPSet( +# ULDATA 2016preVFPE corrections +multPhiCorr_ULDATA2016preVFPE = cms.VPSet( cms.PSet( - name=cms.string("UL2016preVFPEDATA"), + name=cms.string("ULDATA2016preVFPE"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -195,10 +195,10 @@ ), ) -# UL 2016preVFPF DATA corrections -multPhiCorr_UL2016preVFPFDATA = cms.VPSet( +# ULDATA 2016preVFPF corrections +multPhiCorr_ULDATA2016preVFPF = cms.VPSet( cms.PSet( - name=cms.string("UL2016preVFPFDATA"), + name=cms.string("ULDATA2016preVFPF"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -210,10 +210,10 @@ ), ) -# UL 2016ostVFPF DATA corrections -multPhiCorr_UL2016postVFPFDATA = cms.VPSet( +# ULDATA 2016ostVFPF corrections +multPhiCorr_ULDATA2016postVFPF = cms.VPSet( cms.PSet( - name=cms.string("UL2016postVFPFDATA"), + name=cms.string("ULDATA2016postVFPF"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -225,10 +225,10 @@ ), ) -# UL 2016ostVFPG DATA corrections -multPhiCorr_UL2016postVFPGDATA = cms.VPSet( +# ULDATA 2016ostVFPG corrections +multPhiCorr_ULDATA2016postVFPG = cms.VPSet( cms.PSet( - name=cms.string("UL2016postVFPGDATA"), + name=cms.string("ULDATA2016postVFPG"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -240,10 +240,10 @@ ), ) -# UL 2016ostVFPH DATA corrections -multPhiCorr_UL2016postVFPHDATA = cms.VPSet( +# ULDATA 2016ostVFPH corrections +multPhiCorr_ULDATA2016postVFPH = cms.VPSet( cms.PSet( - name=cms.string("UL2016postVFPHDATA"), + name=cms.string("ULDATA2016postVFPH"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py index 5a4d606f0a097..37d2f0cd7b731 100644 --- a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py @@ -1,9 +1,9 @@ import FWCore.ParameterSet.Config as cms # UL 2018 MC corrections -multPhiCorr_UL2018MC = cms.VPSet( +multPhiCorr_ULMC2018 = cms.VPSet( cms.PSet( - name=cms.string("UL2018MC"), + name=cms.string("ULMC2018"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -16,9 +16,9 @@ ) # UL 2017 MC corrections -multPhiCorr_UL2017MC = cms.VPSet( +multPhiCorr_ULMC2017 = cms.VPSet( cms.PSet( - name=cms.string("UL2017MC"), + name=cms.string("ULMC2017"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -31,9 +31,9 @@ ) # UL 2016preVFP MC corrections -multPhiCorr_UL2016preVFPMC = cms.VPSet( +multPhiCorr_ULMC2016preVFP = cms.VPSet( cms.PSet( - name=cms.string("UL2016preVFPMC"), + name=cms.string("ULMC2016preVFP"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), @@ -46,9 +46,9 @@ ) # UL 2016postVFP MC corrections -multPhiCorr_UL2016postVFPMC = cms.VPSet( +multPhiCorr_ULMC2016postVFP = cms.VPSet( cms.PSet( - name=cms.string("UL2016postVFPMC"), + name=cms.string("ULMC2016postVFP"), type=cms.int32(0), varType=cms.int32(1), etaMin=cms.double(-9.9), From 486b851b9199e4a4d161becd83c68342db1d7d87 Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Thu, 24 Mar 2022 11:16:42 +0100 Subject: [PATCH 04/11] Introduce new varType for MET XY corrections with number of primary vertices --- .../plugins/MultShiftMETcorrInputProducer.cc | 24 +++++-------- .../plugins/MultShiftMETcorrInputProducer.h | 1 - .../python/multPhiCorr_Run2_EOYMC_cfi.py | 8 ++--- .../python/multPhiCorr_Run2_ULDATA_cfi.py | 34 +++++++++---------- .../python/multPhiCorr_Run2_ULMC_cfi.py | 8 ++--- .../python/patPFMETCorrections_cff.py | 30 ++++++++++++++++ 6 files changed, 64 insertions(+), 41 deletions(-) diff --git a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc index 7252a4e2e5703..076de3a0a0893 100644 --- a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc +++ b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc @@ -38,11 +38,6 @@ MultShiftMETcorrInputProducer::MultShiftMETcorrInputProducer(const edm::Paramete : moduleLabel_(cfg.getParameter("@module_label")) { pflow_ = consumes>(cfg.getParameter("srcPFlow")); vertices_ = consumes>(cfg.getParameter("vertexCollection")); - - // if the parameter exsits use the value how it was set - if(cfg.existsAs("useGoodVertices")) useGoodVertices_ = cfg.getParameter("useGoodVertices"); - // if not, reproduce the previous behaviour of this module, which corresponds to 'true' - else useGoodVertices_ = true; edm::InputTag srcWeights = cfg.getParameter("srcWeights"); if (!srcWeights.label().empty()) @@ -94,15 +89,11 @@ void MultShiftMETcorrInputProducer::produce(edm::Event& evt, const edm::EventSet edm::LogError("MultShiftMETcorrInputProducer::produce") << "could not find vertex collection "; } uint ngoodVertices = 0; - if(useGoodVertices_) { - for (unsigned i = 0; i < hpv->size(); i++) { - if ((*hpv)[i].ndof() > 4 && (fabs((*hpv)[i].z()) <= 24.) && (fabs((*hpv)[i].position().rho()) <= 2.0)) - ngoodVertices += 1; - } - } - else { - ngoodVertices = hpv->size(); + for (unsigned i = 0; i < hpv->size(); i++) { + if ((*hpv)[i].ndof() > 4 && (fabs((*hpv)[i].z()) <= 24.) && (fabs((*hpv)[i].position().rho()) <= 2.0)) + ngoodVertices += 1; } + uint nVertices = hpv->size(); for (unsigned i = 0; i < counts_.size(); i++) counts_[i] = 0; @@ -145,12 +136,15 @@ void MultShiftMETcorrInputProducer::produce(edm::Event& evt, const edm::EventSet if (varType_[j] == 0) { val = counts_[j]; } - if (varType_[j] == 1) { + else if (varType_[j] == 1) { val = ngoodVertices; } - if (varType_[j] == 2) { + else if (varType_[j] == 2) { val = sumPt_[j]; } + else if (varType_[j] == 3) { + val = nVertices; + } corx -= formula_x_[j]->Eval(val); cory -= formula_y_[j]->Eval(val); diff --git a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.h b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.h index 975214ca5150f..94771e74481ad 100644 --- a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.h +++ b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.h @@ -42,7 +42,6 @@ class MultShiftMETcorrInputProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT> vertices_; std::string moduleLabel_; edm::EDGetTokenT> weightsToken_; - bool useGoodVertices_; std::vector cfgCorrParameters_; diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py index 608e335192142..72cf0ceb3d576 100644 --- a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_EOYMC_cfi.py @@ -5,7 +5,7 @@ cms.PSet( name=cms.string("EOYMC2018"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -20,7 +20,7 @@ cms.PSet( name=cms.string("EOYMC2017"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -35,7 +35,7 @@ cms.PSet( name=cms.string("EOYMC2017_METv2"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -50,7 +50,7 @@ cms.PSet( name=cms.string("EOYMC2016"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py index 3efd91c38c7a5..858ba5a1246f9 100644 --- a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULDATA_cfi.py @@ -5,7 +5,7 @@ cms.PSet( name=cms.string("ULDATA2018A"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -20,7 +20,7 @@ cms.PSet( name=cms.string("ULDATA2018B"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -35,7 +35,7 @@ cms.PSet( name=cms.string("ULDATA2018C"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -50,7 +50,7 @@ cms.PSet( name=cms.string("ULDATA2018D"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -65,7 +65,7 @@ cms.PSet( name=cms.string("ULDATA2017B"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -80,7 +80,7 @@ cms.PSet( name=cms.string("ULDATA2017C"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -95,7 +95,7 @@ cms.PSet( name=cms.string("ULDATA2017D"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -110,7 +110,7 @@ cms.PSet( name=cms.string("ULDATA2017E"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -125,7 +125,7 @@ cms.PSet( name=cms.string("ULDATA2017F"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -140,7 +140,7 @@ cms.PSet( name=cms.string("ULDATA2016preVFPB"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -155,7 +155,7 @@ cms.PSet( name=cms.string("ULDATA2016preVFPC"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -170,7 +170,7 @@ cms.PSet( name=cms.string("ULDATA2016preVFPD"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -185,7 +185,7 @@ cms.PSet( name=cms.string("ULDATA2016preVFPE"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -200,7 +200,7 @@ cms.PSet( name=cms.string("ULDATA2016preVFPF"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -215,7 +215,7 @@ cms.PSet( name=cms.string("ULDATA2016postVFPF"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -230,7 +230,7 @@ cms.PSet( name=cms.string("ULDATA2016postVFPG"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -245,7 +245,7 @@ cms.PSet( name=cms.string("ULDATA2016postVFPH"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py index 37d2f0cd7b731..c261b3a39d153 100644 --- a/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Run2_ULMC_cfi.py @@ -5,7 +5,7 @@ cms.PSet( name=cms.string("ULMC2018"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -20,7 +20,7 @@ cms.PSet( name=cms.string("ULMC2017"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -35,7 +35,7 @@ cms.PSet( name=cms.string("ULMC2016preVFP"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), @@ -50,7 +50,7 @@ cms.PSet( name=cms.string("ULMC2016postVFP"), type=cms.int32(0), - varType=cms.int32(1), + varType=cms.int32(3), etaMin=cms.double(-9.9), etaMax=cms.double(9.9), fx=cms.string("((x*[0])+[1])"), diff --git a/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py b/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py index 336ed4be7fd65..2615d9a88ac4b 100644 --- a/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py +++ b/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py @@ -91,6 +91,36 @@ patMultPhiCorrParams_T0pcT1SmearTxy_25ns = cms.VPSet( [pset for pset in _shiftMod.multPhiCorrParams_T0pcT1Txy_25ns]) patMultPhiCorrParams_T0pcT1T2SmearTxy_25ns = cms.VPSet( [pset for pset in _shiftMod.multPhiCorrParams_T0pcT1T2Txy_25ns]) +# Run2 UL MC XY(Type1 PFMET Phi) corrections +import JetMETCorrections.Type1MET.multPhiCorr_Run2_ULMC_cfi as multPhiCorrParams_Run2_ULMC +import JetMETCorrections.Type1MET.multPhiCorr_Run2_ULDATA_cfi as multPhiCorrParams_Run2_ULDATA + +patMultPhiCorrParams_ULMC2018 = multPhiCorrParams_Run2_ULMC.multPhiCorr_ULMC2018 +patMultPhiCorrParams_ULMC2017 = multPhiCorrParams_Run2_ULMC.multPhiCorr_ULMC2017 +patMultPhiCorrParams_ULMC2016preVFP = multPhiCorrParams_Run2_ULMC.multPhiCorr_ULMC2016preVFP +patMultPhiCorrParams_ULMC2016postVFP = multPhiCorrParams_Run2_ULMC.multPhiCorr_ULMC2016postVFP + +patMultPhiCorrParams_ULDATA2018A = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2018A +patMultPhiCorrParams_ULDATA2018B = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2018B +patMultPhiCorrParams_ULDATA2018C = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2018C +patMultPhiCorrParams_ULDATA2018D = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2018D + +patMultPhiCorrParams_ULDATA2017B = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2017B +patMultPhiCorrParams_ULDATA2017C = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2017C +patMultPhiCorrParams_ULDATA2017D = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2017D +patMultPhiCorrParams_ULDATA2017E = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2017E +patMultPhiCorrParams_ULDATA2017F = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2017F + +patMultPhiCorrParams_ULDATA2016preVFPB = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2016preVFPB +patMultPhiCorrParams_ULDATA2016preVFPC = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2016preVFPC +patMultPhiCorrParams_ULDATA2016preVFPD = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2016preVFPD +patMultPhiCorrParams_ULDATA2016preVFPE = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2016preVFPE +patMultPhiCorrParams_ULDATA2016preVFPF = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2016preVFPF + +patMultPhiCorrParams_ULDATA2016postVFPF = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2016postVFPF +patMultPhiCorrParams_ULDATA2016postVFPG = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2016postVFPG +patMultPhiCorrParams_ULDATA2016postVFPH = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2016postVFPH + patPFMetTxyCorrTask = cms.Task(patPFMetTxyCorr) patPFMetTxyCorrSequence = cms.Sequence(patPFMetTxyCorrTask) From eb602184d2d37cbeba5ff19e36dcbf0cfff6f06e Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Thu, 24 Mar 2022 16:32:02 +0100 Subject: [PATCH 05/11] introduce new inputs for met correction tool --- .../runMETCorrectionsAndUncertainties.py | 64 +++++++++++-------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index c60856e25f3b4..9243137ed1a26 100644 --- a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py +++ b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py @@ -101,7 +101,8 @@ def __init__(self): self.addParameter(self._defaultParameters, 'Puppi', False, "Puppi algorithm (private)", Type=bool) - + self.addParameter(self._defaultParameters, 'campaign', '', 'Production campaign', Type=str) + self.addParameter(self._defaultParameters, 'era', '', 'Era e.g. 2018, 2017B, ...', Type=str) self._parameters = copy.deepcopy(self._defaultParameters) self._comment = "" @@ -142,6 +143,8 @@ def __call__(self, process, fixEE2017 =None, fixEE2017Params =None, extractDeepMETs =None, + campaign =None, + era =None, postfix =None): electronCollection = self.initializeInputTag(electronCollection, 'electronCollection') photonCollection = self.initializeInputTag(photonCollection, 'photonCollection') @@ -217,6 +220,10 @@ def __call__(self, process, fixEE2017Params = self._defaultParameters['fixEE2017Params'].value if extractDeepMETs is None : extractDeepMETs = self._defaultParameters['extractDeepMETs'].value + if campaign is None : + campaign = self._defaultParameters['campaign'].value + if era is None : + era = self._defaultParameters['era'].value self.setParameter('metType',metType), self.setParameter('correctionLevel',correctionLevel), @@ -251,6 +258,8 @@ def __call__(self, process, self.setParameter('fixEE2017',fixEE2017), self.setParameter('fixEE2017Params',fixEE2017Params), self.setParameter('extractDeepMETs',extractDeepMETs), + self.setParameter('campaign',campaign), + self.setParameter('era',era), #if mva/puppi MET, autoswitch to std jets if metType == "MVA" or metType == "Puppi": @@ -315,6 +324,8 @@ def toolCode(self, process): fixEE2017 = self._parameters['fixEE2017'].value fixEE2017Params = self._parameters['fixEE2017Params'].value extractDeepMETs = self._parameters['extractDeepMETs'].value + campaign = self._parameters['campaign'].value + era = self._parameters['era'].value #prepare jet configuration jetUncInfos = { "jCorrPayload":jetFlavor, "jCorLabelUpToL3":jetCorLabelUpToL3, @@ -629,7 +640,8 @@ def getCorrectedMET(self, process, metType, correctionLevel,produceIntermediateC #Txy parameter tuning if "Txy" in correctionLevel: - self.tuneTxyParameters(process, corScheme, postfix) + datamc = "DATA" if self.getvalue("runOnData") else "MC" + self.tuneTxyParameters(process, corScheme, postfix, datamc, self.getvalue("campaign"), self.getvalue("era")) getattr(process, "patPFMetTxyCorr"+postfix).srcPFlow = self._parameters["pfCandCollection"].value if self.getvalue("Puppi"): getattr(process, "patPFMetTxyCorr"+postfix).srcWeights = "puppiNoLep" @@ -1072,33 +1084,21 @@ def removePostfix(self, name, postfix): return baseName #==================================================================================================== - def tuneTxyParameters(self, process, corScheme, postfix): + def tuneTxyParameters(self, process, corScheme, postfix, datamc="", campaign="", era="" ): + corSchemes = ["Txy", "T1Txy", "T0pcTxy", "T0pcT1Txy", "T1T2Txy", "T0pcT1T2Txy", "T1SmearTxy", "T1T2SmearTxy", "T0pcT1SmearTxy", "T0pcT1T2SmearTxy"] import PhysicsTools.PatUtils.patPFMETCorrections_cff as metCors - xyTags = { - "Txy_50ns":metCors.patMultPhiCorrParams_Txy_50ns, - "T1Txy_50ns":metCors.patMultPhiCorrParams_T1Txy_50ns, - "T0pcTxy_50ns":metCors.patMultPhiCorrParams_T0pcTxy_50ns, - "T0pcT1Txy_50ns":metCors.patMultPhiCorrParams_T0pcT1Txy_50ns, - "T1T2Txy_50ns":metCors.patMultPhiCorrParams_T1T2Txy_50ns, - "T0pcT1T2Txy_50ns":metCors.patMultPhiCorrParams_T0pcT1T2Txy_50ns, - "T1SmearTxy_50ns":metCors.patMultPhiCorrParams_T1SmearTxy_50ns, - "T1T2SmearTxy_50ns":metCors.patMultPhiCorrParams_T1T2SmearTxy_50ns, - "T0pcT1SmearTxy_50ns":metCors.patMultPhiCorrParams_T0pcT1SmearTxy_50ns, - "T0pcT1T2SmearTxy_50ns":metCors.patMultPhiCorrParams_T0pcT1T2SmearTxy_50ns, - - "Txy_25ns":metCors.patMultPhiCorrParams_Txy_25ns, - "T1Txy_25ns":metCors.patMultPhiCorrParams_T1Txy_25ns, - "T0pcTxy_25ns":metCors.patMultPhiCorrParams_T0pcTxy_25ns, - "T0pcT1Txy_25ns":metCors.patMultPhiCorrParams_T0pcT1Txy_25ns, - "T1T2Txy_25ns":metCors.patMultPhiCorrParams_T1T2Txy_25ns, - "T0pcT1T2Txy_25ns":metCors.patMultPhiCorrParams_T0pcT1T2Txy_25ns, - "T1SmearTxy_25ns":metCors.patMultPhiCorrParams_T1SmearTxy_25ns, - "T1T2SmearTxy_25ns":metCors.patMultPhiCorrParams_T1T2SmearTxy_25ns, - "T0pcT1SmearTxy_25ns":metCors.patMultPhiCorrParams_T0pcT1SmearTxy_25ns, - "T0pcT1T2SmearTxy_25ns":metCors.patMultPhiCorrParams_T0pcT1T2SmearTxy_25ns - } - - getattr(process, "patPFMetTxyCorr"+postfix).parameters = xyTags[corScheme+"_25ns"] + print("DEBUG ",campaign,datamc,era) + xyTags = {} + for corScheme_ in corSchemes: + xyTags["{}_{}".format(corScheme_,"50ns")]=getattr(metCors,"{}_{}_{}".format("patMultPhiCorrParams",corScheme_,"50ns")) + xyTags["{}_{}".format(corScheme_,"25ns")]=getattr(metCors,"{}_{}_{}".format("patMultPhiCorrParams",corScheme_,"25ns")) + if datamc!="" and campaign!="" and era!="": + xyTags["{}_{}_{}_{}".format(corScheme_,campaign,datamc,era)]=getattr(metCors,"{}_{}{}{}".format("patMultPhiCorrParams",campaign,datamc,era)) + + if datamc!="" and campaign!="" and era!="": + getattr(process, "patPFMetTxyCorr"+postfix).parameters = xyTags["{}_{}_{}_{}".format(corScheme,campaign,datamc,era)] + else: + getattr(process, "patPFMetTxyCorr"+postfix).parameters = xyTags[corScheme+"_25ns"] #==================================================================================================== @@ -2053,6 +2053,8 @@ def runMetCorAndUncFromMiniAOD(process, metType="PF", fixEE2017=False, fixEE2017Params=None, extractDeepMETs=False, + campaign="", + era="", postfix=""): runMETCorrectionsAndUncertainties = RunMETCorrectionsAndUncertainties() @@ -2087,6 +2089,8 @@ def runMetCorAndUncFromMiniAOD(process, metType="PF", fixEE2017=fixEE2017, fixEE2017Params=fixEE2017Params, extractDeepMETs=extractDeepMETs, + campaign=campaign, + era=era, ) #MET T1+Txy / Smear @@ -2119,6 +2123,8 @@ def runMetCorAndUncFromMiniAOD(process, metType="PF", fixEE2017=fixEE2017, fixEE2017Params=fixEE2017Params, extractDeepMETs=extractDeepMETs, + campaign=campaign, + era=era, ) #MET T1+Smear + uncertainties runMETCorrectionsAndUncertainties(process, metType=metType, @@ -2150,4 +2156,6 @@ def runMetCorAndUncFromMiniAOD(process, metType="PF", fixEE2017=fixEE2017, fixEE2017Params=fixEE2017Params, extractDeepMETs=extractDeepMETs, + campaign=campaign, + era=era, ) From bd0cbc28a01c51aa52bac803f371c1892675f474 Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Thu, 24 Mar 2022 18:04:14 +0100 Subject: [PATCH 06/11] Upload MET Phi corrections for PuppiMET for UL MC --- .../python/multPhiCorr_Puppi_Run2_ULMC_cfi.py | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULMC_cfi.py diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULMC_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULMC_cfi.py new file mode 100644 index 0000000000000..904cb24733d4a --- /dev/null +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULMC_cfi.py @@ -0,0 +1,61 @@ +import FWCore.ParameterSet.Config as cms + +# UL 2018 MC corrections +multPhiCorr_Puppi_ULMC2018 = cms.VPSet( + cms.PSet( + name=cms.string("ULMC2018"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.0214557,0.969428), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0167134,0.199296), + ), +) + +# UL 2017 MC corrections +multPhiCorr_Puppi_ULMC2017 = cms.VPSet( + cms.PSet( + name=cms.string("ULMC2017"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.0102265,-0.446416), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0198663,0.243182), + ), +) + +# UL 2016preVFP MC corrections +multPhiCorr_Puppi_ULMC2016preVFP = cms.VPSet( + cms.PSet( + name=cms.string("ULMC2016preVFP"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.0058341,-0.395049), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.00971595,-0.101288), + ), +) + +# UL 2016postVFP MC corrections +multPhiCorr_Puppi_ULMC2016postVFP = cms.VPSet( + cms.PSet( + name=cms.string("ULMC2016postVFP"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.0060447,-0.4183), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.008331,-0.0990046), + ), +) From 4bf300b6cce2c0f13846024ef5fb81d22e8adb0b Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Thu, 24 Mar 2022 18:22:12 +0100 Subject: [PATCH 07/11] Upload MET Phi corrections for PuppiMET for UL DATA --- .../multPhiCorr_Puppi_Run2_ULDATA_cfi.py | 256 ++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULDATA_cfi.py diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULDATA_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULDATA_cfi.py new file mode 100644 index 0000000000000..63130c19d566c --- /dev/null +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULDATA_cfi.py @@ -0,0 +1,256 @@ +import FWCore.ParameterSet.Config as cms + +# ULDATA 2018A corrections +multPhiCorr_ULDATA2018A = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2018A"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.0073377,0.0250294), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.000406059,0.0417346), + ), +) + +# ULDATA 2018B corrections +multPhiCorr_ULDATA2018B = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2018B"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.00434261,0.00892927), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.00234695,0.20381), + ), +) + +# ULDATA 2018C corrections +multPhiCorr_ULDATA2018C = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2018C"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.00198311,0.37026), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.016127,0.402029), + ), +) + +# ULDATA 2018D corrections +multPhiCorr_ULDATA2018D = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2018D"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.00220647,0.378141), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.0160244,0.471053), + ), +) + +# ULDATA 2017B corrections +multPhiCorr_ULDATA2017B = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2017B"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.00382117,-0.666228), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0109034,0.172188), + ), +) + +# ULDATA 2017C corrections +multPhiCorr_ULDATA2017C = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2017C"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.00110699,-0.747643), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.0012184,0.303817), + ), +) + +# ULDATA 2017D corrections +multPhiCorr_ULDATA2017D = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2017D"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.00141442,-0.721382), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.0011873,0.21646), + ), +) + +# ULDATA 2017E corrections +multPhiCorr_ULDATA2017E = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2017E"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.00593859,-0.851999), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.00754254,0.245956), + ), +) + +# ULDATA 2017F corrections +multPhiCorr_ULDATA2017F = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2017F"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.00765682,-0.945001), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.0154974,0.804176), + ), +) + +# ULDATA 2016preVFPB corrections +multPhiCorr_ULDATA2016preVFPB = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2016preVFPB"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.00109025,-0.338093), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.00356058,0.128407), + ), +) + +# ULDATA 2016preVFPC corrections +multPhiCorr_ULDATA2016preVFPC = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2016preVFPC"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.00271913,-0.342268), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.00187386,0.104), + ), +) + +# ULDATA 2016preVFPD corrections +multPhiCorr_ULDATA2016preVFPD = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2016preVFPD"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.00254194,-0.305264), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.00177408,0.164639), + ), +) + +# ULDATA 2016preVFPE corrections +multPhiCorr_ULDATA2016preVFPE = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2016preVFPE"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(-0.00358835,-0.225435), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.000444268,0.180479), + ), +) + +# ULDATA 2016preVFPF corrections +multPhiCorr_ULDATA2016preVFPF = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2016preVFPF"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.0056759,-0.454101), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.00962707,0.35731), + ), +) + +# ULDATA 2016ostVFPF corrections +multPhiCorr_ULDATA2016postVFPF = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2016postVFPF"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.0234421,-0.371298), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.00997438,0.0809178), + ), +) + +# ULDATA 2016ostVFPG corrections +multPhiCorr_ULDATA2016postVFPG = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2016postVFPG"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.0182134,-0.335786), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.0063338,0.093349), + ), +) + +# ULDATA 2016ostVFPH corrections +multPhiCorr_ULDATA2016postVFPH = cms.VPSet( + cms.PSet( + name=cms.string("ULDATA2016postVFPH"), + type=cms.int32(0), + varType=cms.int32(3), + etaMin=cms.double(-9.9), + etaMax=cms.double(9.9), + fx=cms.string("((x*[0])+[1])"), + px=cms.vdouble(0.015702,-0.340832), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(-0.00544957,0.199093), + ), +) From c4b6a5cc46ab754cbfa974428f72f02de8d99888 Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Tue, 29 Mar 2022 14:02:34 +0200 Subject: [PATCH 08/11] Puppi XY corrections --- .../multPhiCorr_Puppi_Run2_ULDATA_cfi.py | 34 +++++++++---------- .../python/patPFMETCorrections_cff.py | 30 ++++++++++++++++ 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULDATA_cfi.py b/JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULDATA_cfi.py index 63130c19d566c..5c5657de833b5 100644 --- a/JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULDATA_cfi.py +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_Puppi_Run2_ULDATA_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms # ULDATA 2018A corrections -multPhiCorr_ULDATA2018A = cms.VPSet( +multPhiCorr_Puppi_ULDATA2018A = cms.VPSet( cms.PSet( name=cms.string("ULDATA2018A"), type=cms.int32(0), @@ -16,7 +16,7 @@ ) # ULDATA 2018B corrections -multPhiCorr_ULDATA2018B = cms.VPSet( +multPhiCorr_Puppi_ULDATA2018B = cms.VPSet( cms.PSet( name=cms.string("ULDATA2018B"), type=cms.int32(0), @@ -31,7 +31,7 @@ ) # ULDATA 2018C corrections -multPhiCorr_ULDATA2018C = cms.VPSet( +multPhiCorr_Puppi_ULDATA2018C = cms.VPSet( cms.PSet( name=cms.string("ULDATA2018C"), type=cms.int32(0), @@ -46,7 +46,7 @@ ) # ULDATA 2018D corrections -multPhiCorr_ULDATA2018D = cms.VPSet( +multPhiCorr_Puppi_ULDATA2018D = cms.VPSet( cms.PSet( name=cms.string("ULDATA2018D"), type=cms.int32(0), @@ -61,7 +61,7 @@ ) # ULDATA 2017B corrections -multPhiCorr_ULDATA2017B = cms.VPSet( +multPhiCorr_Puppi_ULDATA2017B = cms.VPSet( cms.PSet( name=cms.string("ULDATA2017B"), type=cms.int32(0), @@ -76,7 +76,7 @@ ) # ULDATA 2017C corrections -multPhiCorr_ULDATA2017C = cms.VPSet( +multPhiCorr_Puppi_ULDATA2017C = cms.VPSet( cms.PSet( name=cms.string("ULDATA2017C"), type=cms.int32(0), @@ -91,7 +91,7 @@ ) # ULDATA 2017D corrections -multPhiCorr_ULDATA2017D = cms.VPSet( +multPhiCorr_Puppi_ULDATA2017D = cms.VPSet( cms.PSet( name=cms.string("ULDATA2017D"), type=cms.int32(0), @@ -106,7 +106,7 @@ ) # ULDATA 2017E corrections -multPhiCorr_ULDATA2017E = cms.VPSet( +multPhiCorr_Puppi_ULDATA2017E = cms.VPSet( cms.PSet( name=cms.string("ULDATA2017E"), type=cms.int32(0), @@ -121,7 +121,7 @@ ) # ULDATA 2017F corrections -multPhiCorr_ULDATA2017F = cms.VPSet( +multPhiCorr_Puppi_ULDATA2017F = cms.VPSet( cms.PSet( name=cms.string("ULDATA2017F"), type=cms.int32(0), @@ -136,7 +136,7 @@ ) # ULDATA 2016preVFPB corrections -multPhiCorr_ULDATA2016preVFPB = cms.VPSet( +multPhiCorr_Puppi_ULDATA2016preVFPB = cms.VPSet( cms.PSet( name=cms.string("ULDATA2016preVFPB"), type=cms.int32(0), @@ -151,7 +151,7 @@ ) # ULDATA 2016preVFPC corrections -multPhiCorr_ULDATA2016preVFPC = cms.VPSet( +multPhiCorr_Puppi_ULDATA2016preVFPC = cms.VPSet( cms.PSet( name=cms.string("ULDATA2016preVFPC"), type=cms.int32(0), @@ -166,7 +166,7 @@ ) # ULDATA 2016preVFPD corrections -multPhiCorr_ULDATA2016preVFPD = cms.VPSet( +multPhiCorr_Puppi_ULDATA2016preVFPD = cms.VPSet( cms.PSet( name=cms.string("ULDATA2016preVFPD"), type=cms.int32(0), @@ -181,7 +181,7 @@ ) # ULDATA 2016preVFPE corrections -multPhiCorr_ULDATA2016preVFPE = cms.VPSet( +multPhiCorr_Puppi_ULDATA2016preVFPE = cms.VPSet( cms.PSet( name=cms.string("ULDATA2016preVFPE"), type=cms.int32(0), @@ -196,7 +196,7 @@ ) # ULDATA 2016preVFPF corrections -multPhiCorr_ULDATA2016preVFPF = cms.VPSet( +multPhiCorr_Puppi_ULDATA2016preVFPF = cms.VPSet( cms.PSet( name=cms.string("ULDATA2016preVFPF"), type=cms.int32(0), @@ -211,7 +211,7 @@ ) # ULDATA 2016ostVFPF corrections -multPhiCorr_ULDATA2016postVFPF = cms.VPSet( +multPhiCorr_Puppi_ULDATA2016postVFPF = cms.VPSet( cms.PSet( name=cms.string("ULDATA2016postVFPF"), type=cms.int32(0), @@ -226,7 +226,7 @@ ) # ULDATA 2016ostVFPG corrections -multPhiCorr_ULDATA2016postVFPG = cms.VPSet( +multPhiCorr_Puppi_ULDATA2016postVFPG = cms.VPSet( cms.PSet( name=cms.string("ULDATA2016postVFPG"), type=cms.int32(0), @@ -241,7 +241,7 @@ ) # ULDATA 2016ostVFPH corrections -multPhiCorr_ULDATA2016postVFPH = cms.VPSet( +multPhiCorr_Puppi_ULDATA2016postVFPH = cms.VPSet( cms.PSet( name=cms.string("ULDATA2016postVFPH"), type=cms.int32(0), diff --git a/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py b/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py index 2615d9a88ac4b..12aedf96a3115 100644 --- a/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py +++ b/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py @@ -94,7 +94,10 @@ # Run2 UL MC XY(Type1 PFMET Phi) corrections import JetMETCorrections.Type1MET.multPhiCorr_Run2_ULMC_cfi as multPhiCorrParams_Run2_ULMC import JetMETCorrections.Type1MET.multPhiCorr_Run2_ULDATA_cfi as multPhiCorrParams_Run2_ULDATA +import JetMETCorrections.Type1MET.multPhiCorr_Puppi_Run2_ULMC_cfi as multPhiCorrParams_Puppi_Run2_ULMC +import JetMETCorrections.Type1MET.multPhiCorr_Puppi_Run2_ULDATA_cfi as multPhiCorrParams_Puppi_Run2_ULDATA +# PFMET XY corrections patMultPhiCorrParams_ULMC2018 = multPhiCorrParams_Run2_ULMC.multPhiCorr_ULMC2018 patMultPhiCorrParams_ULMC2017 = multPhiCorrParams_Run2_ULMC.multPhiCorr_ULMC2017 patMultPhiCorrParams_ULMC2016preVFP = multPhiCorrParams_Run2_ULMC.multPhiCorr_ULMC2016preVFP @@ -121,6 +124,33 @@ patMultPhiCorrParams_ULDATA2016postVFPG = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2016postVFPG patMultPhiCorrParams_ULDATA2016postVFPH = multPhiCorrParams_Run2_ULDATA.multPhiCorr_ULDATA2016postVFPH +# PuppiMET XY corrections +patMultPhiCorrParams_Puppi_ULMC2018 = multPhiCorrParams_Puppi_Run2_ULMC.multPhiCorr_Puppi_ULMC2018 +patMultPhiCorrParams_Puppi_ULMC2017 = multPhiCorrParams_Puppi_Run2_ULMC.multPhiCorr_Puppi_ULMC2017 +patMultPhiCorrParams_Puppi_ULMC2016preVFP = multPhiCorrParams_Puppi_Run2_ULMC.multPhiCorr_Puppi_ULMC2016preVFP +patMultPhiCorrParams_Puppi_ULMC2016postVFP = multPhiCorrParams_Puppi_Run2_ULMC.multPhiCorr_Puppi_ULMC2016postVFP + +patMultPhiCorrParams_Puppi_ULDATA2018A = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2018A +patMultPhiCorrParams_Puppi_ULDATA2018B = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2018B +patMultPhiCorrParams_Puppi_ULDATA2018C = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2018C +patMultPhiCorrParams_Puppi_ULDATA2018D = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2018D + +patMultPhiCorrParams_Puppi_ULDATA2017B = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2017B +patMultPhiCorrParams_Puppi_ULDATA2017C = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2017C +patMultPhiCorrParams_Puppi_ULDATA2017D = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2017D +patMultPhiCorrParams_Puppi_ULDATA2017E = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2017E +patMultPhiCorrParams_Puppi_ULDATA2017F = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2017F + +patMultPhiCorrParams_Puppi_ULDATA2016preVFPB = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2016preVFPB +patMultPhiCorrParams_Puppi_ULDATA2016preVFPC = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2016preVFPC +patMultPhiCorrParams_Puppi_ULDATA2016preVFPD = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2016preVFPD +patMultPhiCorrParams_Puppi_ULDATA2016preVFPE = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2016preVFPE +patMultPhiCorrParams_Puppi_ULDATA2016preVFPF = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2016preVFPF + +patMultPhiCorrParams_Puppi_ULDATA2016postVFPF = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2016postVFPF +patMultPhiCorrParams_Puppi_ULDATA2016postVFPG = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2016postVFPG +patMultPhiCorrParams_Puppi_ULDATA2016postVFPH = multPhiCorrParams_Puppi_Run2_ULDATA.multPhiCorr_Puppi_ULDATA2016postVFPH + patPFMetTxyCorrTask = cms.Task(patPFMetTxyCorr) patPFMetTxyCorrSequence = cms.Sequence(patPFMetTxyCorrTask) From 5660e18b32607d1283ad3620df87f91680a318a8 Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Tue, 19 Apr 2022 11:05:29 +0200 Subject: [PATCH 09/11] allow XY MET corrections also for Puppi --- .../python/tools/runMETCorrectionsAndUncertainties.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index 9243137ed1a26..ffa62c472b4a7 100644 --- a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py +++ b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py @@ -1093,7 +1093,10 @@ def tuneTxyParameters(self, process, corScheme, postfix, datamc="", campaign="", xyTags["{}_{}".format(corScheme_,"50ns")]=getattr(metCors,"{}_{}_{}".format("patMultPhiCorrParams",corScheme_,"50ns")) xyTags["{}_{}".format(corScheme_,"25ns")]=getattr(metCors,"{}_{}_{}".format("patMultPhiCorrParams",corScheme_,"25ns")) if datamc!="" and campaign!="" and era!="": - xyTags["{}_{}_{}_{}".format(corScheme_,campaign,datamc,era)]=getattr(metCors,"{}_{}{}{}".format("patMultPhiCorrParams",campaign,datamc,era)) + if not self.getvalue("Puppi"): + xyTags["{}_{}_{}_{}".format(corScheme_,campaign,datamc,era)]=getattr(metCors,"{}_{}{}{}".format("patMultPhiCorrParams",campaign,datamc,era)) + else: + xyTags["{}_{}_{}_{}".format(corScheme_,campaign,datamc,era)]=getattr(metCors,"{}_{}{}{}".format("patMultPhiCorrParams_Puppi",campaign,datamc,era)) if datamc!="" and campaign!="" and era!="": getattr(process, "patPFMetTxyCorr"+postfix).parameters = xyTags["{}_{}_{}_{}".format(corScheme,campaign,datamc,era)] From 3421775490e19d84e0f7314c4925b11d588532eb Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Fri, 20 May 2022 13:26:32 +0200 Subject: [PATCH 10/11] code-format --- .../plugins/MultShiftMETcorrInputProducer.cc | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc index 076de3a0a0893..bdc99b265ac4e 100644 --- a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc +++ b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc @@ -106,20 +106,21 @@ void MultShiftMETcorrInputProducer::produce(edm::Event& evt, const edm::EventSet edm::Handle> weights; if (!weightsToken_.isUninitialized()) evt.getByToken(weightsToken_, weights); - if(std::find(varType_.begin(),varType_.end(),0)!=varType_.end() || std::find(varType_.begin(),varType_.end(),2)!=varType_.end()) { - for (unsigned i = 0; i < particleFlow->size(); ++i) { - const reco::Candidate& c = particleFlow->at(i); - for (unsigned j = 0; j < type_.size(); j++) { - if (abs(c.pdgId()) == translateTypeToAbsPdgId(reco::PFCandidate::ParticleType(type_[j]))) { - if ((c.eta() > etaMin_[j]) and (c.eta() < etaMax_[j])) { - float weight = (!weightsToken_.isUninitialized()) ? (*weights)[particleFlow->ptrAt(i)] : 1.0; - counts_[j] += (weight > 0); - sumPt_[j] += c.pt() * weight; - continue; - } + if (std::find(varType_.begin(), varType_.end(), 0) != varType_.end() || + std::find(varType_.begin(), varType_.end(), 2) != varType_.end()) { + for (unsigned i = 0; i < particleFlow->size(); ++i) { + const reco::Candidate& c = particleFlow->at(i); + for (unsigned j = 0; j < type_.size(); j++) { + if (abs(c.pdgId()) == translateTypeToAbsPdgId(reco::PFCandidate::ParticleType(type_[j]))) { + if ((c.eta() > etaMin_[j]) and (c.eta() < etaMax_[j])) { + float weight = (!weightsToken_.isUninitialized()) ? (*weights)[particleFlow->ptrAt(i)] : 1.0; + counts_[j] += (weight > 0); + sumPt_[j] += c.pt() * weight; + continue; } } } + } } //MM: loop over all constituent types and sum each correction @@ -135,14 +136,11 @@ void MultShiftMETcorrInputProducer::produce(edm::Event& evt, const edm::EventSet double val(0.); if (varType_[j] == 0) { val = counts_[j]; - } - else if (varType_[j] == 1) { + } else if (varType_[j] == 1) { val = ngoodVertices; - } - else if (varType_[j] == 2) { + } else if (varType_[j] == 2) { val = sumPt_[j]; - } - else if (varType_[j] == 3) { + } else if (varType_[j] == 3) { val = nVertices; } From cf9bccace65be2866d7826846037e4188ff64e6c Mon Sep 17 00:00:00 2001 From: Michael Wassmer Date: Mon, 27 Jun 2022 11:03:32 +0200 Subject: [PATCH 11/11] Remove forgotten debug output in runMETCorrectionsAndUncertainties.py --- .../PatUtils/python/tools/runMETCorrectionsAndUncertainties.py | 1 - 1 file changed, 1 deletion(-) diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index ffa62c472b4a7..cb3d6a886ef04 100644 --- a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py +++ b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py @@ -1087,7 +1087,6 @@ def removePostfix(self, name, postfix): def tuneTxyParameters(self, process, corScheme, postfix, datamc="", campaign="", era="" ): corSchemes = ["Txy", "T1Txy", "T0pcTxy", "T0pcT1Txy", "T1T2Txy", "T0pcT1T2Txy", "T1SmearTxy", "T1T2SmearTxy", "T0pcT1SmearTxy", "T0pcT1T2SmearTxy"] import PhysicsTools.PatUtils.patPFMETCorrections_cff as metCors - print("DEBUG ",campaign,datamc,era) xyTags = {} for corScheme_ in corSchemes: xyTags["{}_{}".format(corScheme_,"50ns")]=getattr(metCors,"{}_{}_{}".format("patMultPhiCorrParams",corScheme_,"50ns"))