From c548709a0ff6117b881241c5077358993744d73a Mon Sep 17 00:00:00 2001 From: Kenichi Hatakeyama Date: Mon, 27 Jul 2020 18:11:20 -0500 Subject: [PATCH 1/6] PFProducer fix for PFMuonAlgo fillPSetDescription --- .../PFProducer/plugins/PFProducer.cc | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/RecoParticleFlow/PFProducer/plugins/PFProducer.cc b/RecoParticleFlow/PFProducer/plugins/PFProducer.cc index 20c11ed085e81..3c293db8aaeda 100644 --- a/RecoParticleFlow/PFProducer/plugins/PFProducer.cc +++ b/RecoParticleFlow/PFProducer/plugins/PFProducer.cc @@ -144,8 +144,10 @@ PFProducer::PFProducer(const edm::ParameterSet& iConfig) // Reading new EGamma selection cuts bool useProtectionsForJetMET(false); + // Reading new EGamma ubiased collections and value maps if (use_EGammaFilters_) { + inputTagPFEGammaCandidates_ = consumes>((iConfig.getParameter("PFEGammaCandidates"))); inputTagValueMapGedElectrons_ = @@ -153,8 +155,16 @@ PFProducer::PFProducer(const edm::ParameterSet& iConfig) inputTagValueMapGedPhotons_ = consumes>(iConfig.getParameter("GedPhotonValueMap")); useProtectionsForJetMET = iConfig.getParameter("useProtectionsForJetMET"); + + const edm::ParameterSet pfEGammaFiltersParams = + iConfig.getParameter("PFEGammaFiltersParameters"); + pfegamma_ = std::make_unique(pfEGammaFiltersParams); + } + // EGamma filters + pfAlgo_.setEGammaParameters(use_EGammaFilters_, useProtectionsForJetMET); + //Secondary tracks and displaced vertices parameters bool rejectTracks_Bad = iConfig.getParameter("rejectTracks_Bad"); @@ -174,15 +184,6 @@ PFProducer::PFProducer(const edm::ParameterSet& iConfig) if (useCalibrationsFromDB_) calibrationsLabel_ = iConfig.getParameter("calibrationsLabel"); - // EGamma filters - pfAlgo_.setEGammaParameters(use_EGammaFilters_, useProtectionsForJetMET); - - if (use_EGammaFilters_) { - const edm::ParameterSet pfEGammaFiltersParams = - iConfig.getParameter("PFEGammaFiltersParameters"); - pfegamma_ = std::make_unique(pfEGammaFiltersParams); - } - // Secondary tracks and displaced vertices parameters pfAlgo_.setDisplacedVerticesParameters( rejectTracks_Bad, rejectTracks_Step45, usePFNuclearInteractions, usePFConversions, usePFDecays, dptRel_DispVtx); @@ -349,7 +350,7 @@ void PFProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) // For PFMuonAlgo edm::ParameterSetDescription psd_PFMuonAlgo; - PFEGammaFilters::fillPSetDescription(psd_PFMuonAlgo); + PFMuonAlgo::fillPSetDescription(psd_PFMuonAlgo); desc.add("PFMuonAlgoParameters", psd_PFMuonAlgo); // Input displaced vertices From 4fcd543e877aee21ee1e6b13d90cd10d94378555 Mon Sep 17 00:00:00 2001 From: Kenichi Hatakeyama Date: Tue, 28 Jul 2020 07:25:51 -0500 Subject: [PATCH 2/6] code-format --- RecoParticleFlow/PFProducer/plugins/PFProducer.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/RecoParticleFlow/PFProducer/plugins/PFProducer.cc b/RecoParticleFlow/PFProducer/plugins/PFProducer.cc index 3c293db8aaeda..a376e5030193b 100644 --- a/RecoParticleFlow/PFProducer/plugins/PFProducer.cc +++ b/RecoParticleFlow/PFProducer/plugins/PFProducer.cc @@ -147,7 +147,6 @@ PFProducer::PFProducer(const edm::ParameterSet& iConfig) // Reading new EGamma ubiased collections and value maps if (use_EGammaFilters_) { - inputTagPFEGammaCandidates_ = consumes>((iConfig.getParameter("PFEGammaCandidates"))); inputTagValueMapGedElectrons_ = @@ -159,7 +158,6 @@ PFProducer::PFProducer(const edm::ParameterSet& iConfig) const edm::ParameterSet pfEGammaFiltersParams = iConfig.getParameter("PFEGammaFiltersParameters"); pfegamma_ = std::make_unique(pfEGammaFiltersParams); - } // EGamma filters From cb9cbf90816b436f2d7f6d16583e7e54bb985701 Mon Sep 17 00:00:00 2001 From: Kenichi Hatakeyama Date: Tue, 28 Jul 2020 11:47:43 -0500 Subject: [PATCH 3/6] customize HLT for CMSSW --- HLTrigger/Configuration/python/customizeHLTforCMSSW.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 81f6bad8e77cf..bc9109352d90a 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -170,10 +170,20 @@ def customiseFor2017DtUnpacking(process): return process +def customiseFor30936(process): + """PFProducer fix for PFMuonAlgo's fillPSetDescription""" + + for producer in producers_by_type(process, "PFProducer"): + del producer.PFMuonAlgoParameters + # The parameters should be populated automatically via fillPSetDescription + + return process + # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) + process = customiseFor30936(process) return process From 82b57f3d31a4e4fa10bf2120dadf3d7d366378df Mon Sep 17 00:00:00 2001 From: Kenichi Hatakeyama Date: Sat, 1 Aug 2020 11:48:59 -0500 Subject: [PATCH 4/6] Set up static function(s) of PFMuonAlgo for use from GeneralTracksImporter(WithVeto) --- .../PFProducer/interface/PFMuonAlgo.h | 15 ++- .../importers/GeneralTracksImporter.cc | 29 ++--- .../GeneralTracksImporterWithVeto.cc | 30 ++---- .../python/particleFlowBlock_cfi.py | 3 +- RecoParticleFlow/PFProducer/src/PFMuonAlgo.cc | 102 ++++++++---------- 5 files changed, 74 insertions(+), 105 deletions(-) diff --git a/RecoParticleFlow/PFProducer/interface/PFMuonAlgo.h b/RecoParticleFlow/PFProducer/interface/PFMuonAlgo.h index 51b9f6199787b..68775ad3c2720 100644 --- a/RecoParticleFlow/PFProducer/interface/PFMuonAlgo.h +++ b/RecoParticleFlow/PFProducer/interface/PFMuonAlgo.h @@ -40,7 +40,7 @@ class PFMuonAlgo { static void printMuonProperties(const reco::MuonRef& muonRef); ////POST CLEANING AND MOMEMNTUM ASSIGNMENT - bool hasValidTrack(const reco::MuonRef& muonRef, bool loose = false); + static bool hasValidTrack(const reco::MuonRef& muonRef, bool loose, double maxDPtOPt); //Make a PF Muon : Basic method bool reconstructMuon(reco::PFCandidate&, const reco::MuonRef&, bool allowLoose = false); @@ -76,17 +76,14 @@ class PFMuonAlgo { return std::move(pfAddedMuonCandidates_); } + static std::vector muonTracks(const reco::MuonRef& muon, + double maxDPtOPt = 1e+9, + bool includeSA = false); + private: - //Gives the track with the smallest Dpt/Pt + //Give the track with the smallest Dpt/Pt MuonTrackTypePair getTrackWithSmallestError(const std::vector&); - std::vector muonTracks(const reco::MuonRef& muon, - bool includeSA = false, - double dpt = 1e+9); - - //Gets the good tracks - std::vector goodMuonTracks(const reco::MuonRef& muon, bool includeSA = false); - //Estimate MET and SUmET for post cleaning void estimateEventQuantities(const reco::PFCandidateCollection*); diff --git a/RecoParticleFlow/PFProducer/plugins/importers/GeneralTracksImporter.cc b/RecoParticleFlow/PFProducer/plugins/importers/GeneralTracksImporter.cc index ba626de503260..ea4a432213bdd 100644 --- a/RecoParticleFlow/PFProducer/plugins/importers/GeneralTracksImporter.cc +++ b/RecoParticleFlow/PFProducer/plugins/importers/GeneralTracksImporter.cc @@ -1,12 +1,10 @@ -#include - -#include "DataFormats/Common/interface/ValueMap.h" -#include "DataFormats/MuonReco/interface/Muon.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "RecoParticleFlow/PFProducer/interface/BlockElementImporterBase.h" #include "DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h" #include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h" #include "DataFormats/TrackReco/interface/Track.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "RecoParticleFlow/PFProducer/interface/BlockElementImporterBase.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/Common/interface/ValueMap.h" #include "RecoParticleFlow/PFProducer/interface/PFMuonAlgo.h" #include "RecoParticleFlow/PFTracking/interface/PFTrackAlgoTools.h" @@ -16,18 +14,12 @@ class GeneralTracksImporter : public BlockElementImporterBase { : BlockElementImporterBase(conf, sumes), src_(sumes.consumes(conf.getParameter("source"))), muons_(sumes.consumes(conf.getParameter("muonSrc"))), - trackQuality_((conf.existsAs("trackQuality")) - ? reco::TrackBase::qualityByName(conf.getParameter("trackQuality")) - : reco::TrackBase::highPurity), + trackQuality_(reco::TrackBase::qualityByName(conf.getParameter("trackQuality"))), DPtovPtCut_(conf.getParameter >("DPtOverPtCuts_byTrackAlgo")), NHitCut_(conf.getParameter >("NHitCuts_byTrackAlgo")), useIterTracking_(conf.getParameter("useIterativeTracking")), - cleanBadConvBrems_( - conf.existsAs("cleanBadConvertedBrems") ? conf.getParameter("cleanBadConvertedBrems") : false) { - bool postMuonCleaning = - conf.existsAs("postMuonCleaning") ? conf.getParameter("postMuonCleaning") : false; - pfmu_ = std::make_unique(conf, postMuonCleaning); - } + cleanBadConvBrems_(conf.getParameter("cleanBadConvertedBrems")), + muonMaxDPtOPt_(conf.getParameter("muonMaxDPtOPt")) {} void importToBlock(const edm::Event&, ElementList&) const override; @@ -40,7 +32,7 @@ class GeneralTracksImporter : public BlockElementImporterBase { const std::vector DPtovPtCut_; const std::vector NHitCut_; const bool useIterTracking_, cleanBadConvBrems_; - std::unique_ptr pfmu_; + const double muonMaxDPtOPt_; }; DEFINE_EDM_PLUGIN(BlockElementImporterFactory, GeneralTracksImporter, "GeneralTracksImporter"); @@ -117,8 +109,9 @@ void GeneralTracksImporter::importToBlock(const edm::Event& e, BlockElementImpor bool thisIsAPotentialMuon = false; if (muId != -1) { muonref = reco::MuonRef(muons, muId); - thisIsAPotentialMuon = ((pfmu_->hasValidTrack(muonref, true) && PFMuonAlgo::isLooseMuon(muonref)) || - (pfmu_->hasValidTrack(muonref, false) && PFMuonAlgo::isMuon(muonref))); + thisIsAPotentialMuon = + ((PFMuonAlgo::hasValidTrack(muonref, true, muonMaxDPtOPt_) && PFMuonAlgo::isLooseMuon(muonref)) || + (PFMuonAlgo::hasValidTrack(muonref, false, muonMaxDPtOPt_) && PFMuonAlgo::isMuon(muonref))); } if (thisIsAPotentialMuon || PFTrackAlgoTools::goodPtResolution( pftrackref->trackRef(), DPtovPtCut_, NHitCut_, useIterTracking_, trackQuality_)) { diff --git a/RecoParticleFlow/PFProducer/plugins/importers/GeneralTracksImporterWithVeto.cc b/RecoParticleFlow/PFProducer/plugins/importers/GeneralTracksImporterWithVeto.cc index d1f6285eb0788..a244ebf141fa8 100644 --- a/RecoParticleFlow/PFProducer/plugins/importers/GeneralTracksImporterWithVeto.cc +++ b/RecoParticleFlow/PFProducer/plugins/importers/GeneralTracksImporterWithVeto.cc @@ -1,12 +1,10 @@ -#include - -#include "DataFormats/Common/interface/ValueMap.h" -#include "DataFormats/MuonReco/interface/Muon.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "RecoParticleFlow/PFProducer/interface/BlockElementImporterBase.h" #include "DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h" #include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h" #include "DataFormats/TrackReco/interface/Track.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "RecoParticleFlow/PFProducer/interface/BlockElementImporterBase.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/Common/interface/ValueMap.h" #include "RecoParticleFlow/PFProducer/interface/PFMuonAlgo.h" #include "RecoParticleFlow/PFTracking/interface/PFTrackAlgoTools.h" @@ -17,18 +15,12 @@ class GeneralTracksImporterWithVeto : public BlockElementImporterBase { src_(sumes.consumes(conf.getParameter("source"))), veto_(sumes.consumes(conf.getParameter("veto"))), muons_(sumes.consumes(conf.getParameter("muonSrc"))), - trackQuality_((conf.existsAs("trackQuality")) - ? reco::TrackBase::qualityByName(conf.getParameter("trackQuality")) - : reco::TrackBase::highPurity), + trackQuality_(reco::TrackBase::qualityByName(conf.getParameter("trackQuality"))), DPtovPtCut_(conf.getParameter >("DPtOverPtCuts_byTrackAlgo")), NHitCut_(conf.getParameter >("NHitCuts_byTrackAlgo")), useIterTracking_(conf.getParameter("useIterativeTracking")), - cleanBadConvBrems_( - conf.existsAs("cleanBadConvertedBrems") ? conf.getParameter("cleanBadConvertedBrems") : false) { - bool postMuonCleaning = - conf.existsAs("postMuonCleaning") ? conf.getParameter("postMuonCleaning") : false; - pfmu_ = std::make_unique(conf, postMuonCleaning); - } + cleanBadConvBrems_(conf.getParameter("cleanBadConvertedBrems")), + muonMaxDPtOPt_(conf.getParameter("muonMaxDPtOPt")) {} void importToBlock(const edm::Event&, ElementList&) const override; @@ -41,8 +33,7 @@ class GeneralTracksImporterWithVeto : public BlockElementImporterBase { const std::vector DPtovPtCut_; const std::vector NHitCut_; const bool useIterTracking_, cleanBadConvBrems_; - - std::unique_ptr pfmu_; + const double muonMaxDPtOPt_; }; DEFINE_EDM_PLUGIN(BlockElementImporterFactory, GeneralTracksImporterWithVeto, "GeneralTracksImporterWithVeto"); @@ -126,8 +117,9 @@ void GeneralTracksImporterWithVeto::importToBlock(const edm::Event& e, bool thisIsAPotentialMuon = false; if (muId != -1) { muonref = reco::MuonRef(muons, muId); - thisIsAPotentialMuon = ((pfmu_->hasValidTrack(muonref, true) && PFMuonAlgo::isLooseMuon(muonref)) || - (pfmu_->hasValidTrack(muonref, false) && PFMuonAlgo::isMuon(muonref))); + thisIsAPotentialMuon = + ((PFMuonAlgo::hasValidTrack(muonref, true, muonMaxDPtOPt_) && PFMuonAlgo::isLooseMuon(muonref)) || + (PFMuonAlgo::hasValidTrack(muonref, false, muonMaxDPtOPt_) && PFMuonAlgo::isMuon(muonref))); } if (thisIsAPotentialMuon || PFTrackAlgoTools::goodPtResolution( pftrackref->trackRef(), DPtovPtCut_, NHitCut_, useIterTracking_, trackQuality_)) { diff --git a/RecoParticleFlow/PFProducer/python/particleFlowBlock_cfi.py b/RecoParticleFlow/PFProducer/python/particleFlowBlock_cfi.py index 1613478963917..91a902de00215 100644 --- a/RecoParticleFlow/PFProducer/python/particleFlowBlock_cfi.py +++ b/RecoParticleFlow/PFProducer/python/particleFlowBlock_cfi.py @@ -46,7 +46,8 @@ useIterativeTracking = cms.bool(True), DPtOverPtCuts_byTrackAlgo = cms.vdouble(10.0,10.0,10.0, 10.0,10.0,5.0), - NHitCuts_byTrackAlgo = cms.vuint32(3,3,3,3,3,3) + NHitCuts_byTrackAlgo = cms.vuint32(3,3,3,3,3,3), + muonMaxDPtOPt = cms.double(1) ), # secondary GSF tracks are also turned off #cms.PSet( importerName = cms.string("GSFTrackImporter"), diff --git a/RecoParticleFlow/PFProducer/src/PFMuonAlgo.cc b/RecoParticleFlow/PFProducer/src/PFMuonAlgo.cc index 51e46d238c2f1..f5726e32b70ae 100644 --- a/RecoParticleFlow/PFProducer/src/PFMuonAlgo.cc +++ b/RecoParticleFlow/PFProducer/src/PFMuonAlgo.cc @@ -1,28 +1,18 @@ #include "RecoParticleFlow/PFProducer/interface/PFMuonAlgo.h" -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/MuonReco/interface/MuonCocktails.h" -#include "DataFormats/MuonReco/interface/MuonSelectors.h" #include "DataFormats/ParticleFlowReco/interface/PFBlock.h" #include "DataFormats/ParticleFlowReco/interface/PFBlockElement.h" -#include "DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h" #include "DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h" +#include "DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h" #include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonSelectors.h" +#include "DataFormats/MuonReco/interface/MuonCocktails.h" #include -#include using namespace std; using namespace reco; using namespace boost; -namespace { - - template - T getParameter(edm::ParameterSet const& pset, std::string&& name, T&& defaultValue) { - return pset.exists(name) ? pset.getParameter(name) : defaultValue; - } - -} // namespace - PFMuonAlgo::PFMuonAlgo(const edm::ParameterSet& iConfig, bool postMuonCleaning) : pfCosmicsMuonCleanedCandidates_(std::make_unique()), @@ -32,27 +22,27 @@ PFMuonAlgo::PFMuonAlgo(const edm::ParameterSet& iConfig, bool postMuonCleaning) pfPunchThroughHadronCleanedCandidates_(std::make_unique()), pfAddedMuonCandidates_(std::make_unique()), - maxDPtOPt_(getParameter(iConfig, "maxDPtOPt", 1.0)), - trackQuality_(reco::TrackBase::qualityByName(getParameter(iConfig, "trackQuality", "highPurity"))), - errorCompScale_(getParameter(iConfig, "ptErrorScale", 8.0)), + maxDPtOPt_(iConfig.getParameter("maxDPtOPt")), + trackQuality_(reco::TrackBase::qualityByName(iConfig.getParameter("trackQuality"))), + errorCompScale_(iConfig.getParameter("ptErrorScale")), postCleaning_(postMuonCleaning), // disable by default (for HLT) - eventFractionCleaning_(getParameter(iConfig, "eventFractionForCleaning", 0.5)), - minPostCleaningPt_(getParameter(iConfig, "minPtForPostCleaning", 20.)), - eventFactorCosmics_(getParameter(iConfig, "eventFactorForCosmics", 10.)), - metSigForCleaning_(getParameter(iConfig, "metSignificanceForCleaning", 3.)), - metSigForRejection_(getParameter(iConfig, "metSignificanceForRejection", 4.)), - metFactorCleaning_(getParameter(iConfig, "metFactorForCleaning", 4.)), - eventFractionRejection_(getParameter(iConfig, "eventFractionForRejection", 0.8)), - metFactorRejection_(getParameter(iConfig, "metFactorForRejection", 4.)), - metFactorHighEta_(getParameter(iConfig, "metFactorForHighEta", 25.)), - ptFactorHighEta_(getParameter(iConfig, "ptFactorForHighEta", 2.)), - metFactorFake_(getParameter(iConfig, "metFactorForFakes", 4.)), - minPunchThroughMomentum_(getParameter(iConfig, "minMomentumForPunchThrough", 100.)), - minPunchThroughEnergy_(getParameter(iConfig, "minEnergyForPunchThrough", 100.)), - punchThroughFactor_(getParameter(iConfig, "punchThroughFactor", 3.)), - punchThroughMETFactor_(getParameter(iConfig, "punchThroughMETFactor", 4.)), - cosmicRejDistance_(getParameter(iConfig, "cosmicRejectionDistance", 1.)) {} + eventFractionCleaning_(iConfig.getParameter("eventFractionForCleaning")), + minPostCleaningPt_(iConfig.getParameter("minPtForPostCleaning")), + eventFactorCosmics_(iConfig.getParameter("eventFactorForCosmics")), + metSigForCleaning_(iConfig.getParameter("metSignificanceForCleaning")), + metSigForRejection_(iConfig.getParameter("metSignificanceForRejection")), + metFactorCleaning_(iConfig.getParameter("metFactorForCleaning")), + eventFractionRejection_(iConfig.getParameter("eventFractionForRejection")), + metFactorRejection_(iConfig.getParameter("metFactorForRejection")), + metFactorHighEta_(iConfig.getParameter("metFactorForHighEta")), + ptFactorHighEta_(iConfig.getParameter("ptFactorForHighEta")), + metFactorFake_(iConfig.getParameter("metFactorForFakes")), + minPunchThroughMomentum_(iConfig.getParameter("minMomentumForPunchThrough")), + minPunchThroughEnergy_(iConfig.getParameter("minEnergyForPunchThrough")), + punchThroughFactor_(iConfig.getParameter("punchThroughFactor")), + punchThroughMETFactor_(iConfig.getParameter("punchThroughMETFactor")), + cosmicRejDistance_(iConfig.getParameter("cosmicRejectionDistance")) {} bool PFMuonAlgo::isMuon(const reco::PFBlockElement& elt) { const auto* eltTrack = dynamic_cast(&elt); @@ -354,11 +344,11 @@ bool PFMuonAlgo::isTightMuonPOG(const reco::MuonRef& muonRef) { return true; } -bool PFMuonAlgo::hasValidTrack(const reco::MuonRef& muonRef, bool loose) { +bool PFMuonAlgo::hasValidTrack(const reco::MuonRef& muonRef, bool loose, double maxDPtOPt) { if (loose) return !muonTracks(muonRef).empty(); else - return !goodMuonTracks(muonRef).empty(); + return !muonTracks(muonRef, maxDPtOPt).empty(); } void PFMuonAlgo::printMuonProperties(const reco::MuonRef& muonRef) { @@ -485,28 +475,24 @@ void PFMuonAlgo::printMuonProperties(const reco::MuonRef& muonRef) { return; } -std::vector PFMuonAlgo::goodMuonTracks(const reco::MuonRef& muon, bool includeSA) { - return muonTracks(muon, includeSA, maxDPtOPt_); -} - std::vector PFMuonAlgo::muonTracks(const reco::MuonRef& muon, - bool includeSA, - double dpt) { + double maxDPtOPt, + bool includeSA) { std::vector out; if (muon->globalTrack().isNonnull() && muon->globalTrack()->pt() > 0) - if (muon->globalTrack()->ptError() / muon->globalTrack()->pt() < dpt) + if (muon->globalTrack()->ptError() / muon->globalTrack()->pt() < maxDPtOPt) out.emplace_back(muon->globalTrack(), reco::Muon::CombinedTrack); if (muon->innerTrack().isNonnull() && muon->innerTrack()->pt() > 0) - if (muon->innerTrack()->ptError() / muon->innerTrack()->pt() < dpt) //Here Loose!@ + if (muon->innerTrack()->ptError() / muon->innerTrack()->pt() < maxDPtOPt) //Here Loose!@ out.emplace_back(muon->innerTrack(), reco::Muon::InnerTrack); bool pickyExists = false; double pickyDpt = 99999.; if (muon->pickyTrack().isNonnull() && muon->pickyTrack()->pt() > 0) { pickyDpt = muon->pickyTrack()->ptError() / muon->pickyTrack()->pt(); - if (pickyDpt < dpt) + if (pickyDpt < maxDPtOPt) out.emplace_back(muon->pickyTrack(), reco::Muon::Picky); pickyExists = true; } @@ -515,7 +501,7 @@ std::vector PFMuonAlgo::muonTracks(const reco::Mu double dytDpt = 99999.; if (muon->dytTrack().isNonnull() && muon->dytTrack()->pt() > 0) { dytDpt = muon->dytTrack()->ptError() / muon->dytTrack()->pt(); - if (dytDpt < dpt) + if (dytDpt < maxDPtOPt) out.emplace_back(muon->dytTrack(), reco::Muon::DYT); dytExists = true; } @@ -527,12 +513,12 @@ std::vector PFMuonAlgo::muonTracks(const reco::Mu if (muon->tpfmsTrack().isNonnull() && muon->tpfmsTrack()->pt() > 0) { double tpfmsDpt = muon->tpfmsTrack()->ptError() / muon->tpfmsTrack()->pt(); if (((pickyExists && tpfmsDpt < pickyDpt) || (!pickyExists)) && - ((dytExists && tpfmsDpt < dytDpt) || (!dytExists)) && tpfmsDpt < dpt) + ((dytExists && tpfmsDpt < dytDpt) || (!dytExists)) && tpfmsDpt < maxDPtOPt) out.emplace_back(muon->tpfmsTrack(), reco::Muon::TPFMS); } if (includeSA && muon->outerTrack().isNonnull()) - if (muon->outerTrack()->ptError() / muon->outerTrack()->pt() < dpt) + if (muon->outerTrack()->ptError() / muon->outerTrack()->pt() < maxDPtOPt) out.emplace_back(muon->outerTrack(), reco::Muon::OuterTrack); return out; @@ -562,9 +548,9 @@ bool PFMuonAlgo::reconstructMuon(reco::PFCandidate& candidate, const reco::MuonR //jet environment often the track is badly measured. In this case //we should not apply Dpt/Pt<1 - std::vector validTracks = goodMuonTracks(muon); + std::vector validTracks = muonTracks(muon, maxDPtOPt_); if (!allowLoose) - validTracks = goodMuonTracks(muon); + validTracks = muonTracks(muon, maxDPtOPt_); else validTracks = muonTracks(muon); @@ -656,27 +642,27 @@ void PFMuonAlgo::postClean(reco::PFCandidateCollection* cands) { if (pfCosmicsMuonCleanedCandidates_.get()) pfCosmicsMuonCleanedCandidates_->clear(); else - pfCosmicsMuonCleanedCandidates_ = std::make_unique(); + pfCosmicsMuonCleanedCandidates_.reset(new reco::PFCandidateCollection); if (pfCleanedTrackerAndGlobalMuonCandidates_.get()) pfCleanedTrackerAndGlobalMuonCandidates_->clear(); else - pfCleanedTrackerAndGlobalMuonCandidates_ = std::make_unique(); + pfCleanedTrackerAndGlobalMuonCandidates_.reset(new reco::PFCandidateCollection); if (pfFakeMuonCleanedCandidates_.get()) pfFakeMuonCleanedCandidates_->clear(); else - pfFakeMuonCleanedCandidates_ = std::make_unique(); + pfFakeMuonCleanedCandidates_.reset(new reco::PFCandidateCollection); if (pfPunchThroughMuonCleanedCandidates_.get()) pfPunchThroughMuonCleanedCandidates_->clear(); else - pfPunchThroughMuonCleanedCandidates_ = std::make_unique(); + pfPunchThroughMuonCleanedCandidates_.reset(new reco::PFCandidateCollection); if (pfPunchThroughHadronCleanedCandidates_.get()) pfPunchThroughHadronCleanedCandidates_->clear(); else - pfPunchThroughHadronCleanedCandidates_ = std::make_unique(); + pfPunchThroughHadronCleanedCandidates_.reset(new reco::PFCandidateCollection); pfPunchThroughHadronCleanedCandidates_->clear(); @@ -743,7 +729,7 @@ void PFMuonAlgo::addMissingMuons(edm::Handle muons, reco:: if (pfAddedMuonCandidates_.get()) pfAddedMuonCandidates_->clear(); else - pfAddedMuonCandidates_ = std::make_unique(); + pfAddedMuonCandidates_.reset(new reco::PFCandidateCollection); for (unsigned imu = 0; imu < muons->size(); ++imu) { reco::MuonRef muonRef(muons, imu); @@ -783,7 +769,7 @@ void PFMuonAlgo::addMissingMuons(edm::Handle muons, reco:: TrackMETComparator comparator(METX_, METY_); //Low pt dont need to be cleaned - std::vector tracks = goodMuonTracks(muonRef, true); + std::vector tracks = muonTracks(muonRef, maxDPtOPt_, true); //If there is at least 1 track choice try to change the track if (!tracks.empty()) { //Find tracks that change dramatically MET or Pt @@ -819,7 +805,7 @@ void PFMuonAlgo::addMissingMuons(edm::Handle muons, reco:: } std::pair PFMuonAlgo::getMinMaxMET2(const reco::PFCandidate& pfc) { - std::vector tracks = goodMuonTracks((pfc.muonRef()), true); + std::vector tracks = muonTracks((pfc.muonRef()), maxDPtOPt_, true); double METXNO = METX_ - pfc.px(); double METYNO = METY_ - pfc.py(); @@ -851,7 +837,7 @@ bool PFMuonAlgo::cleanMismeasured(reco::PFCandidate& pfc, unsigned int i) { //Low pt dont need to be cleaned if (pfc.pt() < minPostCleaningPt_) return false; - std::vector tracks = goodMuonTracks(pfc.muonRef(), false); + std::vector tracks = muonTracks(pfc.muonRef(), maxDPtOPt_, false); //If there is more than 1 track choice try to change the track if (tracks.size() > 1) { From 75bda44f8347b9dbc6f8ea29b06ce0a4f2613b97 Mon Sep 17 00:00:00 2001 From: Kenichi Hatakeyama Date: Sat, 1 Aug 2020 11:56:29 -0500 Subject: [PATCH 5/6] customize HLT for CMSSW --- .../Configuration/python/customizeHLTforCMSSW.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index bc9109352d90a..246f8eb2f2fb4 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -176,6 +176,18 @@ def customiseFor30936(process): for producer in producers_by_type(process, "PFProducer"): del producer.PFMuonAlgoParameters # The parameters should be populated automatically via fillPSetDescription + + # for PFBlockProducer + for producer in producers_by_type(process, "PFBlockProducer"): + if hasattr(producer,'elementImporters'): + for ps in producer.elementImporters.value(): + if hasattr(ps,'importerName') and (ps.importerName == 'GeneralTracksImporter'): + if not hasattr(ps,'muonMaxDPtOPt'): + ps.muonMaxDPtOPt = cms.double(1) # <== to be added + if not hasattr(ps,'trackQuality'): + ps.trackQuality = cms.string("highPurity") # <== to be added + if not hasattr(ps,'cleanBadConvertedBrems'): + ps.cleanBadConvertedBrems = cms.bool(False) # <== to be added return process From 509309b08c39cbeee3ae6a371b44f0e52a5061d3 Mon Sep 17 00:00:00 2001 From: Kenichi Hatakeyama Date: Sat, 1 Aug 2020 14:43:58 -0500 Subject: [PATCH 6/6] Add trackQuality, cleanBadConvertedBrems, muonMaxDPtOPt explicitly. --- RecoHI/Configuration/python/Reconstruction_hiPF_cff.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py b/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py index e2b0282866b37..3f42f98b48b36 100644 --- a/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py +++ b/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py @@ -56,10 +56,13 @@ cms.PSet( importerName = cms.string("GeneralTracksImporter"), source = cms.InputTag("pfTrack"), muonSrc = cms.InputTag("hiMuons1stStep"), + trackQuality = cms.string("highPurity"), + cleanBadConvertedBrems = cms.bool(False), useIterativeTracking = cms.bool(False), DPtOverPtCuts_byTrackAlgo = cms.vdouble(-1.0,-1.0,-1.0, 1.0,1.0), - NHitCuts_byTrackAlgo = cms.vuint32(3,3,3,3,3) + NHitCuts_byTrackAlgo = cms.vuint32(3,3,3,3,3), + muonMaxDPtOPt = cms.double(1) ), # to properly set SC based links you need to run ECAL importer # after you've imported all SCs to the block