diff --git a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc index 21d588ac4a7ca..bdc99b265ac4e 100644 --- a/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc +++ b/JetMETCorrections/Type1MET/plugins/MultShiftMETcorrInputProducer.cc @@ -88,12 +88,12 @@ void MultShiftMETcorrInputProducer::produce(edm::Event& evt, const edm::EventSet if (!hpv.isValid()) { edm::LogError("MultShiftMETcorrInputProducer::produce") << "could not find vertex collection "; } - std::vector goodVertices; + uint ngoodVertices = 0; 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]); + ngoodVertices += 1; } - int ngoodVertices = goodVertices.size(); + uint nVertices = hpv->size(); for (unsigned i = 0; i < counts_.size(); i++) counts_[i] = 0; @@ -106,15 +106,18 @@ 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; + } } } } @@ -133,12 +136,12 @@ void MultShiftMETcorrInputProducer::produce(edm::Event& evt, const edm::EventSet double val(0.); 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); 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..5c5657de833b5 --- /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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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_Puppi_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), + ), +) 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), + ), +) 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..72cf0ceb3d576 --- /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_EOYMC2018 = cms.VPSet( + cms.PSet( + name=cms.string("EOYMC2018"), + 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.296713,-0.141506), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.115685,0.0128193), + ), +) + +# EOY 2017 MC corrections without METv2 fix +multPhiCorr_EOYMC2017 = cms.VPSet( + cms.PSet( + name=cms.string("EOYMC2017"), + 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.217714,0.493361), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.177058,-0.336648), + ), +) + +# EOY 2017 MC corrections with METv2 fix +multPhiCorr_EOYMC2017_METv2 = cms.VPSet( + cms.PSet( + name=cms.string("EOYMC2017_METv2"), + 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.182569,0.276542), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.155652,-0.417633), + ), +) + +# EOY 2016 MC corrections +multPhiCorr_EOYMC2016 = cms.VPSet( + cms.PSet( + name=cms.string("EOYMC2016"), + 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.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..858ba5a1246f9 --- /dev/null +++ b/JetMETCorrections/Type1MET/python/multPhiCorr_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.263733,-1.91115), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0431304,-0.112043), + ), +) + +# 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.400466,-3.05914), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.146125,-0.533233), + ), +) + +# 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.430911,-1.42865), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0620083,-1.46021), + ), +) + +# 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.457327,-1.56856), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0684071,-0.928372), + ), +) + +# 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.211161,0.419333), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.251789,-1.28089), + ), +) + +# 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.185184,-0.164009), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.200941,-0.56853), + ), +) + +# 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.201606,0.426502), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.188208,-0.58313), + ), +) + +# 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.162472,0.176329), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.138076,-0.250239), + ), +) + +# 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.210639,0.72934), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.198626,1.028), + ), +) + +# 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.0214894,-0.188255), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0876624,0.812885), + ), +) + +# 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.032209,0.067288), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.113917,0.743906), + ), +) + +# 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.0293663,0.21106), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.11331,0.815787), + ), +) + +# 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.0132046,0.20073), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.134809,0.679068), + ), +) + +# 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.0543566,0.816597), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.114225,1.17266), + ), +) + +# 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.134616,-0.89965), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0397736,1.0385), + ), +) + +# 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.121809,-0.584893), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0558974,0.891234), + ), +) + +# 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.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..c261b3a39d153 --- /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_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.183518,0.546754), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.192263,-0.42121), + ), +) + +# UL 2017 MC corrections +multPhiCorr_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.300155,1.90608), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.300213,-2.02232), + ), +) + +# UL 2016preVFP MC corrections +multPhiCorr_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.188743,0.136539), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.0127927,0.117747), + ), +) + +# UL 2016postVFP MC corrections +multPhiCorr_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.153497,-0.231751), + fy=cms.string("((x*[0])+[1])"), + py=cms.vdouble(0.00731978,0.243323), + ), +) diff --git a/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py b/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py index 336ed4be7fd65..12aedf96a3115 100644 --- a/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py +++ b/PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py @@ -91,6 +91,66 @@ 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 +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 +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 + +# 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) diff --git a/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py b/PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py index c60856e25f3b4..cb3d6a886ef04 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,23 @@ 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"] + 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!="": + 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)] + else: + getattr(process, "patPFMetTxyCorr"+postfix).parameters = xyTags[corScheme+"_25ns"] #==================================================================================================== @@ -2053,6 +2055,8 @@ def runMetCorAndUncFromMiniAOD(process, metType="PF", fixEE2017=False, fixEE2017Params=None, extractDeepMETs=False, + campaign="", + era="", postfix=""): runMETCorrectionsAndUncertainties = RunMETCorrectionsAndUncertainties() @@ -2087,6 +2091,8 @@ def runMetCorAndUncFromMiniAOD(process, metType="PF", fixEE2017=fixEE2017, fixEE2017Params=fixEE2017Params, extractDeepMETs=extractDeepMETs, + campaign=campaign, + era=era, ) #MET T1+Txy / Smear @@ -2119,6 +2125,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 +2158,6 @@ def runMetCorAndUncFromMiniAOD(process, metType="PF", fixEE2017=fixEE2017, fixEE2017Params=fixEE2017Params, extractDeepMETs=extractDeepMETs, + campaign=campaign, + era=era, )