From 2d2da58b22877bbfbb6171ff0727260053b495b8 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Thu, 14 Jul 2022 16:18:07 +0200 Subject: [PATCH 1/4] cleanup --- RecoPPS/Local/interface/RPixRoadFinder.h | 1 - .../plugins/CTPPSPixelLocalTrackProducer.cc | 34 ++++++++----------- .../ctppsPixelLocalReconstruction_cff.py | 5 +-- RecoPPS/Local/src/RPixRoadFinder.cc | 1 - 4 files changed, 15 insertions(+), 26 deletions(-) diff --git a/RecoPPS/Local/interface/RPixRoadFinder.h b/RecoPPS/Local/interface/RPixRoadFinder.h index 271af7982b83c..6303ea2f90bb3 100644 --- a/RecoPPS/Local/interface/RPixRoadFinder.h +++ b/RecoPPS/Local/interface/RPixRoadFinder.h @@ -43,7 +43,6 @@ class RPixRoadFinder : public RPixDetPatternFinder { unsigned int minRoadSize_; unsigned int maxRoadSize_; double roadRadiusBadPot_; - // bool isBadPot_; void run(const edm::DetSetVector &input, const CTPPSGeometry &geometry, std::vector &roads); }; diff --git a/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc b/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc index b0241e126bb56..0eac67f7a1d8a 100644 --- a/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc +++ b/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc @@ -65,31 +65,31 @@ class CTPPSPixelLocalTrackProducer : public edm::stream::EDProducer<> { edm::InputTag inputTag_; edm::EDGetTokenT> tokenCTPPSPixelRecHit_; - edm::ESGetToken tokenCTPPSGeometry_; + const edm::ESGetToken tokenCTPPSGeometry_; edm::ESWatcher geometryWatcher_; - edm::ESGetToken tokenCTPPSPixelAnalysisMask_; + const edm::ESGetToken tokenCTPPSPixelAnalysisMask_; uint32_t numberOfPlanesPerPot_; std::vector listOfAllPlanes_; std::unique_ptr patternFinder_; std::unique_ptr trackFinder_; - - // void run(const edm::DetSetVector &input, edm::DetSetVector &output); }; //------------------------------------------------------------------------------------------------// -CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterSet ¶meterSet) { - inputTag_ = parameterSet.getParameter("tag"); - verbosity_ = parameterSet.getUntrackedParameter("verbosity"); - maxHitPerRomanPot_ = parameterSet.getParameter("maxHitPerRomanPot"); - maxHitPerPlane_ = parameterSet.getParameter("maxHitPerPlane"); - maxTrackPerRomanPot_ = parameterSet.getParameter("maxTrackPerRomanPot"); - maxTrackPerPattern_ = parameterSet.getParameter("maxTrackPerPattern"); - numberOfPlanesPerPot_ = parameterSet.getParameter("numberOfPlanesPerPot"); - +CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterSet ¶meterSet) : + verbosity_(parameterSet.getUntrackedParameter("verbosity")), + maxHitPerPlane_(parameterSet.getParameter("maxHitPerPlane")), + maxHitPerRomanPot_(parameterSet.getParameter("maxHitPerRomanPot")), + maxTrackPerRomanPot_(parameterSet.getParameter("maxTrackPerRomanPot")), + maxTrackPerPattern_(parameterSet.getParameter("maxTrackPerPattern")), + tokenCTPPSPixelRecHit_(consumes>(parameterSet.getParameter("tag"))), + tokenCTPPSGeometry_(esConsumes()), + tokenCTPPSPixelAnalysisMask_(esConsumes()), + numberOfPlanesPerPot_(parameterSet.getParameter("numberOfPlanesPerPot")) +{ std::string patternFinderAlgorithm = parameterSet.getParameter("patternFinderAlgorithm"); std::string trackFitterAlgorithm = parameterSet.getParameter("trackFinderAlgorithm"); @@ -115,11 +115,6 @@ CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterS } trackFinder_->setListOfPlanes(listOfAllPlanes_); trackFinder_->initialize(); - - tokenCTPPSPixelRecHit_ = consumes>(inputTag_); - tokenCTPPSGeometry_ = esConsumes(); - tokenCTPPSPixelAnalysisMask_ = esConsumes(); - produces>(); } @@ -156,9 +151,8 @@ void CTPPSPixelLocalTrackProducer::fillDescriptions(edm::ConfigurationDescriptio desc.add("roadRadius", 1.0)->setComment("radius of pattern search window"); desc.add("minRoadSize", 3)->setComment("minimum number of points in a pattern"); desc.add("maxRoadSize", 20)->setComment("maximum number of points in a pattern"); - //parameters for bad pot reconstruction patch 45-220-fr 2022 + //parameter for bad pot reconstruction patch 45-220-fr 2022 desc.add("roadRadiusBadPot", 0.5)->setComment("radius of pattern search window for bad Pot"); - // desc.add("isBadPot", true)->setComment("flag to enable road search for bad pot"); descriptions.add("ctppsPixelLocalTracks", desc); } diff --git a/RecoPPS/Local/python/ctppsPixelLocalReconstruction_cff.py b/RecoPPS/Local/python/ctppsPixelLocalReconstruction_cff.py index 68c77670518cd..6a5ba6c057624 100644 --- a/RecoPPS/Local/python/ctppsPixelLocalReconstruction_cff.py +++ b/RecoPPS/Local/python/ctppsPixelLocalReconstruction_cff.py @@ -9,10 +9,7 @@ # local track producer from RecoPPS.Local.ctppsPixelLocalTracks_cfi import ctppsPixelLocalTracks -#from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -#from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 -#from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 -#(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ctppsPixelLocalTracks, isBadPot = cms.bool(False)) + ctppsPixelLocalReconstructionTask = cms.Task( ctppsPixelClusters,ctppsPixelRecHits,ctppsPixelLocalTracks diff --git a/RecoPPS/Local/src/RPixRoadFinder.cc b/RecoPPS/Local/src/RPixRoadFinder.cc index 5463fe387340f..b6089244d80b2 100644 --- a/RecoPPS/Local/src/RPixRoadFinder.cc +++ b/RecoPPS/Local/src/RPixRoadFinder.cc @@ -21,7 +21,6 @@ RPixRoadFinder::RPixRoadFinder(edm::ParameterSet const& parameterSet) : RPixDetP minRoadSize_ = parameterSet.getParameter("minRoadSize"); maxRoadSize_ = parameterSet.getParameter("maxRoadSize"); roadRadiusBadPot_ = parameterSet.getParameter("roadRadiusBadPot"); - // isBadPot_ = parameterSet.getParameter("isBadPot"); } //------------------------------------------------------------------------------------------------// From c6e0b2a5b3819f92ea3cd83c9e96ab5f92330c79 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Thu, 14 Jul 2022 16:23:21 +0200 Subject: [PATCH 2/4] after checks --- .../plugins/CTPPSPixelLocalTrackProducer.cc | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc b/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc index 0eac67f7a1d8a..82fb400808f27 100644 --- a/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc +++ b/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc @@ -79,17 +79,17 @@ class CTPPSPixelLocalTrackProducer : public edm::stream::EDProducer<> { //------------------------------------------------------------------------------------------------// -CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterSet ¶meterSet) : - verbosity_(parameterSet.getUntrackedParameter("verbosity")), - maxHitPerPlane_(parameterSet.getParameter("maxHitPerPlane")), - maxHitPerRomanPot_(parameterSet.getParameter("maxHitPerRomanPot")), - maxTrackPerRomanPot_(parameterSet.getParameter("maxTrackPerRomanPot")), - maxTrackPerPattern_(parameterSet.getParameter("maxTrackPerPattern")), - tokenCTPPSPixelRecHit_(consumes>(parameterSet.getParameter("tag"))), - tokenCTPPSGeometry_(esConsumes()), - tokenCTPPSPixelAnalysisMask_(esConsumes()), - numberOfPlanesPerPot_(parameterSet.getParameter("numberOfPlanesPerPot")) -{ +CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterSet ¶meterSet) + : verbosity_(parameterSet.getUntrackedParameter("verbosity")), + maxHitPerPlane_(parameterSet.getParameter("maxHitPerPlane")), + maxHitPerRomanPot_(parameterSet.getParameter("maxHitPerRomanPot")), + maxTrackPerRomanPot_(parameterSet.getParameter("maxTrackPerRomanPot")), + maxTrackPerPattern_(parameterSet.getParameter("maxTrackPerPattern")), + tokenCTPPSPixelRecHit_( + consumes>(parameterSet.getParameter("tag"))), + tokenCTPPSGeometry_(esConsumes()), + tokenCTPPSPixelAnalysisMask_(esConsumes()), + numberOfPlanesPerPot_(parameterSet.getParameter("numberOfPlanesPerPot")) { std::string patternFinderAlgorithm = parameterSet.getParameter("patternFinderAlgorithm"); std::string trackFitterAlgorithm = parameterSet.getParameter("trackFinderAlgorithm"); From ad10e4b54de8d155e8d12fd1a78673140e674d89 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Wed, 20 Jul 2022 13:22:49 +0200 Subject: [PATCH 3/4] add const and remove reserve --- .../plugins/CTPPSPixelLocalTrackProducer.cc | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc b/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc index 82fb400808f27..7689b76df685b 100644 --- a/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc +++ b/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc @@ -57,21 +57,19 @@ class CTPPSPixelLocalTrackProducer : public edm::stream::EDProducer<> { static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); private: - int verbosity_; - int maxHitPerPlane_; - int maxHitPerRomanPot_; - int maxTrackPerRomanPot_; - int maxTrackPerPattern_; - - edm::InputTag inputTag_; - edm::EDGetTokenT> tokenCTPPSPixelRecHit_; + const int verbosity_; + const int maxHitPerPlane_; + const int maxHitPerRomanPot_; + const int maxTrackPerRomanPot_; + const int maxTrackPerPattern_; + + const edm::EDGetTokenT> tokenCTPPSPixelRecHit_; const edm::ESGetToken tokenCTPPSGeometry_; edm::ESWatcher geometryWatcher_; const edm::ESGetToken tokenCTPPSPixelAnalysisMask_; - uint32_t numberOfPlanesPerPot_; - std::vector listOfAllPlanes_; + const uint32_t numberOfPlanesPerPot_; std::unique_ptr patternFinder_; std::unique_ptr trackFinder_; @@ -92,6 +90,7 @@ CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterS numberOfPlanesPerPot_(parameterSet.getParameter("numberOfPlanesPerPot")) { std::string patternFinderAlgorithm = parameterSet.getParameter("patternFinderAlgorithm"); std::string trackFitterAlgorithm = parameterSet.getParameter("trackFinderAlgorithm"); + std::vector listOfAllPlanes_; // pattern algorithm selector if (patternFinderAlgorithm == "RPixRoadFinder") { @@ -101,7 +100,6 @@ CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterS << "Pattern finder algorithm" << patternFinderAlgorithm << " does not exist"; } - listOfAllPlanes_.reserve(6); for (uint32_t i = 0; i < numberOfPlanesPerPot_; ++i) { listOfAllPlanes_.push_back(i); } From 74143926dffaae63120967f593b284217039ad40 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Wed, 20 Jul 2022 14:17:50 +0200 Subject: [PATCH 4/4] more cleaning --- RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc b/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc index 7689b76df685b..f7d44c9417703 100644 --- a/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc +++ b/RecoPPS/Local/plugins/CTPPSPixelLocalTrackProducer.cc @@ -90,7 +90,6 @@ CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterS numberOfPlanesPerPot_(parameterSet.getParameter("numberOfPlanesPerPot")) { std::string patternFinderAlgorithm = parameterSet.getParameter("patternFinderAlgorithm"); std::string trackFitterAlgorithm = parameterSet.getParameter("trackFinderAlgorithm"); - std::vector listOfAllPlanes_; // pattern algorithm selector if (patternFinderAlgorithm == "RPixRoadFinder") { @@ -100,8 +99,9 @@ CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterS << "Pattern finder algorithm" << patternFinderAlgorithm << " does not exist"; } + std::vector listOfAllPlanes; for (uint32_t i = 0; i < numberOfPlanesPerPot_; ++i) { - listOfAllPlanes_.push_back(i); + listOfAllPlanes.push_back(i); } //tracking algorithm selector @@ -111,7 +111,7 @@ CTPPSPixelLocalTrackProducer::CTPPSPixelLocalTrackProducer(const edm::ParameterS throw cms::Exception("CTPPSPixelLocalTrackProducer") << "Tracking fitter algorithm" << trackFitterAlgorithm << " does not exist"; } - trackFinder_->setListOfPlanes(listOfAllPlanes_); + trackFinder_->setListOfPlanes(listOfAllPlanes); trackFinder_->initialize(); produces>(); }