From 3df5f8868c23ade9dfeefc1e303ae7b1c1104396 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 18:57:30 -0500 Subject: [PATCH 01/29] clang-diagnostic-missing-braces: incomplete initializers --- JugReco/src/components/FarForwardParticles.cpp | 4 ++-- JugReco/src/components/FarForwardParticlesOMD.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/JugReco/src/components/FarForwardParticles.cpp b/JugReco/src/components/FarForwardParticles.cpp index f81641cb..83ac4a4b 100644 --- a/JugReco/src/components/FarForwardParticles.cpp +++ b/JugReco/src/components/FarForwardParticles.cpp @@ -52,8 +52,8 @@ class FarForwardParticles : public GaudiAlgorithm { const double aXRP[2][2] = {{2.102403743, 29.11067626}, {0.186640381, 0.192604619}}; const double aYRP[2][2] = {{0.0000159900, 3.94082098}, {0.0000079946, -0.1402995}}; - double aXRPinv[2][2] = {0.0, 0.0}; - double aYRPinv[2][2] = {0.0, 0.0}; + double aXRPinv[2][2] = {{0.0, 0.0}, {0.0, 0.0}}; + double aYRPinv[2][2] = {{0.0, 0.0}, {0.0, 0.0}}; public: FarForwardParticles(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { diff --git a/JugReco/src/components/FarForwardParticlesOMD.cpp b/JugReco/src/components/FarForwardParticlesOMD.cpp index 132cd4b9..5026aa44 100644 --- a/JugReco/src/components/FarForwardParticlesOMD.cpp +++ b/JugReco/src/components/FarForwardParticlesOMD.cpp @@ -34,8 +34,8 @@ class FarForwardParticlesOMD : public GaudiAlgorithm { const double aXOMD[2][2] = {{1.6229248, 12.9519653}, {-2.86056525, 0.1830292}}; const double aYOMD[2][2] = {{0.0000185, -28.599739}, {0.00000925, -2.8795791}}; - double aXOMDinv[2][2] = {0.0, 0.0}; - double aYOMDinv[2][2] = {0.0, 0.0}; + double aXOMDinv[2][2] = {{0.0, 0.0}, {0.0, 0.0}}; + double aYOMDinv[2][2] = {{0.0, 0.0}, {0.0, 0.0}}; public: FarForwardParticlesOMD(const std::string& name, ISvcLocator* svcLoc) -- GitLab From ab81e00f835c1810d959ef3c58f91865280f52b3 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 19:03:23 -0500 Subject: [PATCH 02/29] readability-isolate-declaration: not on single line --- JugReco/src/components/FarForwardParticles.cpp | 10 ++++------ JugReco/src/components/FarForwardParticlesOMD.cpp | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/JugReco/src/components/FarForwardParticles.cpp b/JugReco/src/components/FarForwardParticles.cpp index 83ac4a4b..23fda83d 100644 --- a/JugReco/src/components/FarForwardParticles.cpp +++ b/JugReco/src/components/FarForwardParticles.cpp @@ -223,12 +223,10 @@ public: return StatusCode::SUCCESS; } - double Xrp[2], Xip[2] = {0.0, 0.0}; - Xrp[0] = XL[1]; - Xrp[1] = (1000 * (XL[1] - XL[0]) / (base)) - local_x_slope_offset; //- _SX0RP_; - double Yrp[2], Yip[2] = {0.0, 0.0}; - Yrp[0] = YL[1]; - Yrp[1] = (1000 * (YL[1] - YL[0]) / (base)) - local_y_slope_offset; //- _SY0RP_; + double Xip[2] = {0.0, 0.0}; + double Xrp[2] = {XL[1], (1000 * (XL[1] - XL[0]) / (base)) - local_x_slope_offset}; //- _SX0RP_; + double Yip[2] = {0.0, 0.0}; + double Yrp[2] = {YL[1], (1000 * (YL[1] - YL[0]) / (base)) - local_y_slope_offset}; //- _SY0RP_; // use the hit information and calculated slope at the RP + the transfer matrix inverse to calculate the // Polar Angle and deltaP at the IP diff --git a/JugReco/src/components/FarForwardParticlesOMD.cpp b/JugReco/src/components/FarForwardParticlesOMD.cpp index 5026aa44..fbfe9c5e 100644 --- a/JugReco/src/components/FarForwardParticlesOMD.cpp +++ b/JugReco/src/components/FarForwardParticlesOMD.cpp @@ -148,7 +148,8 @@ public: } // convert polar angles to radians - double rsx = Xip[1] / 1000., rsy = Yip[1] / 1000.; + double rsx = Xip[1] / 1000.; + double rsy = Yip[1] / 1000.; // calculate momentum magnitude from measured deltaP – using thin lens optics. double p = nomMomentum * (1 + 0.01 * Xip[0]); -- GitLab From 0c67015d170aa797326505fc350e04b6a0ca4905 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 19:10:28 -0500 Subject: [PATCH 03/29] readability-container-size-empty: prefer empty() over size()>0 --- JugBase/src/ACTSLogger.cpp | 2 +- JugBase/src/KeepDropSwitch.cpp | 2 +- JugBase/src/PodioDataSvc.cpp | 8 ++++---- JugDigi/src/components/CalorimeterHitDigi.cpp | 4 ++-- JugReco/src/components/CalorimeterHitReco.cpp | 4 ++-- JugReco/src/components/FarForwardParticles.cpp | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/JugBase/src/ACTSLogger.cpp b/JugBase/src/ACTSLogger.cpp index 77090f46..7e84dc61 100644 --- a/JugBase/src/ACTSLogger.cpp +++ b/JugBase/src/ACTSLogger.cpp @@ -4,7 +4,7 @@ #include "GaudiKernel/MsgStream.h" namespace Acts { -std::unique_ptr getDefaultLogger(const std::string& name, const Logging::Level& lvl, std::ostream*) { +std::unique_ptr getDefaultLogger(const std::string& name, const Logging::Level& lvl, std::ostream* /* unused */) { using namespace Logging; //ServiceHandle* msgSvc = new ServiceHandle("MessageSvc", name); ServiceHandle msgSvc("MessageSvc", name); diff --git a/JugBase/src/KeepDropSwitch.cpp b/JugBase/src/KeepDropSwitch.cpp index 7a1fe382..7fc793f6 100644 --- a/JugBase/src/KeepDropSwitch.cpp +++ b/JugBase/src/KeepDropSwitch.cpp @@ -40,7 +40,7 @@ std::vector split(const std::string& s, char delim) { std::stringstream ss(s); std::string item; while (std::getline(ss, item, delim)) { - if (item != "") elems.push_back(item); + if (!item.empty()) elems.push_back(item); } return elems; } diff --git a/JugBase/src/PodioDataSvc.cpp b/JugBase/src/PodioDataSvc.cpp index 1c1f3ccd..dd5b74d1 100644 --- a/JugBase/src/PodioDataSvc.cpp +++ b/JugBase/src/PodioDataSvc.cpp @@ -16,12 +16,12 @@ StatusCode PodioDataSvc::initialize() { m_cnvSvc = svc_loc->service("EventPersistencySvc"); status = setDataLoader(m_cnvSvc); - if (m_filename != "") { + if (!m_filename.empty()) { m_filenames.push_back(m_filename); } - if (m_filenames.size() > 0) { - if (m_filenames[0] != "") { + if (!m_filenames.empty()) { + if (!m_filenames[0].empty()) { m_reader.openFiles(m_filenames); m_eventMax = m_reader.getEntries(); m_provider.setReader(&m_reader); @@ -97,7 +97,7 @@ PodioDataSvc::PodioDataSvc(const std::string& name, ISvcLocator* svc) /// Standard Destructor PodioDataSvc::~PodioDataSvc() {} -StatusCode PodioDataSvc::readCollection(const std::string& collName, int collectionID) { +StatusCode PodioDataSvc::readCollection(const std::string& collectionName, int collectionID) { podio::CollectionBase* collection(nullptr); m_provider.get(collectionID, collection); auto wrapper = new DataWrapper; diff --git a/JugDigi/src/components/CalorimeterHitDigi.cpp b/JugDigi/src/components/CalorimeterHitDigi.cpp index 7706c37a..b66b1c7f 100644 --- a/JugDigi/src/components/CalorimeterHitDigi.cpp +++ b/JugDigi/src/components/CalorimeterHitDigi.cpp @@ -110,7 +110,7 @@ namespace Jug::Digi { stepTDC = ns / m_resolutionTDC.value(); // need signal sum - if (u_fields.value().size()) { + if (!u_fields.value().empty()) { m_geoSvc = service(m_geoSvcName); // sanity checks if (!m_geoSvc) { @@ -152,7 +152,7 @@ namespace Jug::Digi { StatusCode execute() override { - if (u_fields.value().size()) { + if (!u_fields.value().empty()) { signal_sum_digi(); } else { single_hits_digi(); diff --git a/JugReco/src/components/CalorimeterHitReco.cpp b/JugReco/src/components/CalorimeterHitReco.cpp index 82b16fa2..84d806ca 100644 --- a/JugReco/src/components/CalorimeterHitReco.cpp +++ b/JugReco/src/components/CalorimeterHitReco.cpp @@ -128,7 +128,7 @@ public: } // local detector name has higher priority - if (m_localDetElement.value().size()) { + if (!m_localDetElement.value().empty()) { try { local = m_geoSvc->detector()->detector(m_localDetElement.value()); info() << "Local coordinate system from DetElement " << m_localDetElement.value() << endmsg; @@ -174,7 +174,7 @@ public: const float time = rh.getTimeStamp() / stepTDC; const auto cellID = rh.getCellID(); const int lid = id_dec && !m_layerField.value().empty() ? static_cast(id_dec->get(cellID, layer_idx)) : -1; - const int sid = id_dec && m_sectorField.value().size() ? static_cast(id_dec->get(cellID, sector_idx)) : -1; + const int sid = id_dec && !m_sectorField.value().empty() ? static_cast(id_dec->get(cellID, sector_idx)) : -1; // global positions const auto gpos = converter->position(cellID); // local positions diff --git a/JugReco/src/components/FarForwardParticles.cpp b/JugReco/src/components/FarForwardParticles.cpp index 23fda83d..4b91c829 100644 --- a/JugReco/src/components/FarForwardParticles.cpp +++ b/JugReco/src/components/FarForwardParticles.cpp @@ -87,11 +87,11 @@ public: auto id_spec = m_geoSvc->detector()->readout(m_readout).idSpec(); try { id_dec = id_spec.decoder(); - if (m_sectorField.value().size()) { + if (!m_sectorField.value().empty()) { sector_idx = id_dec->index(m_sectorField); info() << "Find sector field " << m_sectorField.value() << ", index = " << sector_idx << endmsg; } - if (m_layerField.value().size()) { + if (!m_layerField.value().empty()) { layer_idx = id_dec->index(m_layerField); info() << "Find layer field " << m_layerField.value() << ", index = " << sector_idx << endmsg; } @@ -101,7 +101,7 @@ public: } // local detector name has higher priority - if (m_localDetElement.value().size()) { + if (!m_localDetElement.value().empty()) { try { local = m_geoSvc->detector()->detector(m_localDetElement.value()); info() << "Local coordinate system from DetElement " << m_localDetElement.value() << endmsg; -- GitLab From 791ace8041fd2f2128f4fe60644462e37bbaa3e9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 19:13:00 -0500 Subject: [PATCH 04/29] readability-delete-null-pointer: delete nullptr has no effect --- JugBase/src/PodioDataSvc.cpp | 4 +--- JugDigi/src/components/SimTrackerHitsCollector.cpp | 2 +- JugReco/src/components/ParticleCollector.cpp | 4 +--- JugReco/src/components/TrackingHitsCollector2.cpp | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/JugBase/src/PodioDataSvc.cpp b/JugBase/src/PodioDataSvc.cpp index dd5b74d1..b07cd35b 100644 --- a/JugBase/src/PodioDataSvc.cpp +++ b/JugBase/src/PodioDataSvc.cpp @@ -81,9 +81,7 @@ void PodioDataSvc::endOfRead() { } void PodioDataSvc::setCollectionIDs(podio::CollectionIDTable* collectionIds) { - if (m_collectionIDs != nullptr) { - delete m_collectionIDs; - } + delete m_collectionIDs; m_collectionIDs = collectionIds; } diff --git a/JugDigi/src/components/SimTrackerHitsCollector.cpp b/JugDigi/src/components/SimTrackerHitsCollector.cpp index ba3fe456..0e1ca36e 100644 --- a/JugDigi/src/components/SimTrackerHitsCollector.cpp +++ b/JugDigi/src/components/SimTrackerHitsCollector.cpp @@ -33,7 +33,7 @@ namespace Jug::Digi { } ~SimTrackerHitsCollector() { for (auto col : m_hitCollections) { - if (col) { delete col; } + delete col; } } diff --git a/JugReco/src/components/ParticleCollector.cpp b/JugReco/src/components/ParticleCollector.cpp index c72e0270..0f179ea9 100644 --- a/JugReco/src/components/ParticleCollector.cpp +++ b/JugReco/src/components/ParticleCollector.cpp @@ -32,9 +32,7 @@ public: } ~ParticleCollector() { for (auto col : m_particleCollections) { - if (col) { - delete col; - } + delete col; } } diff --git a/JugReco/src/components/TrackingHitsCollector2.cpp b/JugReco/src/components/TrackingHitsCollector2.cpp index f1259e2b..fa599d1c 100644 --- a/JugReco/src/components/TrackingHitsCollector2.cpp +++ b/JugReco/src/components/TrackingHitsCollector2.cpp @@ -33,7 +33,7 @@ namespace Jug::Reco { } ~TrackingHitsCollector2() { for (auto col : m_hitCollections) { - if (col) { delete col; } + delete col; } } -- GitLab From 9e40c96e817a70c61e40e35c0ebddde341b8bb2d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 19:24:05 -0500 Subject: [PATCH 05/29] modernize-use-equals-default: constructor() = default; --- JugBase/src/PodioDataSvc.cpp | 8 +++---- JugBase/src/components/EICDataSvc.cpp | 2 +- JugBase/src/components/ParticleSvc.cpp | 2 +- JugBase/src/components/ReadTestConsumer.cxx | 2 +- JugPID/src/components/FuzzyKClusters.cpp | 24 ++++----------------- JugPID/src/components/FuzzyKClusters.h | 4 ++-- JugTrack/src/components/TestACTSLogger.cpp | 2 +- 7 files changed, 14 insertions(+), 30 deletions(-) diff --git a/JugBase/src/PodioDataSvc.cpp b/JugBase/src/PodioDataSvc.cpp index b07cd35b..8a60ccb9 100644 --- a/JugBase/src/PodioDataSvc.cpp +++ b/JugBase/src/PodioDataSvc.cpp @@ -93,18 +93,18 @@ PodioDataSvc::PodioDataSvc(const std::string& name, ISvcLocator* svc) } /// Standard Destructor -PodioDataSvc::~PodioDataSvc() {} +PodioDataSvc::~PodioDataSvc() = default; StatusCode PodioDataSvc::readCollection(const std::string& collectionName, int collectionID) { podio::CollectionBase* collection(nullptr); m_provider.get(collectionID, collection); auto wrapper = new DataWrapper; - const int id = m_collectionIDs->add(collName); + const int id = m_collectionIDs->add(collectionName); collection->setID(id); collection->prepareAfterRead(); wrapper->setData(collection); - m_readCollections.emplace_back(std::make_pair(collName, collection)); - return DataSvc::registerObject("/Event", "/" + collName, wrapper); + m_readCollections.emplace_back(std::make_pair(collectionName, collection)); + return DataSvc::registerObject("/Event", "/" + collectionName, wrapper); } StatusCode PodioDataSvc::registerObject(std::string_view parentPath, std::string_view fullPath, DataObject* pObject) { diff --git a/JugBase/src/components/EICDataSvc.cpp b/JugBase/src/components/EICDataSvc.cpp index 2bb7629a..6ea1ed8b 100644 --- a/JugBase/src/components/EICDataSvc.cpp +++ b/JugBase/src/components/EICDataSvc.cpp @@ -12,4 +12,4 @@ EICDataSvc::EICDataSvc(const std::string& name, ISvcLocator* svc) : PodioDataSvc } /// Standard Destructor -EICDataSvc::~EICDataSvc() {} +EICDataSvc::~EICDataSvc() = default; diff --git a/JugBase/src/components/ParticleSvc.cpp b/JugBase/src/components/ParticleSvc.cpp index 9ffc3897..b084b8ff 100644 --- a/JugBase/src/components/ParticleSvc.cpp +++ b/JugBase/src/components/ParticleSvc.cpp @@ -249,7 +249,7 @@ const IParticleSvc::ParticleMap kParticleMap = { ParticleSvc::ParticleSvc(const std::string& name, ISvcLocator* svc) : base_class(name, svc), m_particleMap{kParticleMap} {} -ParticleSvc::~ParticleSvc() {} +ParticleSvc::~ParticleSvc() = default; StatusCode ParticleSvc::initialize() { diff --git a/JugBase/src/components/ReadTestConsumer.cxx b/JugBase/src/components/ReadTestConsumer.cxx index 4019d6bd..019a0529 100644 --- a/JugBase/src/components/ReadTestConsumer.cxx +++ b/JugBase/src/components/ReadTestConsumer.cxx @@ -12,7 +12,7 @@ public: declareProperty("genParticles", m_genParticles, "mc particles to read"); } - ~ReadTestConsumer(){}; + ~ReadTestConsumer() = default; StatusCode initialize() { warning() << "This is a deprecated test algorithm" << endmsg; diff --git a/JugPID/src/components/FuzzyKClusters.cpp b/JugPID/src/components/FuzzyKClusters.cpp index 87407a08..080e8031 100644 --- a/JugPID/src/components/FuzzyKClusters.cpp +++ b/JugPID/src/components/FuzzyKClusters.cpp @@ -19,16 +19,8 @@ using namespace Eigen; // KMeans Algorithm // ================================================================================================= -KMeans::KMeans() -: n_iters(0), variance(0.) -{ - // place holder -} - -KMeans::~KMeans() -{ - // place holder -} +KMeans::KMeans() = default; +KMeans::~KMeans() = default; MatrixXd KMeans::Fit(const MatrixXd &data, int k, double q, double epsilon, int max_iters) { @@ -115,16 +107,8 @@ void KMeans::FormClusters(MatrixXd &clusters, const MatrixXd &data, double q) // vol. 16, no. 8, pp. 855-861, Aug. 1994, doi: 10.1109/34.308484. // ================================================================================================= -KRings::KRings() -: KMeans() -{ - // place holder -} - -KRings::~KRings() -{ - // place holder -} +KRings::KRings() = default; +KRings::~KRings() = default; MatrixXd KRings::Fit(const MatrixXd &data, int k, double q, double epsilon, int max_iters) { diff --git a/JugPID/src/components/FuzzyKClusters.h b/JugPID/src/components/FuzzyKClusters.h index 97d4284e..c8a876ae 100644 --- a/JugPID/src/components/FuzzyKClusters.h +++ b/JugPID/src/components/FuzzyKClusters.h @@ -32,8 +32,8 @@ namespace fkc { virtual void FormClusters(Eigen::MatrixXd& clusters, const Eigen::MatrixXd& data, double q); protected: - int n_iters; - double variance; + int n_iters{0}; + double variance{0}; Eigen::MatrixXd dists, mems; }; diff --git a/JugTrack/src/components/TestACTSLogger.cpp b/JugTrack/src/components/TestACTSLogger.cpp index 78cffdaa..0d7e83d6 100644 --- a/JugTrack/src/components/TestACTSLogger.cpp +++ b/JugTrack/src/components/TestACTSLogger.cpp @@ -14,7 +14,7 @@ DECLARE_COMPONENT(TestACTSLogger) TestACTSLogger::TestACTSLogger(const std::string& aName, ISvcLocator* aSvcLoc) : GaudiAlgorithm(aName, aSvcLoc) {} -TestACTSLogger::~TestACTSLogger() {} +TestACTSLogger::~TestACTSLogger() = default; StatusCode TestACTSLogger::initialize() { if (GaudiAlgorithm::initialize().isFailure()) { -- GitLab From 0877bdb0af6363c64ab0b0c4ebc331b8624482a9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 19:43:20 -0500 Subject: [PATCH 06/29] modernize-concat-nested-namespaces --- JugBase/src/Utilities/Helpers.cpp | 8 ++------ JugBase/src/components/InputCopier.cpp | 6 ++---- JugReco/src/components/TrackerHitReconstruction.cpp | 6 ++---- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/JugBase/src/Utilities/Helpers.cpp b/JugBase/src/Utilities/Helpers.cpp index a26d4206..2887c803 100644 --- a/JugBase/src/Utilities/Helpers.cpp +++ b/JugBase/src/Utilities/Helpers.cpp @@ -8,9 +8,7 @@ #include "JugBase/Utilities/Helpers.hpp" -namespace Jug { - -namespace PlotHelpers { +namespace Jug::PlotHelpers { TH1F* bookHisto(const char* histName, const char* histTitle, const Binning& varBinning) { TH1F* hist = new TH1F(histName, histTitle, varBinning.nBins, varBinning.min, @@ -98,6 +96,4 @@ void fillProf(TProfile* profile, float xValue, float yValue, float weight) { profile->Fill(xValue, yValue, weight); } -} // namespace PlotHelpers - -} // namespace Jug +} // namespace Jug::PlotHelpers diff --git a/JugBase/src/components/InputCopier.cpp b/JugBase/src/components/InputCopier.cpp index 5184cb30..d9242512 100644 --- a/JugBase/src/components/InputCopier.cpp +++ b/JugBase/src/components/InputCopier.cpp @@ -15,8 +15,7 @@ #include "edm4hep/SimTrackerHitCollection.h" -namespace Jug { - namespace Base { +namespace Jug::Base { /** Need to fix a bug. * @@ -70,6 +69,5 @@ namespace Jug { // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) DECLARE_COMPONENT(MCCopier) - } // namespace Examples -} // namespace Gaudi +} // namespace Jug::Base diff --git a/JugReco/src/components/TrackerHitReconstruction.cpp b/JugReco/src/components/TrackerHitReconstruction.cpp index 97bb08e8..8489635a 100644 --- a/JugReco/src/components/TrackerHitReconstruction.cpp +++ b/JugReco/src/components/TrackerHitReconstruction.cpp @@ -34,8 +34,7 @@ inline double get_variance(const double pixel_size) { } } // namespace -namespace Jug { -namespace Reco { +namespace Jug::Reco { /** Tracker hit reconstruction. * @@ -120,6 +119,5 @@ namespace Reco { // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) DECLARE_COMPONENT(TrackerHitReconstruction) -} // namespace Reco -} // namespace Jug +} // namespace Jug::Reco -- GitLab From 9ec13ba7383cbe0af522afa3c820df50979f6589 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 20:36:59 -0500 Subject: [PATCH 07/29] readability-qualified-auto: const auto* const etc --- JugBase/src/PodioDataSvc.cpp | 4 +-- JugBase/src/components/GeoSvc.cpp | 6 ++-- JugBase/src/components/InputCopier.cpp | 2 +- JugBase/src/components/PodioInput.cpp | 2 +- JugBase/src/components/PodioOutput.cpp | 28 +++++++++---------- JugDigi/src/components/CalorimeterHitDigi.cpp | 8 +++--- .../src/components/PhotoMultiplierDigi.cpp | 2 +- JugDigi/src/components/SiliconTrackerDigi.cpp | 4 +-- .../components/SimTrackerHitsCollector.cpp | 4 +-- JugFast/src/components/MC2SmearedParticle.cpp | 2 +- .../components/CalorimeterIslandCluster.cpp | 4 +-- .../components/ImagingPixelDataCombiner.cpp | 12 ++++---- JugReco/src/components/ParticleCollector.cpp | 4 +-- .../components/TrackerHitReconstruction.cpp | 4 +-- .../src/components/TrackingHitsCollector.cpp | 2 +- .../src/components/TrackingHitsCollector2.cpp | 4 +-- JugTrack/src/components/CKFTracking.cpp | 8 +++--- .../components/ConformalXYPeakProtoTracks.cpp | 2 +- JugTrack/src/components/GenFitTrackFitter.cpp | 6 ++-- .../src/components/ParticlesFromTrackFit.cpp | 8 +++--- .../src/components/ProtoTrackMatching.cpp | 8 +++--- .../components/SingleTrackSourceLinker.cpp | 10 +++---- .../src/components/TrackFindingAlgorithm.cpp | 8 +++--- .../src/components/TrackFittingAlgorithm.cpp | 10 +++---- .../src/components/TrackParamClusterInit.cpp | 4 +-- .../TrackParamImagingClusterInit.cpp | 4 +-- .../src/components/TrackParamTruthInit.cpp | 4 +-- .../TrackParamVertexClusterInit.cpp | 6 ++-- JugTrack/src/components/TruthTrackSeeding.cpp | 4 +-- 29 files changed, 87 insertions(+), 87 deletions(-) diff --git a/JugBase/src/PodioDataSvc.cpp b/JugBase/src/PodioDataSvc.cpp index 8a60ccb9..b16082d9 100644 --- a/JugBase/src/PodioDataSvc.cpp +++ b/JugBase/src/PodioDataSvc.cpp @@ -25,7 +25,7 @@ StatusCode PodioDataSvc::initialize() { m_reader.openFiles(m_filenames); m_eventMax = m_reader.getEntries(); m_provider.setReader(&m_reader); - auto idTable = m_reader.getCollectionIDTable(); + auto* idTable = m_reader.getCollectionIDTable(); setCollectionIDs(idTable); if (m_1stEvtEntry != 0) { @@ -98,7 +98,7 @@ PodioDataSvc::~PodioDataSvc() = default; StatusCode PodioDataSvc::readCollection(const std::string& collectionName, int collectionID) { podio::CollectionBase* collection(nullptr); m_provider.get(collectionID, collection); - auto wrapper = new DataWrapper; + auto* wrapper = new DataWrapper; const int id = m_collectionIDs->add(collectionName); collection->setID(id); collection->prepareAfterRead(); diff --git a/JugBase/src/components/GeoSvc.cpp b/JugBase/src/components/GeoSvc.cpp index 44012bd2..d4cd14fb 100644 --- a/JugBase/src/components/GeoSvc.cpp +++ b/JugBase/src/components/GeoSvc.cpp @@ -116,7 +116,7 @@ StatusCode GeoSvc::initialize() { // create a list of all surfaces in the detector: dd4hep::rec::SurfaceManager surfMan( *m_dd4hepGeo ) ; debug() << " surface manager " << endmsg; - const auto sM = surfMan.map("tracker") ; + const auto* const sM = surfMan.map("tracker") ; if (sM != nullptr) { debug() << " surface map size: " << sM->size() << endmsg; // setup dd4hep surface map @@ -180,7 +180,7 @@ StatusCode GeoSvc::initialize() { info() << "no surface??? " << endmsg; return; } - auto det_element = + const auto* det_element = dynamic_cast(surface->associatedDetectorElement()); if (!det_element) { @@ -190,7 +190,7 @@ StatusCode GeoSvc::initialize() { // more verbose output is lower enum value debug() << " det_element->identifier() " << det_element->identifier() << endmsg; auto volman = m_dd4hepGeo->volumeManager(); - auto vol_ctx = volman.lookupContext(det_element->identifier()); + auto* vol_ctx = volman.lookupContext(det_element->identifier()); auto vol_id = vol_ctx->identifier; if (msgLevel() <= MSG::DEBUG) { diff --git a/JugBase/src/components/InputCopier.cpp b/JugBase/src/components/InputCopier.cpp index d9242512..580b95d2 100644 --- a/JugBase/src/components/InputCopier.cpp +++ b/JugBase/src/components/InputCopier.cpp @@ -46,7 +46,7 @@ namespace Jug::Base { // input collection const T_IN* simhits = m_inputHitCollection.get(); // output collection - auto out_parts = m_outputHitCollection.createAndPut(); + auto* out_parts = m_outputHitCollection.createAndPut(); for (const auto& ahit : *simhits) { out_parts->push_back(ahit.clone()); } diff --git a/JugBase/src/components/PodioInput.cpp b/JugBase/src/components/PodioInput.cpp index 71aa3b94..b55603ab 100644 --- a/JugBase/src/components/PodioInput.cpp +++ b/JugBase/src/components/PodioInput.cpp @@ -22,7 +22,7 @@ StatusCode PodioInput::initialize() { return StatusCode::FAILURE; } - auto idTable = m_podioDataSvc->getCollectionIDs(); + auto* idTable = m_podioDataSvc->getCollectionIDs(); for (auto& name : m_collectionNames) { debug() << "Finding collection " << name << " in collection registry." << endmsg; if (!idTable->present(name)) { diff --git a/JugBase/src/components/PodioOutput.cpp b/JugBase/src/components/PodioOutput.cpp index 5467c8fd..4c72507a 100644 --- a/JugBase/src/components/PodioOutput.cpp +++ b/JugBase/src/components/PodioOutput.cpp @@ -38,24 +38,24 @@ StatusCode PodioOutput::initialize() { } void PodioOutput::resetBranches(const std::vector>& collections) { - for (auto& [collName, collBuffers] : collections) { + for (const auto& [collName, collBuffers] : collections) { auto buffers = collBuffers->getBuffers(); - auto data = buffers.data; - auto references = buffers.references; - auto vecmembers = buffers.vectorMembers; + auto* data = buffers.data; + auto* references = buffers.references; + auto* vecmembers = buffers.vectorMembers; if (m_switch.isOn(collName)) { // Reconnect branches and collections m_datatree->SetBranchAddress(collName.c_str(), data); - auto colls = references; + auto* colls = references; if (colls) { for (size_t j = 0; j < colls->size(); ++j) { const auto brName = podio::root_utils::refBranch(collName, j); - auto l_branch = m_datatree->GetBranch(brName.c_str()); + auto* l_branch = m_datatree->GetBranch(brName.c_str()); l_branch->SetAddress(&(*colls)[j]); } } - auto colls_v = vecmembers; + auto* colls_v = vecmembers; if (colls_v) { int j = 0; for (auto& [dataType, add] : (*colls_v)) { @@ -71,14 +71,14 @@ void PodioOutput::resetBranches(const std::vector>& collections) { // collectionID, collection type, subset collection - std::vector>* collectionInfo = new std::vector>(); + auto* collectionInfo = new std::vector>(); collectionInfo->reserve(collections.size()); - for (auto& [collName, collBuffers] : collections) { + for (const auto& [collName, collBuffers] : collections) { auto buffers = collBuffers->getBuffers(); - auto data = buffers.data; - auto references = buffers.references; - auto vecmembers = buffers.vectorMembers; + auto* data = buffers.data; + auto* references = buffers.references; + auto* vecmembers = buffers.vectorMembers; const std::string className = collBuffers->getValueTypeName(); const std::string collClassName = "vector<" + className + "Data>"; @@ -88,7 +88,7 @@ void PodioOutput::createBranches(const std::vectorBranch(collName.c_str(), collClassName.c_str(), data); // Create branches for collections holding relations - if (auto refColls = references) { + if (auto* refColls = references) { int j = 0; for (auto& c : (*refColls)) { const auto brName = podio::root_utils::refBranch(collName, j); @@ -97,7 +97,7 @@ void PodioOutput::createBranches(const std::vector"; diff --git a/JugDigi/src/components/CalorimeterHitDigi.cpp b/JugDigi/src/components/CalorimeterHitDigi.cpp index b66b1c7f..934eb207 100644 --- a/JugDigi/src/components/CalorimeterHitDigi.cpp +++ b/JugDigi/src/components/CalorimeterHitDigi.cpp @@ -163,9 +163,9 @@ namespace Jug::Digi { private: void single_hits_digi() { // input collections - const auto simhits = m_inputHitCollection.get(); + const auto* const simhits = m_inputHitCollection.get(); // Create output collections - auto rawhits = m_outputHitCollection.createAndPut(); + auto* rawhits = m_outputHitCollection.createAndPut(); for (const auto& ahit : *simhits) { // Note: juggler internal unit of energy is GeV const double eDep = ahit.getEnergy(); @@ -195,8 +195,8 @@ namespace Jug::Digi { } void signal_sum_digi() { - const auto simhits = m_inputHitCollection.get(); - auto rawhits = m_outputHitCollection.createAndPut(); + const auto* const simhits = m_inputHitCollection.get(); + auto* rawhits = m_outputHitCollection.createAndPut(); // find the hits that belong to the same group (for merging) std::unordered_map> merge_map; diff --git a/JugDigi/src/components/PhotoMultiplierDigi.cpp b/JugDigi/src/components/PhotoMultiplierDigi.cpp index 4dae18a1..18f8ef1f 100644 --- a/JugDigi/src/components/PhotoMultiplierDigi.cpp +++ b/JugDigi/src/components/PhotoMultiplierDigi.cpp @@ -189,7 +189,7 @@ private: bool qe_pass(double ev, double rand) const { - auto &qeff = u_quantumEfficiency.value(); + const auto &qeff = u_quantumEfficiency.value(); auto it = interval_search(qeff.begin(), qeff.end(), ev, [] (const std::pair &vals, double val) { return vals.first - val; diff --git a/JugDigi/src/components/SiliconTrackerDigi.cpp b/JugDigi/src/components/SiliconTrackerDigi.cpp index 9522c910..209790ac 100644 --- a/JugDigi/src/components/SiliconTrackerDigi.cpp +++ b/JugDigi/src/components/SiliconTrackerDigi.cpp @@ -50,9 +50,9 @@ public: } StatusCode execute() override { // input collection - auto simhits = m_inputHitCollection.get(); + const auto* const simhits = m_inputHitCollection.get(); // Create output collections - auto rawhits = m_outputHitCollection.createAndPut(); + auto* rawhits = m_outputHitCollection.createAndPut(); // eicd::RawTrackerHitCollection* rawHitCollection = new eicd::RawTrackerHitCollection(); std::map cell_hit_map; for (const auto& ahit : *simhits) { diff --git a/JugDigi/src/components/SimTrackerHitsCollector.cpp b/JugDigi/src/components/SimTrackerHitsCollector.cpp index 0e1ca36e..0f793abc 100644 --- a/JugDigi/src/components/SimTrackerHitsCollector.cpp +++ b/JugDigi/src/components/SimTrackerHitsCollector.cpp @@ -32,7 +32,7 @@ namespace Jug::Digi { declareProperty("outputSimTrackerHits", m_outputSimTrackerHits, "output hits combined into single collection"); } ~SimTrackerHitsCollector() { - for (auto col : m_hitCollections) { + for (auto* col : m_hitCollections) { delete col; } } @@ -49,7 +49,7 @@ namespace Jug::Digi { StatusCode execute() override { - auto outputHits = m_outputSimTrackerHits.createAndPut(); + auto* outputHits = m_outputSimTrackerHits.createAndPut(); if (msgLevel(MSG::DEBUG)) { debug() << "execute collector" << endmsg; } diff --git a/JugFast/src/components/MC2SmearedParticle.cpp b/JugFast/src/components/MC2SmearedParticle.cpp index eb315958..f45209be 100644 --- a/JugFast/src/components/MC2SmearedParticle.cpp +++ b/JugFast/src/components/MC2SmearedParticle.cpp @@ -39,7 +39,7 @@ public: } StatusCode execute() override { // input collection - auto parts = m_inputMCParticles.get(); + const auto* const parts = m_inputMCParticles.get(); // output collection auto& out_parts = *(m_outputParticles.createAndPut()); for (const auto& p : *parts) { diff --git a/JugReco/src/components/CalorimeterIslandCluster.cpp b/JugReco/src/components/CalorimeterIslandCluster.cpp index f6ef3e49..5ef2f349 100644 --- a/JugReco/src/components/CalorimeterIslandCluster.cpp +++ b/JugReco/src/components/CalorimeterIslandCluster.cpp @@ -294,14 +294,14 @@ private: return maxima; } - for (auto& [idx, hit] : group) { + for (const auto& [idx, hit] : group) { // not a qualified center if (hit.getEnergy() < minClusterCenterEdep) { continue; } bool maximum = true; - for (auto& [idx2, hit2] : group) { + for (const auto& [idx2, hit2] : group) { if (hit == hit2) { continue; } diff --git a/JugReco/src/components/ImagingPixelDataCombiner.cpp b/JugReco/src/components/ImagingPixelDataCombiner.cpp index 42961d5a..8450bf0e 100644 --- a/JugReco/src/components/ImagingPixelDataCombiner.cpp +++ b/JugReco/src/components/ImagingPixelDataCombiner.cpp @@ -74,16 +74,16 @@ public: StatusCode execute() override { // input collections - const auto hits1 = m_inputHits1.get(); - const auto hits2 = m_inputHits2.get(); + const auto* const hits1 = m_inputHits1.get(); + const auto* const hits2 = m_inputHits2.get(); std::vector inputs{hits1, hits2}; // Create output collections - auto mhits = m_outputHits.createAndPut(); + auto* mhits = m_outputHits.createAndPut(); // concatenate if (m_rule.value() == supported_rules[0]) { for (int i = 0; i < (int)inputs.size(); ++i) { - auto coll = inputs[i]; + const auto* const coll = inputs[i]; for (auto hit : *coll) { eicd::CalorimeterHit h2{ hit.getCellID(), hit.getEnergy(), hit.getEnergyError(), hit.getTime(), @@ -108,8 +108,8 @@ public: } // merge hits - int& i = indices[curr_coll]; - auto coll = inputs[curr_coll]; + int& i = indices[curr_coll]; + const auto* const coll = inputs[curr_coll]; // reach this collection's end if (i >= (int)coll->size()) { diff --git a/JugReco/src/components/ParticleCollector.cpp b/JugReco/src/components/ParticleCollector.cpp index 0f179ea9..39d84e69 100644 --- a/JugReco/src/components/ParticleCollector.cpp +++ b/JugReco/src/components/ParticleCollector.cpp @@ -31,7 +31,7 @@ public: declareProperty("outputParticles", m_outputParticles, "output particles combined into single collection"); } ~ParticleCollector() { - for (auto col : m_particleCollections) { + for (auto* col : m_particleCollections) { delete col; } } @@ -49,7 +49,7 @@ public: } StatusCode execute() override { - auto output = m_outputParticles.createAndPut(); + auto* output = m_outputParticles.createAndPut(); if (msgLevel(MSG::DEBUG)) { debug() << "execute collector" << endmsg; } diff --git a/JugReco/src/components/TrackerHitReconstruction.cpp b/JugReco/src/components/TrackerHitReconstruction.cpp index 8489635a..c9791641 100644 --- a/JugReco/src/components/TrackerHitReconstruction.cpp +++ b/JugReco/src/components/TrackerHitReconstruction.cpp @@ -73,9 +73,9 @@ namespace Jug::Reco { StatusCode execute() override { constexpr auto mm = dd4hep::mm; // input collection - const eicd::RawTrackerHitCollection* rawhits = m_inputHitCollection.get(); + const auto* const rawhits = m_inputHitCollection.get(); // Create output collections - auto rec_hits = m_outputHitCollection.createAndPut(); + auto* rec_hits = m_outputHitCollection.createAndPut(); debug() << " raw hits size : " << std::size(*rawhits) << endmsg; for (const auto& ahit : *rawhits) { diff --git a/JugReco/src/components/TrackingHitsCollector.cpp b/JugReco/src/components/TrackingHitsCollector.cpp index 0af338fa..3258a6e9 100644 --- a/JugReco/src/components/TrackingHitsCollector.cpp +++ b/JugReco/src/components/TrackingHitsCollector.cpp @@ -49,7 +49,7 @@ namespace Jug::Reco { const eicd::TrackerHitCollection* vtxBarrelHits = m_vertexBarrelHits .get(); const eicd::TrackerHitCollection* vtxEndcapHits = m_vertexEndcapHits .get(); const eicd::TrackerHitCollection* gemEndcapHits = m_gemEndcapHits .get(); - auto outputHits = m_outputHitCollection.createAndPut(); + auto* outputHits = m_outputHitCollection.createAndPut(); for (const auto* hits : {trkBarrelHits, trkEndcapHits, vtxBarrelHits, vtxEndcapHits, gemEndcapHits}) { if (hits) { diff --git a/JugReco/src/components/TrackingHitsCollector2.cpp b/JugReco/src/components/TrackingHitsCollector2.cpp index fa599d1c..5ff61835 100644 --- a/JugReco/src/components/TrackingHitsCollector2.cpp +++ b/JugReco/src/components/TrackingHitsCollector2.cpp @@ -32,7 +32,7 @@ namespace Jug::Reco { declareProperty("trackingHits", m_trackingHits, "output hits combined into single collection"); } ~TrackingHitsCollector2() { - for (auto col : m_hitCollections) { + for (auto* col : m_hitCollections) { delete col; } } @@ -49,7 +49,7 @@ namespace Jug::Reco { StatusCode execute() override { - auto outputHits = m_trackingHits.createAndPut(); + auto* outputHits = m_trackingHits.createAndPut(); if (msgLevel(MSG::DEBUG)) { debug() << "execute collector" << endmsg; } diff --git a/JugTrack/src/components/CKFTracking.cpp b/JugTrack/src/components/CKFTracking.cpp index 78402c28..ae5a621c 100644 --- a/JugTrack/src/components/CKFTracking.cpp +++ b/JugTrack/src/components/CKFTracking.cpp @@ -107,13 +107,13 @@ namespace Jug::Reco { StatusCode CKFTracking::execute() { // Read input data - const IndexSourceLinkContainer* src_links = m_inputSourceLinks.get(); - const TrackParametersContainer* init_trk_params = m_inputInitialTrackParameters.get(); - const MeasurementContainer* measurements = m_inputMeasurements.get(); + const auto* const src_links = m_inputSourceLinks.get(); + const auto* const init_trk_params = m_inputInitialTrackParameters.get(); + const auto* const measurements = m_inputMeasurements.get(); //// Prepare the output data with MultiTrajectory // TrajectoryContainer trajectories; - auto trajectories = m_outputTrajectories.createAndPut(); + auto* trajectories = m_outputTrajectories.createAndPut(); trajectories->reserve(init_trk_params->size()); //// Construct a perigee surface as the target surface diff --git a/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp b/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp index 38d3ecb6..6bf9a01c 100644 --- a/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp +++ b/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp @@ -52,7 +52,7 @@ public: // input collection const eicd::TrackerHitCollection* hits = m_inputTrackerHits.get(); // Create output collections - auto proto_tracks = m_outputProtoTracks.createAndPut(); + auto* proto_tracks = m_outputProtoTracks.createAndPut(); int n_proto_tracks = 0; std::vector conformal_hits; diff --git a/JugTrack/src/components/GenFitTrackFitter.cpp b/JugTrack/src/components/GenFitTrackFitter.cpp index b7698e81..dd5253b1 100644 --- a/JugTrack/src/components/GenFitTrackFitter.cpp +++ b/JugTrack/src/components/GenFitTrackFitter.cpp @@ -184,13 +184,13 @@ StatusCode GenFitTrackFitter::execute() { for (int ihit : proto_track) { const auto& ahit = (*hits)[ihit]; - auto vol_ctx = m_geoSvc->cellIDPositionConverter()->findContext(ahit.getCellID()); + const auto* vol_ctx = m_geoSvc->cellIDPositionConverter()->findContext(ahit.getCellID()); auto vol_id = vol_ctx->identifier; auto volman = m_geoSvc->detector()->volumeManager(); auto alignment = volman.lookupDetElement(vol_id).nominal(); auto local_position = alignment.worldToLocal( {ahit.getPosition().x / 10.0, ahit.getPosition().y / 10.0, ahit.getPosition().z / 10.0}); - auto surf = m_surfaceMap[vol_id]; + auto* surf = m_surfaceMap[vol_id]; auto local_position2 = surf->globalToLocal({ahit.getPosition().x / 10.0, ahit.getPosition().y / 10.0, ahit.getPosition().z / 10.0}); @@ -220,7 +220,7 @@ StatusCode GenFitTrackFitter::execute() { debug() << "covariance matrix : " << hitCov(0, 0) << " " << hitCov(1, 1) << " " << endmsg; debug() << " hit coordinates : " << hitCoords[0] << " " << hitCoords[1] << " " << endmsg; } - auto measurement = new genfit::PlanarMeasurement(hitCoords, hitCov, 1 /** type **/, nhit, nullptr); + auto* measurement = new genfit::PlanarMeasurement(hitCoords, hitCov, 1 /** type **/, nhit, nullptr); // measurement->setPlane(genfit::SharedPlanePtr(new genfit::DetPlane(point, u_dir, v_dir)), measurement->setPlane(m_detPlaneMap[vol_id], vol_id); diff --git a/JugTrack/src/components/ParticlesFromTrackFit.cpp b/JugTrack/src/components/ParticlesFromTrackFit.cpp index e5c214d9..7cfbecf0 100644 --- a/JugTrack/src/components/ParticlesFromTrackFit.cpp +++ b/JugTrack/src/components/ParticlesFromTrackFit.cpp @@ -62,10 +62,10 @@ namespace Jug::Reco { StatusCode execute() override { // input collection - const TrajectoriesContainer* trajectories = m_inputTrajectories.get(); + const auto* const trajectories = m_inputTrajectories.get(); // create output collections - auto rec_parts = m_outputParticles.createAndPut(); - auto track_pars = m_outputTrackParameters.createAndPut(); + auto* rec_parts = m_outputParticles.createAndPut(); + auto* track_pars = m_outputTrackParameters.createAndPut(); if (msgLevel(MSG::DEBUG)) { debug() << std::size(*trajectories) << " trajectories " << endmsg; @@ -86,7 +86,7 @@ namespace Jug::Reco { continue; } - auto& trackTip = trackTips.front(); + const auto& trackTip = trackTips.front(); // Collect the trajectory summary info auto trajState = Acts::MultiTrajectoryHelpers::trajectoryState(mj, trackTip); diff --git a/JugTrack/src/components/ProtoTrackMatching.cpp b/JugTrack/src/components/ProtoTrackMatching.cpp index f30364d9..4986aa7b 100644 --- a/JugTrack/src/components/ProtoTrackMatching.cpp +++ b/JugTrack/src/components/ProtoTrackMatching.cpp @@ -46,13 +46,13 @@ public: // input collection // hits is unused, commented out for now to avoid compiler warning - //const eicd::TrackerHitCollection* hits = m_inputTrackerHits.get(); + //const auto* const hits = m_inputTrackerHits.get(); - const ProtoTrackContainer* proto_tracks = m_inputProtoTracks.get(); - const TrackParametersContainer* initialParameters = m_initialTrackParameters.get(); + const auto* const proto_tracks = m_inputProtoTracks.get(); + const auto* const initialParameters = m_initialTrackParameters.get(); // Create output collections - auto matched_proto_tracks = m_outputProtoTracks.createAndPut(); + auto* matched_proto_tracks = m_outputProtoTracks.createAndPut(); int n_tracks = initialParameters->size(); int n_proto_tracks = proto_tracks->size(); diff --git a/JugTrack/src/components/SingleTrackSourceLinker.cpp b/JugTrack/src/components/SingleTrackSourceLinker.cpp index d980300a..33925030 100644 --- a/JugTrack/src/components/SingleTrackSourceLinker.cpp +++ b/JugTrack/src/components/SingleTrackSourceLinker.cpp @@ -72,10 +72,10 @@ public: // input collection const eicd::TrackerHitCollection* hits = m_inputHitCollection.get(); // Create output collections - auto linkStorage = m_sourceLinkStorage.createAndPut(); - auto sourceLinks = m_outputSourceLinks.createAndPut(); - auto measurements = m_outputMeasurements.createAndPut(); - auto protoTracks = m_outputProtoTracks.createAndPut(); + auto* linkStorage = m_sourceLinkStorage.createAndPut(); + auto* sourceLinks = m_outputSourceLinks.createAndPut(); + auto* measurements = m_outputMeasurements.createAndPut(); + auto* protoTracks = m_outputProtoTracks.createAndPut(); // IndexMultimap hitParticlesMap; // IndexMultimap hitSimHitsMap; sourceLinks->reserve(hits->size()); @@ -93,7 +93,7 @@ public: track.emplace_back(ihit); - auto vol_ctx = m_geoSvc->cellIDPositionConverter()->findContext(ahit.getCellID()); + const auto* vol_ctx = m_geoSvc->cellIDPositionConverter()->findContext(ahit.getCellID()); auto vol_id = vol_ctx->identifier; const auto is = m_geoSvc->surfaceMap().find(vol_id); if (is == m_geoSvc->surfaceMap().end()) { diff --git a/JugTrack/src/components/TrackFindingAlgorithm.cpp b/JugTrack/src/components/TrackFindingAlgorithm.cpp index 81e79e1a..1bc4eb74 100644 --- a/JugTrack/src/components/TrackFindingAlgorithm.cpp +++ b/JugTrack/src/components/TrackFindingAlgorithm.cpp @@ -108,13 +108,13 @@ namespace Jug::Reco { StatusCode TrackFindingAlgorithm::execute() { // Read input data - const IndexSourceLinkContainer* src_links = m_inputSourceLinks.get(); - const TrackParametersContainer* init_trk_params = m_inputInitialTrackParameters.get(); - const MeasurementContainer* measurements = m_inputMeasurements.get(); + const auto* const src_links = m_inputSourceLinks.get(); + const auto* const init_trk_params = m_inputInitialTrackParameters.get(); + const auto* const measurements = m_inputMeasurements.get(); //// Prepare the output data with MultiTrajectory // TrajectoryContainer trajectories; - auto trajectories = m_outputTrajectories.createAndPut(); + auto* trajectories = m_outputTrajectories.createAndPut(); trajectories->reserve(init_trk_params->size()); //// Construct a perigee surface as the target surface diff --git a/JugTrack/src/components/TrackFittingAlgorithm.cpp b/JugTrack/src/components/TrackFittingAlgorithm.cpp index 17a2e396..b00c016b 100644 --- a/JugTrack/src/components/TrackFittingAlgorithm.cpp +++ b/JugTrack/src/components/TrackFittingAlgorithm.cpp @@ -80,10 +80,10 @@ namespace Jug::Reco { StatusCode TrackFittingAlgorithm::execute() { // Read input data - const IndexSourceLinkContainer* sourceLinks = m_inputSourceLinks.get(); - const TrackParametersContainer* initialParameters = m_initialTrackParameters.get(); - const MeasurementContainer* measurements = m_inputMeasurements.get(); - const ProtoTrackContainer* protoTracks = m_inputProtoTracks.get(); + const auto* const sourceLinks = m_inputSourceLinks.get(); + const auto* const initialParameters = m_initialTrackParameters.get(); + const auto* const measurements = m_inputMeasurements.get(); + const auto* const protoTracks = m_inputProtoTracks.get(); ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("TrackFittingAlgorithm Logger", Acts::Logging::INFO)); // Consistency cross checks @@ -93,7 +93,7 @@ namespace Jug::Reco { } // TrajectoryContainer trajectories; - auto trajectories = m_outputTrajectories.createAndPut(); + auto* trajectories = m_outputTrajectories.createAndPut(); trajectories->reserve(initialParameters->size()); // Construct a perigee surface as the target surface diff --git a/JugTrack/src/components/TrackParamClusterInit.cpp b/JugTrack/src/components/TrackParamClusterInit.cpp index 7cd5d5e5..0b3967d5 100644 --- a/JugTrack/src/components/TrackParamClusterInit.cpp +++ b/JugTrack/src/components/TrackParamClusterInit.cpp @@ -64,9 +64,9 @@ public: StatusCode execute() override { // input collection - const eicd::ClusterCollection* clusters = m_inputClusters.get(); + const auto* const clusters = m_inputClusters.get(); // Create output collections - auto init_trk_params = m_outputInitialTrackParameters.createAndPut(); + auto* init_trk_params = m_outputInitialTrackParameters.createAndPut(); for (const auto& c : *clusters) { diff --git a/JugTrack/src/components/TrackParamImagingClusterInit.cpp b/JugTrack/src/components/TrackParamImagingClusterInit.cpp index ad13648f..8a267779 100644 --- a/JugTrack/src/components/TrackParamImagingClusterInit.cpp +++ b/JugTrack/src/components/TrackParamImagingClusterInit.cpp @@ -65,9 +65,9 @@ namespace Jug::Reco { StatusCode execute() override { // input collection - const eicd::ClusterCollection* clusters = m_inputClusters.get(); + const auto* const clusters = m_inputClusters.get(); // Create output collections - auto init_trk_params = m_outputInitialTrackParameters.createAndPut(); + auto* init_trk_params = m_outputInitialTrackParameters.createAndPut(); for(const auto& c : *clusters) { diff --git a/JugTrack/src/components/TrackParamTruthInit.cpp b/JugTrack/src/components/TrackParamTruthInit.cpp index a330d54b..6c782fd7 100644 --- a/JugTrack/src/components/TrackParamTruthInit.cpp +++ b/JugTrack/src/components/TrackParamTruthInit.cpp @@ -84,9 +84,9 @@ namespace Jug::Reco { StatusCode execute() override { // input collection - const edm4hep::MCParticleCollection* mcparts = m_inputMCParticles.get(); + const auto* const mcparts = m_inputMCParticles.get(); // Create output collections - auto init_trk_params = m_outputInitialTrackParameters.createAndPut(); + auto* init_trk_params = m_outputInitialTrackParameters.createAndPut(); for(const auto& part : *mcparts) { diff --git a/JugTrack/src/components/TrackParamVertexClusterInit.cpp b/JugTrack/src/components/TrackParamVertexClusterInit.cpp index 82a1434e..97a1c6d2 100644 --- a/JugTrack/src/components/TrackParamVertexClusterInit.cpp +++ b/JugTrack/src/components/TrackParamVertexClusterInit.cpp @@ -61,10 +61,10 @@ public: StatusCode execute() override { // input collection - const Clusters* clusters = m_inputClusters.get(); - const VertexHits* vtx_hits = m_inputVertexHits.get(); + const auto* const clusters = m_inputClusters.get(); + const auto* const vtx_hits = m_inputVertexHits.get(); // Create output collections - auto init_trk_params = m_outputInitialTrackParameters.createAndPut(); + auto* init_trk_params = m_outputInitialTrackParameters.createAndPut(); double max_radius = m_maxHitRadius.value(); diff --git a/JugTrack/src/components/TruthTrackSeeding.cpp b/JugTrack/src/components/TruthTrackSeeding.cpp index 88b8cb14..d1070dfb 100644 --- a/JugTrack/src/components/TruthTrackSeeding.cpp +++ b/JugTrack/src/components/TruthTrackSeeding.cpp @@ -64,9 +64,9 @@ namespace Jug::Reco { StatusCode execute() override { // input collection - const edm4hep::MCParticleCollection* mcparts = m_inputMCParticles.get(); + const auto* const mcparts = m_inputMCParticles.get(); // Create output collections - auto init_trk_params = m_outputTrackParameters.createAndPut(); + auto* init_trk_params = m_outputTrackParameters.createAndPut(); for(const auto& part : *mcparts) { -- GitLab From 9b82e9ce23de71ce30e5cfa51c23f626c2d2caca Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 20:50:20 -0500 Subject: [PATCH 08/29] readability-braces-around-statements --- JugBase/src/KeepDropSwitch.cpp | 24 +++++++++++-------- JugBase/src/components/GeoSvc.cpp | 8 ++++--- JugBase/src/components/PodioInput.cpp | 4 +++- JugBase/src/components/PodioOutput.cpp | 3 ++- JugDigi/src/components/CalorimeterHitDigi.cpp | 6 +++-- JugDigi/src/components/SiliconTrackerDigi.cpp | 3 ++- .../components/SimTrackerHitsCollector.cpp | 3 ++- .../components/InclusiveKinematicsTruth.cpp | 3 ++- JugFast/src/components/MC2SmearedParticle.cpp | 3 ++- .../src/components/ParticlesWithTruthPID.cpp | 4 ++-- .../components/SmearedFarForwardParticles.cpp | 4 ++-- .../src/components/FarForwardParticlesOMD.cpp | 4 ++-- .../components/TrackerHitReconstruction.cpp | 3 ++- .../src/components/TrackingHitsCollector2.cpp | 3 ++- JugTrack/src/components/CKFTracking.cpp | 3 ++- .../components/ConformalXYPeakProtoTracks.cpp | 3 ++- .../src/components/FinderAlgoTemplate.cpp | 3 ++- JugTrack/src/components/GenFitTrackFitter.cpp | 3 ++- .../src/components/ParticlesFromTrackFit.cpp | 6 +++-- .../src/components/ProtoTrackMatching.cpp | 3 ++- .../components/SingleTrackSourceLinker.cpp | 3 ++- .../src/components/TrackFindingAlgorithm.cpp | 3 ++- .../src/components/TrackFittingAlgorithm.cpp | 3 ++- .../src/components/TrackParamClusterInit.cpp | 6 +++-- .../TrackParamImagingClusterInit.cpp | 6 +++-- .../TrackParamVertexClusterInit.cpp | 6 +++-- .../src/components/TrackerSourceLinker.cpp | 3 ++- 27 files changed, 80 insertions(+), 46 deletions(-) diff --git a/JugBase/src/KeepDropSwitch.cpp b/JugBase/src/KeepDropSwitch.cpp index 7fc793f6..89042639 100644 --- a/JugBase/src/KeepDropSwitch.cpp +++ b/JugBase/src/KeepDropSwitch.cpp @@ -40,7 +40,9 @@ std::vector split(const std::string& s, char delim) { std::stringstream ss(s); std::string item; while (std::getline(ss, item, delim)) { - if (!item.empty()) elems.push_back(item); + if (!item.empty()) { + elems.push_back(item); + } } return elems; } @@ -48,9 +50,9 @@ std::vector split(const std::string& s, char delim) { bool KeepDropSwitch::isOn(const std::string& astring) const { typedef std::map::const_iterator MIter; MIter im = m_cache.find(astring); - if (im != m_cache.end()) + if (im != m_cache.end()) { return im->second; - else { + } else { bool val = getFlag(astring); m_cache.insert(std::pair(astring, val)); return val; @@ -69,11 +71,11 @@ bool KeepDropSwitch::getFlag(const std::string& astring) const { std::string cmd = words[0]; std::string pattern = words[1]; Cmd theCmd = UNKNOWN; - if (cmd == "keep") + if (cmd == "keep") { theCmd = KEEP; - else if (cmd == "drop") + } else if (cmd == "drop") { theCmd = DROP; - else { + } else { std::ostringstream msg; msg << "malformed command in line: " << std::endl; msg << cmdline << std::endl; @@ -81,20 +83,22 @@ bool KeepDropSwitch::getFlag(const std::string& astring) const { throw std::invalid_argument(msg.str()); } bool match = wildcmp(pattern.c_str(), astring.c_str()); - if (not match) + if (not match) { continue; - else if (theCmd == KEEP) + } else if (theCmd == KEEP) { flag = true; - else + } else { flag = false; + } } return flag; } KeepDropSwitch::Cmd KeepDropSwitch::extractCommand(const std::string cmdline) const { std::vector words = split(cmdline, ' '); - for (auto& word : words) + for (auto& word : words) { std::cout << "'" << word << "' "; + } std::cout << std::endl; return UNKNOWN; } diff --git a/JugBase/src/components/GeoSvc.cpp b/JugBase/src/components/GeoSvc.cpp index d4cd14fb..150f4246 100644 --- a/JugBase/src/components/GeoSvc.cpp +++ b/JugBase/src/components/GeoSvc.cpp @@ -94,8 +94,9 @@ GeoSvc::~GeoSvc() { StatusCode GeoSvc::initialize() { StatusCode sc = Service::initialize(); - if (!sc.isSuccess()) + if (!sc.isSuccess()) { return sc; + } // Turn off TGeo printouts if appropriate for the msg level if (msgLevel() >= MSG::INFO) { TGeoManager::SetVerboseLevel(0); @@ -103,10 +104,11 @@ StatusCode GeoSvc::initialize() { uint printoutLevel = msgLevel(); dd4hep::setPrintLevel(dd4hep::PrintLevel(printoutLevel)); // m_incidentSvc->addListener(this, "GeometryFailure"); - if (buildDD4HepGeo().isFailure()) + if (buildDD4HepGeo().isFailure()) { m_log << MSG::ERROR << "Could not build DD4Hep geometry" << endmsg; - else + } else { m_log << MSG::INFO << "DD4Hep geometry SUCCESSFULLY built" << endmsg; + } // Genfit genfit::FieldManager::getInstance()->init(new genfit::ConstField( diff --git a/JugBase/src/components/PodioInput.cpp b/JugBase/src/components/PodioInput.cpp index b55603ab..4c10b601 100644 --- a/JugBase/src/components/PodioInput.cpp +++ b/JugBase/src/components/PodioInput.cpp @@ -50,6 +50,8 @@ StatusCode PodioInput::execute() { } StatusCode PodioInput::finalize() { - if (GaudiAlgorithm::finalize().isFailure()) return StatusCode::FAILURE; + if (GaudiAlgorithm::finalize().isFailure()) { + return StatusCode::FAILURE; + } return StatusCode::SUCCESS; } diff --git a/JugBase/src/components/PodioOutput.cpp b/JugBase/src/components/PodioOutput.cpp index 4c72507a..28103a0f 100644 --- a/JugBase/src/components/PodioOutput.cpp +++ b/JugBase/src/components/PodioOutput.cpp @@ -12,8 +12,9 @@ PodioOutput::PodioOutput(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc), m_firstEvent(true) {} StatusCode PodioOutput::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } // check whether we have the PodioEvtSvc active m_podioDataSvc = dynamic_cast(evtSvc().get()); diff --git a/JugDigi/src/components/CalorimeterHitDigi.cpp b/JugDigi/src/components/CalorimeterHitDigi.cpp index 934eb207..05538cfe 100644 --- a/JugDigi/src/components/CalorimeterHitDigi.cpp +++ b/JugDigi/src/components/CalorimeterHitDigi.cpp @@ -180,9 +180,11 @@ namespace Jug::Digi { const long long adc = std::llround(ped + m_corrMeanScale * eDep * (1. + eResRel) / dyRangeADC * m_capADC); double time = std::numeric_limits::max(); - for (const auto& c : ahit.getContributions()) - if (c.getTime() <= time) + for (const auto& c : ahit.getContributions()) { + if (c.getTime() <= time) { time = c.getTime(); + } + } const long long tdc = std::llround((time + m_normDist() * tRes) * stepTDC); eicd::RawCalorimeterHit rawhit( diff --git a/JugDigi/src/components/SiliconTrackerDigi.cpp b/JugDigi/src/components/SiliconTrackerDigi.cpp index 209790ac..a5b03862 100644 --- a/JugDigi/src/components/SiliconTrackerDigi.cpp +++ b/JugDigi/src/components/SiliconTrackerDigi.cpp @@ -39,8 +39,9 @@ public: declareProperty("outputHitCollection", m_outputHitCollection, ""); } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); StatusCode sc = m_gaussDist.initialize(randSvc, Rndm::Gauss(0.0, m_timeResolution.value())); if (!sc.isSuccess()) { diff --git a/JugDigi/src/components/SimTrackerHitsCollector.cpp b/JugDigi/src/components/SimTrackerHitsCollector.cpp index 0f793abc..f90a1602 100644 --- a/JugDigi/src/components/SimTrackerHitsCollector.cpp +++ b/JugDigi/src/components/SimTrackerHitsCollector.cpp @@ -38,8 +38,9 @@ namespace Jug::Digi { } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } for (auto colname : m_inputSimTrackerHits) { debug() << "initializing collection: " << colname << endmsg; m_hitCollections.push_back(new DataHandle{colname, Gaudi::DataHandle::Reader, this}); diff --git a/JugFast/src/components/InclusiveKinematicsTruth.cpp b/JugFast/src/components/InclusiveKinematicsTruth.cpp index be9c50d1..8400102c 100644 --- a/JugFast/src/components/InclusiveKinematicsTruth.cpp +++ b/JugFast/src/components/InclusiveKinematicsTruth.cpp @@ -35,8 +35,9 @@ public: } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } m_pidSvc = service("ParticleSvc"); if (!m_pidSvc) { diff --git a/JugFast/src/components/MC2SmearedParticle.cpp b/JugFast/src/components/MC2SmearedParticle.cpp index f45209be..15a67418 100644 --- a/JugFast/src/components/MC2SmearedParticle.cpp +++ b/JugFast/src/components/MC2SmearedParticle.cpp @@ -27,8 +27,9 @@ public: declareProperty("outputParticles", m_outputParticles, "SmearedReconstructedParticles"); } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); StatusCode sc = m_gaussDist.initialize(randSvc, Rndm::Gauss(1.0, m_smearing.value())); diff --git a/JugFast/src/components/ParticlesWithTruthPID.cpp b/JugFast/src/components/ParticlesWithTruthPID.cpp index a40235e1..44a4a76a 100644 --- a/JugFast/src/components/ParticlesWithTruthPID.cpp +++ b/JugFast/src/components/ParticlesWithTruthPID.cpp @@ -44,9 +44,9 @@ public: declareProperty("outputAssociations", m_outputAssocCollection, "MCRecoParticleAssociation"); } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; - + } return StatusCode::SUCCESS; } StatusCode execute() override { diff --git a/JugFast/src/components/SmearedFarForwardParticles.cpp b/JugFast/src/components/SmearedFarForwardParticles.cpp index 8fc4f798..de49b7c1 100644 --- a/JugFast/src/components/SmearedFarForwardParticles.cpp +++ b/JugFast/src/components/SmearedFarForwardParticles.cpp @@ -75,9 +75,9 @@ public: declareProperty("outputAssociations", m_outputAssocCollection, "MCRecoParticleAssociation"); } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; - + } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); // use 0 for mean and 1 for standard deviation. Can rescale appropriately for the // different subsystems diff --git a/JugReco/src/components/FarForwardParticlesOMD.cpp b/JugReco/src/components/FarForwardParticlesOMD.cpp index fbfe9c5e..e74164ba 100644 --- a/JugReco/src/components/FarForwardParticlesOMD.cpp +++ b/JugReco/src/components/FarForwardParticlesOMD.cpp @@ -45,9 +45,9 @@ public: } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; - + } double det = aXOMD[0][0] * aXOMD[1][1] - aXOMD[0][1] * aXOMD[1][0]; if (det == 0) { diff --git a/JugReco/src/components/TrackerHitReconstruction.cpp b/JugReco/src/components/TrackerHitReconstruction.cpp index c9791641..2c8a14ed 100644 --- a/JugReco/src/components/TrackerHitReconstruction.cpp +++ b/JugReco/src/components/TrackerHitReconstruction.cpp @@ -59,8 +59,9 @@ namespace Jug::Reco { } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } m_geoSvc = service("GeoSvc"); if (!m_geoSvc) { error() << "Unable to locate Geometry Service. " diff --git a/JugReco/src/components/TrackingHitsCollector2.cpp b/JugReco/src/components/TrackingHitsCollector2.cpp index 5ff61835..c62467c6 100644 --- a/JugReco/src/components/TrackingHitsCollector2.cpp +++ b/JugReco/src/components/TrackingHitsCollector2.cpp @@ -38,8 +38,9 @@ namespace Jug::Reco { } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } for (auto colname : m_inputTrackingHits) { debug() << "initializing collection: " << colname << endmsg; m_hitCollections.push_back(new DataHandle{colname, Gaudi::DataHandle::Reader, this}); diff --git a/JugTrack/src/components/CKFTracking.cpp b/JugTrack/src/components/CKFTracking.cpp index ae5a621c..9169973f 100644 --- a/JugTrack/src/components/CKFTracking.cpp +++ b/JugTrack/src/components/CKFTracking.cpp @@ -70,8 +70,9 @@ namespace Jug::Reco { StatusCode CKFTracking::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } m_geoSvc = service("GeoSvc"); if (!m_geoSvc) { error() << "Unable to locate Geometry Service. " diff --git a/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp b/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp index 6bf9a01c..bfa9ec39 100644 --- a/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp +++ b/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp @@ -43,8 +43,9 @@ public: } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } return StatusCode::SUCCESS; } diff --git a/JugTrack/src/components/FinderAlgoTemplate.cpp b/JugTrack/src/components/FinderAlgoTemplate.cpp index 8e6cf926..def07c71 100644 --- a/JugTrack/src/components/FinderAlgoTemplate.cpp +++ b/JugTrack/src/components/FinderAlgoTemplate.cpp @@ -33,8 +33,9 @@ public: } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } return StatusCode::SUCCESS; } diff --git a/JugTrack/src/components/GenFitTrackFitter.cpp b/JugTrack/src/components/GenFitTrackFitter.cpp index dd5253b1..4946a7fb 100644 --- a/JugTrack/src/components/GenFitTrackFitter.cpp +++ b/JugTrack/src/components/GenFitTrackFitter.cpp @@ -63,8 +63,9 @@ GenFitTrackFitter::GenFitTrackFitter(const std::string& name, ISvcLocator* svcLo } StatusCode GenFitTrackFitter::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } m_geoSvc = service("GeoSvc"); if (!m_geoSvc) { error() << "Unable to locate Geometry Service. " diff --git a/JugTrack/src/components/ParticlesFromTrackFit.cpp b/JugTrack/src/components/ParticlesFromTrackFit.cpp index 7cfbecf0..59827e2e 100644 --- a/JugTrack/src/components/ParticlesFromTrackFit.cpp +++ b/JugTrack/src/components/ParticlesFromTrackFit.cpp @@ -55,8 +55,9 @@ namespace Jug::Reco { } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } return StatusCode::SUCCESS; } @@ -150,8 +151,9 @@ namespace Jug::Reco { if (msgLevel(MSG::DEBUG)) { debug() << "# fitted parameters : " << tsize << endmsg; } - if (tsize == 0) + if (tsize == 0) { continue; + } mj.visitBackwards(tsize - 1, [&](auto&& trackstate) { // debug() << trackstate.hasPredicted() << endmsg; diff --git a/JugTrack/src/components/ProtoTrackMatching.cpp b/JugTrack/src/components/ProtoTrackMatching.cpp index 4986aa7b..8c1fe82f 100644 --- a/JugTrack/src/components/ProtoTrackMatching.cpp +++ b/JugTrack/src/components/ProtoTrackMatching.cpp @@ -37,8 +37,9 @@ public: } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } return StatusCode::SUCCESS; } diff --git a/JugTrack/src/components/SingleTrackSourceLinker.cpp b/JugTrack/src/components/SingleTrackSourceLinker.cpp index 33925030..06ffde8a 100644 --- a/JugTrack/src/components/SingleTrackSourceLinker.cpp +++ b/JugTrack/src/components/SingleTrackSourceLinker.cpp @@ -57,8 +57,9 @@ public: } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } m_geoSvc = service("GeoSvc"); if (!m_geoSvc) { error() << "Unable to locate Geometry Service. " diff --git a/JugTrack/src/components/TrackFindingAlgorithm.cpp b/JugTrack/src/components/TrackFindingAlgorithm.cpp index 1bc4eb74..87ee96bb 100644 --- a/JugTrack/src/components/TrackFindingAlgorithm.cpp +++ b/JugTrack/src/components/TrackFindingAlgorithm.cpp @@ -71,8 +71,9 @@ namespace Jug::Reco { StatusCode TrackFindingAlgorithm::initialize() { warning() << "Deprecated algorithm, use CKFTracking instead" << endmsg; - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } m_geoSvc = service("GeoSvc"); if (!m_geoSvc) { error() << "Unable to locate Geometry Service. " diff --git a/JugTrack/src/components/TrackFittingAlgorithm.cpp b/JugTrack/src/components/TrackFittingAlgorithm.cpp index b00c016b..14d6c658 100644 --- a/JugTrack/src/components/TrackFittingAlgorithm.cpp +++ b/JugTrack/src/components/TrackFittingAlgorithm.cpp @@ -58,8 +58,9 @@ namespace Jug::Reco { StatusCode TrackFittingAlgorithm::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } m_geoSvc = service("GeoSvc"); if (!m_geoSvc) { error() << "Unable to locate Geometry Service. " diff --git a/JugTrack/src/components/TrackParamClusterInit.cpp b/JugTrack/src/components/TrackParamClusterInit.cpp index 0b3967d5..0bbf3a87 100644 --- a/JugTrack/src/components/TrackParamClusterInit.cpp +++ b/JugTrack/src/components/TrackParamClusterInit.cpp @@ -54,11 +54,13 @@ public: } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); - if (!randSvc) + if (!randSvc) { return StatusCode::FAILURE; + } return StatusCode::SUCCESS; } diff --git a/JugTrack/src/components/TrackParamImagingClusterInit.cpp b/JugTrack/src/components/TrackParamImagingClusterInit.cpp index 8a267779..0fd9d23c 100644 --- a/JugTrack/src/components/TrackParamImagingClusterInit.cpp +++ b/JugTrack/src/components/TrackParamImagingClusterInit.cpp @@ -55,11 +55,13 @@ namespace Jug::Reco { } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); - if(!randSvc) + if(!randSvc) { return StatusCode::FAILURE; + } return StatusCode::SUCCESS; } diff --git a/JugTrack/src/components/TrackParamVertexClusterInit.cpp b/JugTrack/src/components/TrackParamVertexClusterInit.cpp index 97a1c6d2..b7abc181 100644 --- a/JugTrack/src/components/TrackParamVertexClusterInit.cpp +++ b/JugTrack/src/components/TrackParamVertexClusterInit.cpp @@ -51,11 +51,13 @@ public: } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); - if (!randSvc) + if (!randSvc) { return StatusCode::FAILURE; + } return StatusCode::SUCCESS; } diff --git a/JugTrack/src/components/TrackerSourceLinker.cpp b/JugTrack/src/components/TrackerSourceLinker.cpp index 03495133..04170192 100644 --- a/JugTrack/src/components/TrackerSourceLinker.cpp +++ b/JugTrack/src/components/TrackerSourceLinker.cpp @@ -57,8 +57,9 @@ public: } StatusCode initialize() override { - if (GaudiAlgorithm::initialize().isFailure()) + if (GaudiAlgorithm::initialize().isFailure()) { return StatusCode::FAILURE; + } m_geoSvc = service("GeoSvc"); if (!m_geoSvc) { error() << "Unable to locate Geometry Service. " -- GitLab From 2fb587f2b9a153fb7c17a44ec0b5f1bc724b19ce Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 20:51:40 -0500 Subject: [PATCH 09/29] modernize-use-using: using instead of typedef --- JugBase/src/KeepDropSwitch.cpp | 2 +- JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/JugBase/src/KeepDropSwitch.cpp b/JugBase/src/KeepDropSwitch.cpp index 89042639..5119d96e 100644 --- a/JugBase/src/KeepDropSwitch.cpp +++ b/JugBase/src/KeepDropSwitch.cpp @@ -48,7 +48,7 @@ std::vector split(const std::string& s, char delim) { } bool KeepDropSwitch::isOn(const std::string& astring) const { - typedef std::map::const_iterator MIter; + using MIter = std::map::const_iterator; MIter im = m_cache.find(astring); if (im != m_cache.end()) { return im->second; diff --git a/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp b/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp index 83f4aea1..718be4e9 100644 --- a/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp +++ b/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp @@ -33,7 +33,7 @@ #include "eicd/vector_utils.h" using namespace Gaudi::Units; -typedef ROOT::Math::XYZPoint Point3D; +using Point3D = ROOT::Math::XYZPoint; struct pair_hash { template std::size_t operator()(const std::pair& pair) const { -- GitLab From 4df00e4000dc8c9c52df413c72619c30d2dc4626 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 20:57:17 -0500 Subject: [PATCH 10/29] modernize-use-auto wherever possible --- JugBase/src/KeepDropSwitch.cpp | 2 +- JugBase/src/PodioDataSvc.cpp | 2 +- JugBase/src/Utilities/Helpers.cpp | 8 ++++---- JugBase/src/components/GeoSvc.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/JugBase/src/KeepDropSwitch.cpp b/JugBase/src/KeepDropSwitch.cpp index 5119d96e..fff5778c 100644 --- a/JugBase/src/KeepDropSwitch.cpp +++ b/JugBase/src/KeepDropSwitch.cpp @@ -49,7 +49,7 @@ std::vector split(const std::string& s, char delim) { bool KeepDropSwitch::isOn(const std::string& astring) const { using MIter = std::map::const_iterator; - MIter im = m_cache.find(astring); + auto im = m_cache.find(astring); if (im != m_cache.end()) { return im->second; } else { diff --git a/JugBase/src/PodioDataSvc.cpp b/JugBase/src/PodioDataSvc.cpp index b16082d9..5511cc27 100644 --- a/JugBase/src/PodioDataSvc.cpp +++ b/JugBase/src/PodioDataSvc.cpp @@ -108,7 +108,7 @@ StatusCode PodioDataSvc::readCollection(const std::string& collectionName, int c } StatusCode PodioDataSvc::registerObject(std::string_view parentPath, std::string_view fullPath, DataObject* pObject) { - DataWrapperBase* wrapper = dynamic_cast(pObject); + auto* wrapper = dynamic_cast(pObject); if (wrapper) { podio::CollectionBase* coll = wrapper->collectionBase(); if (coll) { diff --git a/JugBase/src/Utilities/Helpers.cpp b/JugBase/src/Utilities/Helpers.cpp index 2887c803..801cac54 100644 --- a/JugBase/src/Utilities/Helpers.cpp +++ b/JugBase/src/Utilities/Helpers.cpp @@ -58,14 +58,14 @@ void anaHisto(TH1D* inputHist, int j, TH1F* meanHist, TH1F* widthHist) { TEfficiency* bookEff(const char* effName, const char* effTitle, const Binning& varBinning) { - TEfficiency* efficiency = new TEfficiency(effName, effTitle, varBinning.nBins, - varBinning.min, varBinning.max); + auto* efficiency = new TEfficiency(effName, effTitle, varBinning.nBins, + varBinning.min, varBinning.max); return efficiency; } TEfficiency* bookEff(const char* effName, const char* effTitle, const Binning& varXBinning, const Binning& varYBinning) { - TEfficiency* efficiency = new TEfficiency( + auto* efficiency = new TEfficiency( effName, effTitle, varXBinning.nBins, varXBinning.min, varXBinning.max, varYBinning.nBins, varYBinning.min, varYBinning.max); return efficiency; @@ -83,7 +83,7 @@ void fillEff(TEfficiency* efficiency, float xValue, float yValue, bool status) { TProfile* bookProf(const char* profName, const char* profTitle, const Binning& varXBinning, const Binning& varYBinning) { - TProfile* prof = + auto* prof = new TProfile(profName, profTitle, varXBinning.nBins, varXBinning.min, varXBinning.max, varYBinning.min, varYBinning.max); prof->GetXaxis()->SetTitle(varXBinning.title.c_str()); diff --git a/JugBase/src/components/GeoSvc.cpp b/JugBase/src/components/GeoSvc.cpp index 150f4246..8cf59d0f 100644 --- a/JugBase/src/components/GeoSvc.cpp +++ b/JugBase/src/components/GeoSvc.cpp @@ -56,8 +56,8 @@ void draw_surfaces(std::shared_ptr trk_geo, const os << std::fixed << std::setprecision(6); size_t nVtx = 0; for (const auto& srfx : surfaces) { - const PlaneSurface* srf = dynamic_cast(srfx); - const PlanarBounds* bounds = dynamic_cast(&srf->bounds()); + const auto* srf = dynamic_cast(srfx); + const auto* bounds = dynamic_cast(&srf->bounds()); for (const auto& vtxloc : bounds->vertices()) { Vector3 vtx = srf->transform(geo_ctx) * Vector3(vtxloc.x(), vtxloc.y(), 0); os << "v " << vtx.x() << " " << vtx.y() << " " << vtx.z() << "\n"; -- GitLab From 72b356fda065585a8437ed5a58356bc35c47e097 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 21:09:09 -0500 Subject: [PATCH 11/29] clang-diagnostic-unused-variable --- JugTrack/src/components/TrackFittingAlgorithm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JugTrack/src/components/TrackFittingAlgorithm.cpp b/JugTrack/src/components/TrackFittingAlgorithm.cpp index 14d6c658..ffe927a0 100644 --- a/JugTrack/src/components/TrackFittingAlgorithm.cpp +++ b/JugTrack/src/components/TrackFittingAlgorithm.cpp @@ -148,8 +148,8 @@ namespace Jug::Reco { for (auto hitIndex : protoTrack) { if (auto it = sourceLinks->nth(hitIndex); it != sourceLinks->end()) { const IndexSourceLink& sourceLink = *it; - auto geoId = sourceLink.geometryId(); trackSourceLinks.push_back(std::cref(sourceLink)); + //auto geoId = sourceLink.geometryId(); //surfSequence.push_back(m_cfg.trackingGeometry->findSurface(geoId)); } else { ACTS_FATAL("Proto track " << itrack << " contains invalid hit index" -- GitLab From 6329852479afd4aa809e08afc1cf84e5a06492b4 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 21:16:18 -0500 Subject: [PATCH 12/29] readability-isolate-declaration --- JugBase/src/KeepDropSwitch.cpp | 3 ++- JugReco/src/components/FarForwardParticles.cpp | 3 ++- JugTrack/src/components/GenFitTrackFitter.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/JugBase/src/KeepDropSwitch.cpp b/JugBase/src/KeepDropSwitch.cpp index fff5778c..7d425225 100644 --- a/JugBase/src/KeepDropSwitch.cpp +++ b/JugBase/src/KeepDropSwitch.cpp @@ -6,7 +6,8 @@ int wildcmp(const char* wild, const char* string) { // Written by Jack Handy - jakkhandy@hotmail.com - const char *cp = nullptr, *mp = nullptr; + const char *cp = nullptr; + const char *mp = nullptr; while ((*string) && (*wild != '*')) { if ((*wild != *string) && (*wild != '?')) { return 0; diff --git a/JugReco/src/components/FarForwardParticles.cpp b/JugReco/src/components/FarForwardParticles.cpp index 4b91c829..30480a28 100644 --- a/JugReco/src/components/FarForwardParticles.cpp +++ b/JugReco/src/components/FarForwardParticles.cpp @@ -239,7 +239,8 @@ public: } // convert polar angles to radians - double rsx = Xip[1] / 1000., rsy = Yip[1] / 1000.; + double rsx = Xip[1] / 1000.; + double rsy = Yip[1] / 1000.; // calculate momentum magnitude from measured deltaP – using thin lens optics. double p = nomMomentum * (1 + 0.01 * Xip[0]); diff --git a/JugTrack/src/components/GenFitTrackFitter.cpp b/JugTrack/src/components/GenFitTrackFitter.cpp index 4946a7fb..a7d896ee 100644 --- a/JugTrack/src/components/GenFitTrackFitter.cpp +++ b/JugTrack/src/components/GenFitTrackFitter.cpp @@ -258,7 +258,8 @@ StatusCode GenFitTrackFitter::execute() { // unused // float charge = fitTrack.getFitStatus()->getCharge(); - TVector3 vertexPos, vertexMom; + TVector3 vertexPos; + TVector3 vertexMom; TMatrixDSym vertexCov; genfit::MeasuredStateOnPlane state = fitTrack.getFittedState(); // copy TVector3 vertex(0, 0, 0); -- GitLab From fb9e58323ca7ce2f8417e8a53ba5963baad72534 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 21:16:57 -0500 Subject: [PATCH 13/29] clang-diagnostic-uninitialized --- JugReco/src/components/ImagingClusterReco.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/JugReco/src/components/ImagingClusterReco.cpp b/JugReco/src/components/ImagingClusterReco.cpp index 7aa3e25e..5313c270 100644 --- a/JugReco/src/components/ImagingClusterReco.cpp +++ b/JugReco/src/components/ImagingClusterReco.cpp @@ -158,11 +158,11 @@ private: eicd::MutableCluster layer; layer.setType(ClusterType::kClusterSlice); // Calculate averages - double energy; - double energyError; - double time; - double timeError; - double sumOfWeights = 0; + double energy{0}; + double energyError{0}; + double time{0}; + double timeError{0}; + double sumOfWeights{0}; auto pos = layer.getPosition(); for (const auto& [hit, weight] : hits) { energy += hit.getEnergy() * weight; -- GitLab From 3f55c6800c9891f01fb35be3b7051d98dbdfb77e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 21:18:56 -0500 Subject: [PATCH 14/29] cppcoreguidelines-init-variables --- JugBase/src/PodioDataSvc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JugBase/src/PodioDataSvc.cpp b/JugBase/src/PodioDataSvc.cpp index 5511cc27..cf6383e5 100644 --- a/JugBase/src/PodioDataSvc.cpp +++ b/JugBase/src/PodioDataSvc.cpp @@ -71,7 +71,7 @@ void PodioDataSvc::endOfRead() { m_reader.endOfEvent(); if (m_eventNum++ > m_eventMax) { info() << "Reached end of file with event " << m_eventMax << endmsg; - IEventProcessor* eventProcessor; + IEventProcessor* eventProcessor = nullptr; auto ret = service("ApplicationMgr", eventProcessor); // FIXME: deal with errors ret = eventProcessor->stopRun(); -- GitLab From a632ac574b17dc1f3b9fd721ef4379b065f1bcc2 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 21:36:59 -0500 Subject: [PATCH 15/29] readability-redundant-access-specifiers: private/public --- JugDigi/src/components/SiliconTrackerDigi.cpp | 2 +- JugDigi/src/components/SimTrackerHitsCollector.cpp | 2 +- JugFast/src/components/ClusterMerger.cpp | 2 +- JugFast/src/components/InclusiveKinematicsTruth.cpp | 3 ++- JugFast/src/components/MC2SmearedParticle.cpp | 3 ++- JugFast/src/components/MatchClusters.cpp | 3 ++- JugFast/src/components/ParticlesWithTruthPID.cpp | 3 ++- JugFast/src/components/SmearedFarForwardParticles.cpp | 4 +--- JugFast/src/components/TruthClustering.cpp | 3 ++- JugFast/src/components/TruthEnergyPositionClusterMerger.cpp | 2 +- JugPID/src/components/PhotoRingClusters.cpp | 3 ++- JugReco/src/components/CalorimeterHitReco.cpp | 3 ++- JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp | 3 ++- JugReco/src/components/CalorimeterHitsMerger.cpp | 3 ++- JugReco/src/components/ClusterRecoCoG.cpp | 3 ++- JugReco/src/components/EnergyPositionClusterMerger.cpp | 2 +- JugReco/src/components/FarForwardParticles.cpp | 1 + JugReco/src/components/FarForwardParticlesOMD.cpp | 1 + JugReco/src/components/ImagingClusterReco.cpp | 3 ++- JugReco/src/components/ImagingPixelDataCombiner.cpp | 3 ++- JugReco/src/components/ImagingPixelDataSorter.cpp | 3 ++- JugReco/src/components/ImagingPixelMerger.cpp | 3 ++- JugReco/src/components/ImagingPixelReco.cpp | 3 ++- JugReco/src/components/ImagingTopoCluster.cpp | 3 ++- JugReco/src/components/InclusiveKinematicsDA.cpp | 3 ++- JugReco/src/components/InclusiveKinematicsElectron.cpp | 3 ++- JugReco/src/components/InclusiveKinematicsJB.cpp | 3 ++- JugReco/src/components/InclusiveKinematicsSigma.cpp | 3 ++- JugReco/src/components/InclusiveKinematicseSigma.cpp | 3 ++- JugReco/src/components/ParticleCollector.cpp | 2 +- JugReco/src/components/PhotoMultiplierReco.cpp | 3 ++- JugReco/src/components/SimpleClustering.cpp | 3 ++- JugReco/src/components/TrackerHitReconstruction.cpp | 2 +- JugReco/src/components/TrackingHitsCollector.cpp | 2 +- JugReco/src/components/TrackingHitsCollector2.cpp | 2 +- JugTrack/src/components/ActsTrajectoryReader.cpp | 2 +- JugTrack/src/components/ConformalXYPeakProtoTracks.cpp | 2 +- JugTrack/src/components/FinderAlgoTemplate.cpp | 2 +- JugTrack/src/components/HoughTransformProtoTracks.cpp | 2 +- JugTrack/src/components/ParticlesFromTrackFit.cpp | 2 +- JugTrack/src/components/ProtoTrackMatching.cpp | 2 +- JugTrack/src/components/SingleTrackSourceLinker.cpp | 2 +- JugTrack/src/components/TrackParamClusterInit.cpp | 2 +- JugTrack/src/components/TrackParamImagingClusterInit.cpp | 2 +- JugTrack/src/components/TrackParamTruthInit.cpp | 2 +- JugTrack/src/components/TrackParamVertexClusterInit.cpp | 2 +- JugTrack/src/components/TrackerSourceLinker.cpp | 2 +- JugTrack/src/components/TrackingHitsSourceLinker.cpp | 2 +- JugTrack/src/components/TruthTrackSeeding.cpp | 2 +- 49 files changed, 72 insertions(+), 49 deletions(-) diff --git a/JugDigi/src/components/SiliconTrackerDigi.cpp b/JugDigi/src/components/SiliconTrackerDigi.cpp index a5b03862..16f237de 100644 --- a/JugDigi/src/components/SiliconTrackerDigi.cpp +++ b/JugDigi/src/components/SiliconTrackerDigi.cpp @@ -23,7 +23,7 @@ namespace Jug::Digi { * \ingroup digi */ class SiliconTrackerDigi : public GaudiAlgorithm { -public: +private: Gaudi::Property m_timeResolution{this, "timeResolution", 10}; // todo : add units Gaudi::Property m_threshold{this, "threshold", 0. * Gaudi::Units::keV}; Rndm::Numbers m_gaussDist; diff --git a/JugDigi/src/components/SimTrackerHitsCollector.cpp b/JugDigi/src/components/SimTrackerHitsCollector.cpp index f90a1602..26c4cd61 100644 --- a/JugDigi/src/components/SimTrackerHitsCollector.cpp +++ b/JugDigi/src/components/SimTrackerHitsCollector.cpp @@ -19,7 +19,7 @@ namespace Jug::Digi { * \ingroup digi */ class SimTrackerHitsCollector : public GaudiAlgorithm { - public: + private: Gaudi::Property> m_inputSimTrackerHits{this, "inputSimTrackerHits", {},"Tracker hits to be aggregated"}; DataHandle m_outputSimTrackerHits{"outputSimTrackerHits", Gaudi::DataHandle::Writer, this}; diff --git a/JugFast/src/components/ClusterMerger.cpp b/JugFast/src/components/ClusterMerger.cpp index f7e75b89..f7c68c72 100644 --- a/JugFast/src/components/ClusterMerger.cpp +++ b/JugFast/src/components/ClusterMerger.cpp @@ -26,7 +26,7 @@ namespace Jug::Fast { * \ingroup fast */ class ClusterMerger : public GaudiAlgorithm { -public: +private: // Input DataHandle m_inputClusters{"InputClusters", Gaudi::DataHandle::Reader, this}; // Output diff --git a/JugFast/src/components/InclusiveKinematicsTruth.cpp b/JugFast/src/components/InclusiveKinematicsTruth.cpp index 8400102c..dab2132d 100644 --- a/JugFast/src/components/InclusiveKinematicsTruth.cpp +++ b/JugFast/src/components/InclusiveKinematicsTruth.cpp @@ -18,7 +18,7 @@ namespace Jug::Fast { class InclusiveKinematicsTruth : public GaudiAlgorithm { -public: +private: DataHandle m_inputParticleCollection{"MCParticles", Gaudi::DataHandle::Reader, this}; DataHandle m_outputInclusiveKinematicsCollection{"InclusiveKinematicsTruth", @@ -28,6 +28,7 @@ public: double m_proton; double m_neutron; +public: InclusiveKinematicsTruth(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputMCParticles", m_inputParticleCollection, "MCParticles"); diff --git a/JugFast/src/components/MC2SmearedParticle.cpp b/JugFast/src/components/MC2SmearedParticle.cpp index 15a67418..1e2b5f7d 100644 --- a/JugFast/src/components/MC2SmearedParticle.cpp +++ b/JugFast/src/components/MC2SmearedParticle.cpp @@ -15,13 +15,14 @@ namespace Jug::Fast { class MC2SmearedParticle : public GaudiAlgorithm { -public: +private: DataHandle m_inputMCParticles{"MCParticles", Gaudi::DataHandle::Reader, this}; DataHandle m_outputParticles{"SmearedReconstructedParticles", Gaudi::DataHandle::Writer, this}; Rndm::Numbers m_gaussDist; Gaudi::Property m_smearing{this, "smearing", 0.01 /* 1 percent*/}; +public: MC2SmearedParticle(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputParticles", m_inputMCParticles, "MCParticles"); declareProperty("outputParticles", m_outputParticles, "SmearedReconstructedParticles"); diff --git a/JugFast/src/components/MatchClusters.cpp b/JugFast/src/components/MatchClusters.cpp index 71b442e8..cd522e24 100644 --- a/JugFast/src/components/MatchClusters.cpp +++ b/JugFast/src/components/MatchClusters.cpp @@ -27,7 +27,7 @@ namespace Jug::Fast { class MatchClusters : public GaudiAlgorithm { -public: +private: // input data DataHandle m_inputMCParticles{"MCParticles", Gaudi::DataHandle::Reader, this}; DataHandle m_inputParticles{"ReconstructedChargedParticles", @@ -39,6 +39,7 @@ public: DataHandle m_outputParticles{"ReconstructedParticles", Gaudi::DataHandle::Writer, this}; +public: MatchClusters(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputMCParticles", m_inputMCParticles, "MCParticles"); diff --git a/JugFast/src/components/ParticlesWithTruthPID.cpp b/JugFast/src/components/ParticlesWithTruthPID.cpp index 44a4a76a..9da54aae 100644 --- a/JugFast/src/components/ParticlesWithTruthPID.cpp +++ b/JugFast/src/components/ParticlesWithTruthPID.cpp @@ -21,7 +21,7 @@ namespace Jug::Fast { class ParticlesWithTruthPID : public GaudiAlgorithm { -public: +private: DataHandle m_inputTruthCollection{"inputMCParticles", Gaudi::DataHandle::Reader, this}; DataHandle m_inputTrackCollection{"inputTrackParameters", Gaudi::DataHandle::Reader, this}; @@ -37,6 +37,7 @@ public: // Matchin eta tolerance of 0.1 Gaudi::Property m_etaTolerance{this, "etaTolerance", {0.2}}; +public: ParticlesWithTruthPID(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputMCParticles", m_inputTruthCollection, "MCParticles"); declareProperty("inputTrackParameters", m_inputTrackCollection, "outputTrackParameters"); diff --git a/JugFast/src/components/SmearedFarForwardParticles.cpp b/JugFast/src/components/SmearedFarForwardParticles.cpp index de49b7c1..adb317eb 100644 --- a/JugFast/src/components/SmearedFarForwardParticles.cpp +++ b/JugFast/src/components/SmearedFarForwardParticles.cpp @@ -23,7 +23,7 @@ enum DetectorTags { kTagB0 = 1, kTagRP = 2, kTagOMD = 3, kTagZDC = 4 }; namespace Jug::Fast { class SmearedFarForwardParticles : public GaudiAlgorithm { -public: +private: DataHandle m_inputMCParticles{"inputMCParticles", Gaudi::DataHandle::Reader, this}; DataHandle m_outputParticles{"SmearedFarForwardParticles", Gaudi::DataHandle::Writer, this}; @@ -63,7 +63,6 @@ public: Rndm::Numbers m_gaussDist; -private: using RecPart = eicd::MutableReconstructedParticle; using Assoc = eicd::MutableMCRecoParticleAssociation; using RecData = std::pair; @@ -385,7 +384,6 @@ private: return {rec_part, assoc}; } -private: // Rotate 25mrad about the y-axis edm4hep::Vector3f rotateLabToIonDirection(const edm4hep::Vector3f& vec) const { const auto sth = sin(-m_crossingAngle); diff --git a/JugFast/src/components/TruthClustering.cpp b/JugFast/src/components/TruthClustering.cpp index c48b9e19..1aa17cfb 100644 --- a/JugFast/src/components/TruthClustering.cpp +++ b/JugFast/src/components/TruthClustering.cpp @@ -32,11 +32,12 @@ namespace Jug::Fast { * \ingroup reco */ class TruthClustering : public GaudiAlgorithm { -public: +private: DataHandle m_inputHits{"inputHits", Gaudi::DataHandle::Reader, this}; DataHandle m_mcHits{"mcHits", Gaudi::DataHandle::Reader, this}; DataHandle m_outputProtoClusters{"outputProtoClusters", Gaudi::DataHandle::Writer, this}; +public: TruthClustering(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHits", m_inputHits, "Input calorimeter reco hits"); diff --git a/JugFast/src/components/TruthEnergyPositionClusterMerger.cpp b/JugFast/src/components/TruthEnergyPositionClusterMerger.cpp index 654aeb68..58d3bce6 100644 --- a/JugFast/src/components/TruthEnergyPositionClusterMerger.cpp +++ b/JugFast/src/components/TruthEnergyPositionClusterMerger.cpp @@ -31,7 +31,7 @@ namespace Jug::Fast { * \ingroup reco */ class TruthEnergyPositionClusterMerger : public GaudiAlgorithm { -public: +private: // Input DataHandle m_inputMCParticles{"MCParticles", Gaudi::DataHandle::Reader, this}; DataHandle m_energyClusters{"EnergyClusters", Gaudi::DataHandle::Reader, this}; diff --git a/JugPID/src/components/PhotoRingClusters.cpp b/JugPID/src/components/PhotoRingClusters.cpp index c1d1eeac..6138ce4d 100644 --- a/JugPID/src/components/PhotoRingClusters.cpp +++ b/JugPID/src/components/PhotoRingClusters.cpp @@ -37,7 +37,7 @@ namespace Jug::Reco { * \ingroup reco */ class PhotoRingClusters : public GaudiAlgorithm { -public: +private: DataHandle m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this}; DataHandle m_outputClusterCollection{"outputClusterCollection", Gaudi::DataHandle::Writer, this}; @@ -51,6 +51,7 @@ public: // Pointer to the geometry service SmartIF m_geoSvc; +public: // ill-formed: using GaudiAlgorithm::GaudiAlgorithm; PhotoRingClusters(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHitCollection", m_inputHitCollection, ""); diff --git a/JugReco/src/components/CalorimeterHitReco.cpp b/JugReco/src/components/CalorimeterHitReco.cpp index 84d806ca..a0c55e4f 100644 --- a/JugReco/src/components/CalorimeterHitReco.cpp +++ b/JugReco/src/components/CalorimeterHitReco.cpp @@ -36,7 +36,7 @@ namespace Jug::Reco { * \ingroup reco */ class CalorimeterHitReco : public GaudiAlgorithm { -public: +private: // length unit from dd4hep, should be fixed Gaudi::Property m_lUnit{this, "lengthUnit", dd4hep::mm}; @@ -80,6 +80,7 @@ public: dd4hep::DetElement local; size_t local_mask = ~0; +public: CalorimeterHitReco(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHitCollection", m_inputHitCollection, ""); declareProperty("outputHitCollection", m_outputHitCollection, ""); diff --git a/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp b/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp index 718be4e9..cfb3ca8a 100644 --- a/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp +++ b/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp @@ -55,7 +55,7 @@ namespace Jug::Reco { * \ingroup reco */ class CalorimeterHitsEtaPhiProjector : public GaudiAlgorithm { -public: +private: Gaudi::Property> u_gridSizes{this, "gridSizes", {0.001, 0.001 * rad}}; DataHandle m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this}; @@ -64,6 +64,7 @@ public: double gridSizes[2]; +public: CalorimeterHitsEtaPhiProjector(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHitCollection", m_inputHitCollection, ""); declareProperty("outputHitCollection", m_outputHitCollection, ""); diff --git a/JugReco/src/components/CalorimeterHitsMerger.cpp b/JugReco/src/components/CalorimeterHitsMerger.cpp index d3db4f70..9f1ff286 100644 --- a/JugReco/src/components/CalorimeterHitsMerger.cpp +++ b/JugReco/src/components/CalorimeterHitsMerger.cpp @@ -43,7 +43,7 @@ namespace Jug::Reco { * \ingroup reco */ class CalorimeterHitsMerger : public GaudiAlgorithm { -public: +private: Gaudi::Property m_geoSvcName{this, "geoServiceName", "GeoSvc"}; Gaudi::Property m_readout{this, "readoutClass", ""}; // field names to generate id mask, the hits will be grouped by masking the field @@ -57,6 +57,7 @@ public: SmartIF m_geoSvc; uint64_t id_mask, ref_mask; +public: CalorimeterHitsMerger(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHitCollection", m_inputHitCollection, ""); declareProperty("outputHitCollection", m_outputHitCollection, ""); diff --git a/JugReco/src/components/ClusterRecoCoG.cpp b/JugReco/src/components/ClusterRecoCoG.cpp index 801e99dd..8742920e 100644 --- a/JugReco/src/components/ClusterRecoCoG.cpp +++ b/JugReco/src/components/ClusterRecoCoG.cpp @@ -61,7 +61,7 @@ static const std::map m_sampFrac{this, "samplingFraction", 1.0}; Gaudi::Property m_logWeightBase{this, "logWeightBase", 3.6}; Gaudi::Property m_depthCorrection{this, "depthCorrection", 0.0}; @@ -81,6 +81,7 @@ public: double m_depthCorr; std::function weightFunc; +public: ClusterRecoCoG(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { // declareProperty("inputHitCollection", m_inputHits, ""); declareProperty("inputProtoClusterCollection", m_inputProto, ""); diff --git a/JugReco/src/components/EnergyPositionClusterMerger.cpp b/JugReco/src/components/EnergyPositionClusterMerger.cpp index 1040f1d6..bb390e4a 100644 --- a/JugReco/src/components/EnergyPositionClusterMerger.cpp +++ b/JugReco/src/components/EnergyPositionClusterMerger.cpp @@ -32,7 +32,7 @@ namespace Jug::Reco { * \ingroup reco */ class EnergyPositionClusterMerger : public GaudiAlgorithm { -public: +private: // Input DataHandle m_energyClusters{"energyClusters", Gaudi::DataHandle::Reader, this}; DataHandle m_positionClusters{"positionClusters", Gaudi::DataHandle::Reader, this}; diff --git a/JugReco/src/components/FarForwardParticles.cpp b/JugReco/src/components/FarForwardParticles.cpp index 30480a28..f8778b43 100644 --- a/JugReco/src/components/FarForwardParticles.cpp +++ b/JugReco/src/components/FarForwardParticles.cpp @@ -23,6 +23,7 @@ namespace Jug::Reco { class FarForwardParticles : public GaudiAlgorithm { +private: DataHandle m_inputHitCollection{"FarForwardTrackerHits", Gaudi::DataHandle::Reader, this}; DataHandle m_outputParticles{"outputParticles", Gaudi::DataHandle::Writer, this}; diff --git a/JugReco/src/components/FarForwardParticlesOMD.cpp b/JugReco/src/components/FarForwardParticlesOMD.cpp index e74164ba..3ece3e8f 100644 --- a/JugReco/src/components/FarForwardParticlesOMD.cpp +++ b/JugReco/src/components/FarForwardParticlesOMD.cpp @@ -18,6 +18,7 @@ namespace Jug::Reco { class FarForwardParticlesOMD : public GaudiAlgorithm { +private: DataHandle m_inputHitCollection{"FarForwardTrackerHits", Gaudi::DataHandle::Reader, this}; DataHandle m_outputParticles{"outputParticles", Gaudi::DataHandle::Writer, this}; diff --git a/JugReco/src/components/ImagingClusterReco.cpp b/JugReco/src/components/ImagingClusterReco.cpp index 5313c270..93324538 100644 --- a/JugReco/src/components/ImagingClusterReco.cpp +++ b/JugReco/src/components/ImagingClusterReco.cpp @@ -46,7 +46,7 @@ namespace Jug::Reco { * \ingroup reco */ class ImagingClusterReco : public GaudiAlgorithm { -public: +private: Gaudi::Property m_trackStopLayer{this, "trackStopLayer", 9}; DataHandle m_inputProtoClusters{"inputProtoClusters", Gaudi::DataHandle::Reader, this}; @@ -58,6 +58,7 @@ public: // Optional handle to MC hits std::unique_ptr> m_inputMC; +public: ImagingClusterReco(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputProtoClusters", m_inputProtoClusters, ""); declareProperty("outputLayers", m_outputLayers, ""); diff --git a/JugReco/src/components/ImagingPixelDataCombiner.cpp b/JugReco/src/components/ImagingPixelDataCombiner.cpp index 8450bf0e..ab1ccc52 100644 --- a/JugReco/src/components/ImagingPixelDataCombiner.cpp +++ b/JugReco/src/components/ImagingPixelDataCombiner.cpp @@ -42,7 +42,7 @@ namespace Jug::Reco { * \ingroup reco */ class ImagingPixelDataCombiner : public GaudiAlgorithm { -public: +private: Gaudi::Property m_layerIncrement{this, "layerIncrement", 0}; Gaudi::Property m_rule{this, "rule", "concatenate"}; DataHandle m_inputHits1{"inputHits1", Gaudi::DataHandle::Reader, this}; @@ -50,6 +50,7 @@ public: DataHandle m_outputHits{"outputHits", Gaudi::DataHandle::Writer, this}; std::vector supported_rules{"concatenate", "interlayer"}; +public: ImagingPixelDataCombiner(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHits1", m_inputHits1, ""); diff --git a/JugReco/src/components/ImagingPixelDataSorter.cpp b/JugReco/src/components/ImagingPixelDataSorter.cpp index a8ff8950..90bdd817 100644 --- a/JugReco/src/components/ImagingPixelDataSorter.cpp +++ b/JugReco/src/components/ImagingPixelDataSorter.cpp @@ -42,7 +42,7 @@ namespace Jug::Reco { * \ingroup reco */ class ImagingPixelDataSorter : public GaudiAlgorithm { - public: + private: Gaudi::Property m_nLayers{this, "numberOfLayers", 9}; Gaudi::Property m_nHits{this, "numberOfHits", 50}; DataHandle m_inputHitCollection{"inputHitCollection", @@ -50,6 +50,7 @@ namespace Jug::Reco { DataHandle m_outputHitCollection{"outputHitCollection", Gaudi::DataHandle::Writer, this}; + public: ImagingPixelDataSorter(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { diff --git a/JugReco/src/components/ImagingPixelMerger.cpp b/JugReco/src/components/ImagingPixelMerger.cpp index 524ad868..88ec82ef 100644 --- a/JugReco/src/components/ImagingPixelMerger.cpp +++ b/JugReco/src/components/ImagingPixelMerger.cpp @@ -50,12 +50,13 @@ namespace Jug::Reco { * \ingroup reco */ class ImagingPixelMerger : public GaudiAlgorithm { -public: +private: Gaudi::Property m_etaSize{this, "etaSize", 0.001}; Gaudi::Property m_phiSize{this, "phiSize", 0.001}; DataHandle m_inputHits{"inputHits", Gaudi::DataHandle::Reader, this}; DataHandle m_outputHits{"outputHits", Gaudi::DataHandle::Writer, this}; +public: ImagingPixelMerger(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHits", m_inputHits, ""); declareProperty("outputHits", m_outputHits, ""); diff --git a/JugReco/src/components/ImagingPixelReco.cpp b/JugReco/src/components/ImagingPixelReco.cpp index 1aa7b38b..e84760a5 100644 --- a/JugReco/src/components/ImagingPixelReco.cpp +++ b/JugReco/src/components/ImagingPixelReco.cpp @@ -36,7 +36,7 @@ namespace Jug::Reco { * \ingroup reco */ class ImagingPixelReco : public GaudiAlgorithm { -public: +private: // geometry service Gaudi::Property m_geoSvcName{this, "geoServiceName", "GeoSvc"}; Gaudi::Property m_readout{this, "readoutClass", ""}; @@ -68,6 +68,7 @@ public: dd4hep::BitFieldCoder* id_dec; size_t sector_idx, layer_idx; +public: ImagingPixelReco(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHitCollection", m_inputHitCollection, ""); declareProperty("outputHitCollection", m_outputHitCollection, ""); diff --git a/JugReco/src/components/ImagingTopoCluster.cpp b/JugReco/src/components/ImagingTopoCluster.cpp index 82e9a3a0..2b84576b 100644 --- a/JugReco/src/components/ImagingTopoCluster.cpp +++ b/JugReco/src/components/ImagingTopoCluster.cpp @@ -46,7 +46,7 @@ namespace Jug::Reco { * \ingroup reco */ class ImagingTopoCluster : public GaudiAlgorithm { -public: +private: // maximum difference in layer numbers that can be considered as neighbours Gaudi::Property m_neighbourLayersRange{this, "neighbourLayersRange", 1}; // maximum distance of local (x, y) to be considered as neighbors at the same layer @@ -75,6 +75,7 @@ public: double localDistXY[2], layerDistEtaPhi[2], sectorDist; double minClusterHitEdep, minClusterCenterEdep, minClusterEdep, minClusterNhits; +public: ImagingTopoCluster(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHitCollection", m_inputHitCollection, ""); declareProperty("outputProtoClusterCollection", m_outputProtoClusterCollection, ""); diff --git a/JugReco/src/components/InclusiveKinematicsDA.cpp b/JugReco/src/components/InclusiveKinematicsDA.cpp index a23cb869..11929ba3 100644 --- a/JugReco/src/components/InclusiveKinematicsDA.cpp +++ b/JugReco/src/components/InclusiveKinematicsDA.cpp @@ -23,7 +23,7 @@ namespace Jug::Reco { class InclusiveKinematicsDA : public GaudiAlgorithm { -public: +private: DataHandle m_inputMCParticleCollection{ "MCParticles", Gaudi::DataHandle::Reader, @@ -42,6 +42,7 @@ public: SmartIF m_pidSvc; double m_proton, m_neutron, m_electron; +public: InclusiveKinematicsDA(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputMCParticles", m_inputMCParticleCollection, "MCParticles"); diff --git a/JugReco/src/components/InclusiveKinematicsElectron.cpp b/JugReco/src/components/InclusiveKinematicsElectron.cpp index f12f2a23..9e38d528 100644 --- a/JugReco/src/components/InclusiveKinematicsElectron.cpp +++ b/JugReco/src/components/InclusiveKinematicsElectron.cpp @@ -20,7 +20,7 @@ namespace Jug::Reco { class InclusiveKinematicsElectron : public GaudiAlgorithm { -public: +private: DataHandle m_inputMCParticleCollection{ "inputMCParticles", Gaudi::DataHandle::Reader, @@ -39,6 +39,7 @@ public: SmartIF m_pidSvc; double m_proton, m_neutron, m_electron; +public: InclusiveKinematicsElectron(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputMCParticles", m_inputMCParticleCollection, "MCParticles"); diff --git a/JugReco/src/components/InclusiveKinematicsJB.cpp b/JugReco/src/components/InclusiveKinematicsJB.cpp index fb78d21c..00392e5a 100644 --- a/JugReco/src/components/InclusiveKinematicsJB.cpp +++ b/JugReco/src/components/InclusiveKinematicsJB.cpp @@ -23,7 +23,7 @@ namespace Jug::Reco { class InclusiveKinematicsJB : public GaudiAlgorithm { -public: +private: DataHandle m_inputMCParticleCollection{ "inputMCParticles", Gaudi::DataHandle::Reader, @@ -42,6 +42,7 @@ public: SmartIF m_pidSvc; double m_proton, m_neutron, m_electron; +public: InclusiveKinematicsJB(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputMCParticles", m_inputMCParticleCollection, "MCParticles"); diff --git a/JugReco/src/components/InclusiveKinematicsSigma.cpp b/JugReco/src/components/InclusiveKinematicsSigma.cpp index 1983f5a9..cc714606 100644 --- a/JugReco/src/components/InclusiveKinematicsSigma.cpp +++ b/JugReco/src/components/InclusiveKinematicsSigma.cpp @@ -23,7 +23,7 @@ namespace Jug::Reco { class InclusiveKinematicsSigma : public GaudiAlgorithm { -public: +private: DataHandle m_inputMCParticleCollection{ "inputMCParticles", Gaudi::DataHandle::Reader, @@ -42,6 +42,7 @@ public: SmartIF m_pidSvc; double m_proton, m_neutron, m_electron; +public: InclusiveKinematicsSigma(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputMCParticles", m_inputMCParticleCollection, "MCParticles"); diff --git a/JugReco/src/components/InclusiveKinematicseSigma.cpp b/JugReco/src/components/InclusiveKinematicseSigma.cpp index 0cbeb289..a97df182 100644 --- a/JugReco/src/components/InclusiveKinematicseSigma.cpp +++ b/JugReco/src/components/InclusiveKinematicseSigma.cpp @@ -23,7 +23,7 @@ namespace Jug::Reco { class InclusiveKinematicseSigma : public GaudiAlgorithm { -public: +private: DataHandle m_inputMCParticleCollection{ "inputMCParticles", Gaudi::DataHandle::Reader, @@ -42,6 +42,7 @@ public: SmartIF m_pidSvc; double m_proton, m_neutron, m_electron; +public: InclusiveKinematicseSigma(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputMCParticles", m_inputMCParticleCollection, "MCParticles"); diff --git a/JugReco/src/components/ParticleCollector.cpp b/JugReco/src/components/ParticleCollector.cpp index 39d84e69..2bd46017 100644 --- a/JugReco/src/components/ParticleCollector.cpp +++ b/JugReco/src/components/ParticleCollector.cpp @@ -19,7 +19,7 @@ namespace Jug::Reco { * \ingroup reco */ class ParticleCollector : public GaudiAlgorithm { -public: +private: Gaudi::Property> m_inputParticles{this, "inputParticles", {}, "Particles to be aggregated"}; DataHandle m_outputParticles{"outputParticles", Gaudi::DataHandle::Writer, this}; diff --git a/JugReco/src/components/PhotoMultiplierReco.cpp b/JugReco/src/components/PhotoMultiplierReco.cpp index 179a4ec5..d6a28ee9 100644 --- a/JugReco/src/components/PhotoMultiplierReco.cpp +++ b/JugReco/src/components/PhotoMultiplierReco.cpp @@ -40,7 +40,7 @@ namespace Jug::Reco { * \ingroup reco */ class PhotoMultiplierReco : public GaudiAlgorithm { -public: +private: DataHandle m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this}; DataHandle m_outputHitCollection{"outputHitCollection", Gaudi::DataHandle::Writer, this}; Gaudi::Property m_timeStep{this, "timeStep", 0.0625 * ns}; @@ -50,6 +50,7 @@ public: /// Pointer to the geometry service SmartIF m_geoSvc; +public: // ill-formed: using GaudiAlgorithm::GaudiAlgorithm; PhotoMultiplierReco(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHitCollection", m_inputHitCollection, ""); diff --git a/JugReco/src/components/SimpleClustering.cpp b/JugReco/src/components/SimpleClustering.cpp index bf70edcb..a419b483 100644 --- a/JugReco/src/components/SimpleClustering.cpp +++ b/JugReco/src/components/SimpleClustering.cpp @@ -32,7 +32,7 @@ namespace Jug::Reco { * \ingroup reco */ class SimpleClustering : public GaudiAlgorithm { - public: + private: using RecHits = eicd::CalorimeterHitCollection; using ProtoClusters = eicd::ProtoClusterCollection; using Clusters = eicd::ClusterCollection; @@ -52,6 +52,7 @@ namespace Jug::Reco { // Optional handle to MC hits std::unique_ptr> m_inputMC; + public: SimpleClustering(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHitCollection", m_inputHitCollection, ""); diff --git a/JugReco/src/components/TrackerHitReconstruction.cpp b/JugReco/src/components/TrackerHitReconstruction.cpp index 2c8a14ed..d96a9cf5 100644 --- a/JugReco/src/components/TrackerHitReconstruction.cpp +++ b/JugReco/src/components/TrackerHitReconstruction.cpp @@ -41,7 +41,7 @@ namespace Jug::Reco { * \ingroup reco */ class TrackerHitReconstruction : public GaudiAlgorithm { - public: + private: Gaudi::Property m_timeResolution{this, "timeResolution", 10}; // in ns DataHandle m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this}; diff --git a/JugReco/src/components/TrackingHitsCollector.cpp b/JugReco/src/components/TrackingHitsCollector.cpp index 3258a6e9..4b835c06 100644 --- a/JugReco/src/components/TrackingHitsCollector.cpp +++ b/JugReco/src/components/TrackingHitsCollector.cpp @@ -16,7 +16,7 @@ namespace Jug::Reco { * \ingroup reco */ class TrackingHitsCollector : public GaudiAlgorithm { - public: + private: DataHandle m_trackerBarrelHits{"trackerBarrelHits", Gaudi::DataHandle::Reader, this}; DataHandle m_trackerEndcapHits{"trackerEndcapHits", Gaudi::DataHandle::Reader, this}; DataHandle m_vertexBarrelHits {"vertexBarrelHits" , Gaudi::DataHandle::Reader, this}; diff --git a/JugReco/src/components/TrackingHitsCollector2.cpp b/JugReco/src/components/TrackingHitsCollector2.cpp index c62467c6..b9dfb8cd 100644 --- a/JugReco/src/components/TrackingHitsCollector2.cpp +++ b/JugReco/src/components/TrackingHitsCollector2.cpp @@ -19,7 +19,7 @@ namespace Jug::Reco { * \ingroup reco */ class TrackingHitsCollector2 : public GaudiAlgorithm { - public: + private: Gaudi::Property> m_inputTrackingHits{this, "inputTrackingHits", {},"Tracker hits to be aggregated"}; DataHandle m_trackingHits{"trackingHits", Gaudi::DataHandle::Writer, this}; diff --git a/JugTrack/src/components/ActsTrajectoryReader.cpp b/JugTrack/src/components/ActsTrajectoryReader.cpp index 1d8f519f..c2159f5e 100644 --- a/JugTrack/src/components/ActsTrajectoryReader.cpp +++ b/JugTrack/src/components/ActsTrajectoryReader.cpp @@ -40,7 +40,7 @@ namespace Jug::Track { * \ingroup tracking */ class ActsTrajectoryReader : public GaudiAlgorithm { -public: +private: DataHandle m_inputHits{"inputHits", Gaudi::DataHandle::Reader, this}; DataHandle m_inputTrajectories{"inputActsTrajectories", Gaudi::DataHandle::Reader, this}; DataHandle m_outputTrajectories{"outputTrajectories", Gaudi::DataHandle::Writer, this}; diff --git a/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp b/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp index bfa9ec39..f2e0e8d8 100644 --- a/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp +++ b/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp @@ -26,7 +26,7 @@ namespace Jug::Reco { * \ingroup tracking */ class ConformalXYPeakProtoTracks : public GaudiAlgorithm { -public: +private: DataHandle m_inputTrackerHits{"inputTrackerHits", Gaudi::DataHandle::Reader, this}; DataHandle m_outputProtoTracks{"outputProtoTracks", Gaudi::DataHandle::Writer, this}; DataHandle m_nProtoTracks{"nProtoTracks", Gaudi::DataHandle::Writer, this}; diff --git a/JugTrack/src/components/FinderAlgoTemplate.cpp b/JugTrack/src/components/FinderAlgoTemplate.cpp index def07c71..a5a6ef2c 100644 --- a/JugTrack/src/components/FinderAlgoTemplate.cpp +++ b/JugTrack/src/components/FinderAlgoTemplate.cpp @@ -22,7 +22,7 @@ namespace Jug::Reco { * \ingroup tracking */ class FinderAlgoTemplate : public GaudiAlgorithm { -public: +private: DataHandle m_inputTrackerHits{"inputTrackerHits", Gaudi::DataHandle::Reader, this}; DataHandle m_outputProtoTracks{"outputProtoTracks", Gaudi::DataHandle::Writer, this}; diff --git a/JugTrack/src/components/HoughTransformProtoTracks.cpp b/JugTrack/src/components/HoughTransformProtoTracks.cpp index 4990e9e9..29c580c0 100644 --- a/JugTrack/src/components/HoughTransformProtoTracks.cpp +++ b/JugTrack/src/components/HoughTransformProtoTracks.cpp @@ -22,7 +22,7 @@ namespace Jug::Reco { * \ingroup tracking */ class HoughTransformProtoTracks : public GaudiAlgorithm { -public: +private: DataHandle m_inputTrackerHits{"inputTrackerHits", Gaudi::DataHandle::Reader, this}; DataHandle m_outputProtoTracks{"outputProtoTracks", Gaudi::DataHandle::Writer, this}; diff --git a/JugTrack/src/components/ParticlesFromTrackFit.cpp b/JugTrack/src/components/ParticlesFromTrackFit.cpp index 59827e2e..caac96f4 100644 --- a/JugTrack/src/components/ParticlesFromTrackFit.cpp +++ b/JugTrack/src/components/ParticlesFromTrackFit.cpp @@ -39,7 +39,7 @@ namespace Jug::Reco { * \ingroup tracking */ class ParticlesFromTrackFit : public GaudiAlgorithm { - public: + private: //DataHandle m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this}; DataHandle m_inputTrajectories{"inputTrajectories", Gaudi::DataHandle::Reader, this}; DataHandle m_outputParticles{"outputParticles", Gaudi::DataHandle::Writer, this}; diff --git a/JugTrack/src/components/ProtoTrackMatching.cpp b/JugTrack/src/components/ProtoTrackMatching.cpp index 8c1fe82f..64b0055e 100644 --- a/JugTrack/src/components/ProtoTrackMatching.cpp +++ b/JugTrack/src/components/ProtoTrackMatching.cpp @@ -22,7 +22,7 @@ namespace Jug::Reco { * \ingroup tracking */ class ProtoTrackMatching : public GaudiAlgorithm { -public: +private: DataHandle m_inputTrackerHits{"inputTrackerHits", Gaudi::DataHandle::Reader, this}; DataHandle m_initialTrackParameters{"initialTrackParameters", Gaudi::DataHandle::Reader, this}; DataHandle m_inputProtoTracks{"inputProtoTracks", Gaudi::DataHandle::Reader, this}; diff --git a/JugTrack/src/components/SingleTrackSourceLinker.cpp b/JugTrack/src/components/SingleTrackSourceLinker.cpp index 06ffde8a..ffe16f13 100644 --- a/JugTrack/src/components/SingleTrackSourceLinker.cpp +++ b/JugTrack/src/components/SingleTrackSourceLinker.cpp @@ -38,7 +38,7 @@ namespace Jug::Reco { * \ingroup tracking */ class SingleTrackSourceLinker : public GaudiAlgorithm { -public: +private: DataHandle m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this}; DataHandle> m_sourceLinkStorage{"sourceLinkStorage", Gaudi::DataHandle::Writer, this}; DataHandle m_outputSourceLinks{"outputSourceLinks", Gaudi::DataHandle::Writer, this}; diff --git a/JugTrack/src/components/TrackParamClusterInit.cpp b/JugTrack/src/components/TrackParamClusterInit.cpp index 0bbf3a87..cc75847f 100644 --- a/JugTrack/src/components/TrackParamClusterInit.cpp +++ b/JugTrack/src/components/TrackParamClusterInit.cpp @@ -40,7 +40,7 @@ namespace Jug::Reco { * \ingroup tracking */ class TrackParamClusterInit : public GaudiAlgorithm { -public: +private: using Clusters = eicd::ClusterCollection; DataHandle m_inputClusters{"inputClusters", Gaudi::DataHandle::Reader, this}; diff --git a/JugTrack/src/components/TrackParamImagingClusterInit.cpp b/JugTrack/src/components/TrackParamImagingClusterInit.cpp index 0fd9d23c..23489b2e 100644 --- a/JugTrack/src/components/TrackParamImagingClusterInit.cpp +++ b/JugTrack/src/components/TrackParamImagingClusterInit.cpp @@ -40,7 +40,7 @@ namespace Jug::Reco { * \ingroup tracking */ class TrackParamImagingClusterInit : public GaudiAlgorithm { - public: + private: using ImagingClusters = eicd::ClusterCollection; DataHandle m_inputClusters{"inputClusters", Gaudi::DataHandle::Reader, this}; diff --git a/JugTrack/src/components/TrackParamTruthInit.cpp b/JugTrack/src/components/TrackParamTruthInit.cpp index 6c782fd7..f52ebfc6 100644 --- a/JugTrack/src/components/TrackParamTruthInit.cpp +++ b/JugTrack/src/components/TrackParamTruthInit.cpp @@ -41,7 +41,7 @@ namespace Jug::Reco { * \ingroup tracking */ class TrackParamTruthInit : public GaudiAlgorithm { - public: + private: DataHandle m_inputMCParticles{"inputMCParticles", Gaudi::DataHandle::Reader, this}; DataHandle m_outputInitialTrackParameters{"outputInitialTrackParameters", diff --git a/JugTrack/src/components/TrackParamVertexClusterInit.cpp b/JugTrack/src/components/TrackParamVertexClusterInit.cpp index b7abc181..f1a9969b 100644 --- a/JugTrack/src/components/TrackParamVertexClusterInit.cpp +++ b/JugTrack/src/components/TrackParamVertexClusterInit.cpp @@ -33,7 +33,7 @@ namespace Jug::Reco { * \ingroup tracking */ class TrackParamVertexClusterInit : public GaudiAlgorithm { -public: +private: using Clusters = eicd::ClusterCollection; using VertexHits = eicd::TrackerHitCollection; diff --git a/JugTrack/src/components/TrackerSourceLinker.cpp b/JugTrack/src/components/TrackerSourceLinker.cpp index 04170192..6a76872b 100644 --- a/JugTrack/src/components/TrackerSourceLinker.cpp +++ b/JugTrack/src/components/TrackerSourceLinker.cpp @@ -40,7 +40,7 @@ namespace Jug::Reco { * \ingroup tracking */ class TrackerSourceLinker : public GaudiAlgorithm { -public: +private: DataHandle m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this}; DataHandle> m_sourceLinkStorage{"sourceLinkStorage", Gaudi::DataHandle::Writer, this}; DataHandle m_outputSourceLinks{"outputSourceLinks", Gaudi::DataHandle::Writer, this}; diff --git a/JugTrack/src/components/TrackingHitsSourceLinker.cpp b/JugTrack/src/components/TrackingHitsSourceLinker.cpp index 921f3b1c..803b4b2e 100644 --- a/JugTrack/src/components/TrackingHitsSourceLinker.cpp +++ b/JugTrack/src/components/TrackingHitsSourceLinker.cpp @@ -36,7 +36,7 @@ namespace Jug::Reco { * \ingroup tracking */ class TrackingHitsSourceLinker : public GaudiAlgorithm { - public: + private: using TrkHits = eicd::TrackerHitCollection; Gaudi::Property> m_inputs{this, "inputTrackerCollections", {}, "List of intput tracker hit collections"}; diff --git a/JugTrack/src/components/TruthTrackSeeding.cpp b/JugTrack/src/components/TruthTrackSeeding.cpp index d1070dfb..6c44b6cf 100644 --- a/JugTrack/src/components/TruthTrackSeeding.cpp +++ b/JugTrack/src/components/TruthTrackSeeding.cpp @@ -31,7 +31,7 @@ namespace Jug::Reco { * \ingroup tracking */ class TruthTrackSeeding : public GaudiAlgorithm { - public: + private: DataHandle m_inputMCParticles{"inputMCParticles", Gaudi::DataHandle::Reader, this}; DataHandle m_outputTrackParameters{"outputTrackParameters", -- GitLab From 3f9aab5ef9a047bf450b666c9ebeb6a77e4d5edf Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 21:43:04 -0500 Subject: [PATCH 16/29] bugprone-reserved-identifier: avoid statics starting with _ --- JugBase/src/components/GeoSvc.cpp | 6 +++--- JugTrack/src/components/CKFTracking.cpp | 6 +++--- JugTrack/src/components/TrackFindingAlgorithm.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/JugBase/src/components/GeoSvc.cpp b/JugBase/src/components/GeoSvc.cpp index 8cf59d0f..782bf88b 100644 --- a/JugBase/src/components/GeoSvc.cpp +++ b/JugBase/src/components/GeoSvc.cpp @@ -29,7 +29,7 @@ #include "TGeoMaterialInterface.h" #include "PlanarMeasurement.h" -static const std::map _msgMap = { +static const std::map s_msgMap = { {MSG::DEBUG, Acts::Logging::DEBUG}, {MSG::VERBOSE, Acts::Logging::VERBOSE}, {MSG::INFO, Acts::Logging::INFO}, @@ -134,8 +134,8 @@ StatusCode GeoSvc::initialize() { } // Set ACTS logging level - auto im = _msgMap.find(msgLevel()); - if (im != _msgMap.end()) { + auto im = s_msgMap.find(msgLevel()); + if (im != s_msgMap.end()) { m_actsLoggingLevel = im->second; } diff --git a/JugTrack/src/components/CKFTracking.cpp b/JugTrack/src/components/CKFTracking.cpp index 9169973f..7ba11272 100644 --- a/JugTrack/src/components/CKFTracking.cpp +++ b/JugTrack/src/components/CKFTracking.cpp @@ -46,7 +46,7 @@ #include -static const std::map _msgMap = { +static const std::map s_msgMap = { {MSG::DEBUG, Acts::Logging::DEBUG}, {MSG::VERBOSE, Acts::Logging::VERBOSE}, {MSG::INFO, Acts::Logging::INFO}, @@ -98,8 +98,8 @@ namespace Jug::Reco { }, }; m_trackFinderFunc = CKFTracking::makeCKFTrackingFunction(m_geoSvc->trackingGeometry(), m_BField); - auto im = _msgMap.find(msgLevel()); - if (im != _msgMap.end()) { + auto im = s_msgMap.find(msgLevel()); + if (im != s_msgMap.end()) { m_actsLoggingLevel = im->second; } return StatusCode::SUCCESS; diff --git a/JugTrack/src/components/TrackFindingAlgorithm.cpp b/JugTrack/src/components/TrackFindingAlgorithm.cpp index 87ee96bb..40634be0 100644 --- a/JugTrack/src/components/TrackFindingAlgorithm.cpp +++ b/JugTrack/src/components/TrackFindingAlgorithm.cpp @@ -46,7 +46,7 @@ #include -static const std::map _msgMap = { +static const std::map s_msgMap = { {MSG::DEBUG, Acts::Logging::DEBUG}, {MSG::VERBOSE, Acts::Logging::VERBOSE}, {MSG::INFO, Acts::Logging::INFO}, @@ -99,8 +99,8 @@ namespace Jug::Reco { }, }; m_trackFinderFunc = TrackFindingAlgorithm::makeTrackFinderFunction(m_geoSvc->trackingGeometry(), m_BField); - auto im = _msgMap.find(msgLevel()); - if (im != _msgMap.end()) { + auto im = s_msgMap.find(msgLevel()); + if (im != s_msgMap.end()) { m_actsLoggingLevel = im->second; } return StatusCode::SUCCESS; -- GitLab From 6b09a42500c227c7534eaf3ed5e950fa6eef5bba Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 21:45:58 -0500 Subject: [PATCH 17/29] modernize-loop-convert: for (const auto& hit : hits) --- JugFast/src/components/TruthClustering.cpp | 3 +-- JugTrack/src/components/ParticlesFromTrackFit.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/JugFast/src/components/TruthClustering.cpp b/JugFast/src/components/TruthClustering.cpp index 1aa17cfb..922b2f08 100644 --- a/JugFast/src/components/TruthClustering.cpp +++ b/JugFast/src/components/TruthClustering.cpp @@ -63,8 +63,7 @@ public: std::map protoIndex; // Loop over al calorimeter hits and sort per mcparticle - for (uint32_t i = 0; i < hits.size(); ++i) { - const auto& hit = hits[i]; + for (const auto& hit : hits) { const auto& mcHit = mc[hit.getObjectID().index]; const auto& trackID = mcHit.getContributions(0).getParticle().id(); // Create a new protocluster if we don't have one for this trackID diff --git a/JugTrack/src/components/ParticlesFromTrackFit.cpp b/JugTrack/src/components/ParticlesFromTrackFit.cpp index caac96f4..c46d2737 100644 --- a/JugTrack/src/components/ParticlesFromTrackFit.cpp +++ b/JugTrack/src/components/ParticlesFromTrackFit.cpp @@ -73,8 +73,7 @@ namespace Jug::Reco { } // Loop over the trajectories - for (size_t itraj = 0; itraj < trajectories->size(); ++itraj) { - const auto& traj = (*trajectories)[itraj]; + for (const auto& traj : *trajectories) { // Get the entry index for the single trajectory // The trajectory entry indices and the multiTrajectory -- GitLab From 8bb5105a05f33bd0885a106bd9ddd385896edb2d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 21:58:15 -0500 Subject: [PATCH 18/29] readability-implicit-bool-conversion: compare with nullptr or 0 --- JugBase/src/PodioDataSvc.cpp | 4 ++-- JugBase/src/Utilities/Helpers.cpp | 2 +- JugBase/src/components/GeoSvc.cpp | 8 ++++---- JugBase/src/components/PodioInput.cpp | 2 +- JugBase/src/components/PodioOutput.cpp | 6 +++--- JugFast/src/components/TruthClustering.cpp | 2 +- JugReco/src/components/CalorimeterHitReco.cpp | 4 ++-- JugReco/src/components/CalorimeterIslandCluster.cpp | 2 +- JugReco/src/components/ImagingClusterReco.cpp | 2 +- JugReco/src/components/ImagingTopoCluster.cpp | 2 +- JugReco/src/components/TrackingHitsCollector.cpp | 2 +- JugTrack/src/components/TrackParamClusterInit.cpp | 2 +- JugTrack/src/components/TrackParamImagingClusterInit.cpp | 2 +- JugTrack/src/components/TrackParamTruthInit.cpp | 2 +- JugTrack/src/components/TrackParamVertexClusterInit.cpp | 2 +- JugTrack/src/components/TruthTrackSeeding.cpp | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/JugBase/src/PodioDataSvc.cpp b/JugBase/src/PodioDataSvc.cpp index cf6383e5..d8c96523 100644 --- a/JugBase/src/PodioDataSvc.cpp +++ b/JugBase/src/PodioDataSvc.cpp @@ -109,9 +109,9 @@ StatusCode PodioDataSvc::readCollection(const std::string& collectionName, int c StatusCode PodioDataSvc::registerObject(std::string_view parentPath, std::string_view fullPath, DataObject* pObject) { auto* wrapper = dynamic_cast(pObject); - if (wrapper) { + if (wrapper != nullptr) { podio::CollectionBase* coll = wrapper->collectionBase(); - if (coll) { + if (coll != nullptr) { const size_t pos = fullPath.find_last_of("/"); const std::string shortPath(fullPath.substr(pos + 1, fullPath.length())); const int id = m_collectionIDs->add(shortPath); diff --git a/JugBase/src/Utilities/Helpers.cpp b/JugBase/src/Utilities/Helpers.cpp index 801cac54..84191223 100644 --- a/JugBase/src/Utilities/Helpers.cpp +++ b/JugBase/src/Utilities/Helpers.cpp @@ -45,7 +45,7 @@ void anaHisto(TH1D* inputHist, int j, TH1F* meanHist, TH1F* widthHist) { assert(inputHist != nullptr); if (inputHist->GetEntries() > 0) { TFitResultPtr r = inputHist->Fit("gaus", "QS0"); - if (r.Get() and ((r->Status() % 1000) == 0)) { + if (r.Get() != nullptr and ((r->Status() % 1000) == 0)) { // fill the mean and width into 'j'th bin of the meanHist and widthHist, // respectively meanHist->SetBinContent(j, r->Parameter(1)); diff --git a/JugBase/src/components/GeoSvc.cpp b/JugBase/src/components/GeoSvc.cpp index 782bf88b..c1b68a10 100644 --- a/JugBase/src/components/GeoSvc.cpp +++ b/JugBase/src/components/GeoSvc.cpp @@ -45,7 +45,7 @@ void draw_surfaces(std::shared_ptr trk_geo, const trk_geo->visitSurfaces([&](const Acts::Surface* surface) { // for now we just require a valid surface - if (not surface) { + if (surface == nullptr) { std::cout << " Not a surface \n"; return; } @@ -83,7 +83,7 @@ GeoSvc::GeoSvc(const std::string& name, ISvcLocator* svc) , m_log(msgSvc(), name) {} GeoSvc::~GeoSvc() { - if (m_dd4hepGeo) { + if (m_dd4hepGeo != nullptr) { try { m_dd4hepGeo->destroyInstance(); m_dd4hepGeo = 0; @@ -178,14 +178,14 @@ StatusCode GeoSvc::initialize() { debug() << "visiting all the surfaces " << endmsg; m_trackingGeo->visitSurfaces([this](const Acts::Surface* surface) { // for now we just require a valid surface - if (not surface) { + if (surface == nullptr) { info() << "no surface??? " << endmsg; return; } const auto* det_element = dynamic_cast(surface->associatedDetectorElement()); - if (!det_element) { + if (det_element != nullptr) { error() << "invalid det_element!!! " << endmsg; return; } diff --git a/JugBase/src/components/PodioInput.cpp b/JugBase/src/components/PodioInput.cpp index 4c10b601..c818e9fd 100644 --- a/JugBase/src/components/PodioInput.cpp +++ b/JugBase/src/components/PodioInput.cpp @@ -18,7 +18,7 @@ StatusCode PodioInput::initialize() { // check whether we have the PodioEvtSvc active m_podioDataSvc = dynamic_cast(evtSvc().get()); - if (!m_podioDataSvc) { + if (m_podioDataSvc == nullptr) { return StatusCode::FAILURE; } diff --git a/JugBase/src/components/PodioOutput.cpp b/JugBase/src/components/PodioOutput.cpp index 28103a0f..00f747e4 100644 --- a/JugBase/src/components/PodioOutput.cpp +++ b/JugBase/src/components/PodioOutput.cpp @@ -18,7 +18,7 @@ StatusCode PodioOutput::initialize() { // check whether we have the PodioEvtSvc active m_podioDataSvc = dynamic_cast(evtSvc().get()); - if (!m_podioDataSvc) { + if (m_podioDataSvc == nullptr) { error() << "Failed to get the DataSvc" << endmsg; return StatusCode::FAILURE; } @@ -49,7 +49,7 @@ void PodioOutput::resetBranches(const std::vectorSetBranchAddress(collName.c_str(), data); auto* colls = references; - if (colls) { + if (colls != nullptr) { for (size_t j = 0; j < colls->size(); ++j) { const auto brName = podio::root_utils::refBranch(collName, j); auto* l_branch = m_datatree->GetBranch(brName.c_str()); @@ -57,7 +57,7 @@ void PodioOutput::resetBranches(const std::vector(m_capADC.value()) * dyRangeADC / m_sampFrac; const float time = rh.getTimeStamp() / stepTDC; const auto cellID = rh.getCellID(); - const int lid = id_dec && !m_layerField.value().empty() ? static_cast(id_dec->get(cellID, layer_idx)) : -1; - const int sid = id_dec && !m_sectorField.value().empty() ? static_cast(id_dec->get(cellID, sector_idx)) : -1; + const int lid = id_dec != nullptr && !m_layerField.value().empty() ? static_cast(id_dec->get(cellID, layer_idx)) : -1; + const int sid = id_dec != nullptr && !m_sectorField.value().empty() ? static_cast(id_dec->get(cellID, sector_idx)) : -1; // global positions const auto gpos = converter->position(cellID); // local positions diff --git a/JugReco/src/components/CalorimeterIslandCluster.cpp b/JugReco/src/components/CalorimeterIslandCluster.cpp index 5ef2f349..ade647da 100644 --- a/JugReco/src/components/CalorimeterIslandCluster.cpp +++ b/JugReco/src/components/CalorimeterIslandCluster.cpp @@ -150,7 +150,7 @@ public: // set coordinate system auto set_dist_method = [this](const Gaudi::Property>& uprop) { - if (not uprop.size()) { + if (uprop.size() == 0) { return false; } auto& [method, units] = distMethods[uprop.name()]; diff --git a/JugReco/src/components/ImagingClusterReco.cpp b/JugReco/src/components/ImagingClusterReco.cpp index 93324538..7f22df52 100644 --- a/JugReco/src/components/ImagingClusterReco.cpp +++ b/JugReco/src/components/ImagingClusterReco.cpp @@ -140,7 +140,7 @@ private: for (unsigned i = 0; i < hits.size(); ++i) { const auto hit = hits[i]; auto lid = hit.getLayer(); - if (!layer_map.count(lid)) { + if (layer_map.count(lid) == 0) { layer_map[lid] = {}; } layer_map[lid].push_back({hit, weights[i]}); diff --git a/JugReco/src/components/ImagingTopoCluster.cpp b/JugReco/src/components/ImagingTopoCluster.cpp index 2b84576b..f2a29b9d 100644 --- a/JugReco/src/components/ImagingTopoCluster.cpp +++ b/JugReco/src/components/ImagingTopoCluster.cpp @@ -191,7 +191,7 @@ private: // layer check int ldiff = std::abs(h1.getLayer() - h2.getLayer()); // same layer, check local positions - if (!ldiff) { + if (ldiff == 0) { return (std::abs(h1.getLocal().x - h2.getLocal().x) <= localDistXY[0]) && (std::abs(h1.getLocal().y - h2.getLocal().y) <= localDistXY[1]); } else if (ldiff <= m_neighbourLayersRange) { diff --git a/JugReco/src/components/TrackingHitsCollector.cpp b/JugReco/src/components/TrackingHitsCollector.cpp index 4b835c06..287e7027 100644 --- a/JugReco/src/components/TrackingHitsCollector.cpp +++ b/JugReco/src/components/TrackingHitsCollector.cpp @@ -52,7 +52,7 @@ namespace Jug::Reco { auto* outputHits = m_outputHitCollection.createAndPut(); for (const auto* hits : {trkBarrelHits, trkEndcapHits, vtxBarrelHits, vtxEndcapHits, gemEndcapHits}) { - if (hits) { + if (hits != nullptr) { for (const auto& ahit : *hits) { auto new_hit = ahit.clone(); outputHits->push_back(ahit.clone()); diff --git a/JugTrack/src/components/TrackParamClusterInit.cpp b/JugTrack/src/components/TrackParamClusterInit.cpp index cc75847f..2a6018fb 100644 --- a/JugTrack/src/components/TrackParamClusterInit.cpp +++ b/JugTrack/src/components/TrackParamClusterInit.cpp @@ -58,7 +58,7 @@ public: return StatusCode::FAILURE; } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); - if (!randSvc) { + if (randSvc == nullptr) { return StatusCode::FAILURE; } return StatusCode::SUCCESS; diff --git a/JugTrack/src/components/TrackParamImagingClusterInit.cpp b/JugTrack/src/components/TrackParamImagingClusterInit.cpp index 23489b2e..78367723 100644 --- a/JugTrack/src/components/TrackParamImagingClusterInit.cpp +++ b/JugTrack/src/components/TrackParamImagingClusterInit.cpp @@ -59,7 +59,7 @@ namespace Jug::Reco { return StatusCode::FAILURE; } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); - if(!randSvc) { + if (randSvc == nullptr) { return StatusCode::FAILURE; } return StatusCode::SUCCESS; diff --git a/JugTrack/src/components/TrackParamTruthInit.cpp b/JugTrack/src/components/TrackParamTruthInit.cpp index f52ebfc6..fa45cf47 100644 --- a/JugTrack/src/components/TrackParamTruthInit.cpp +++ b/JugTrack/src/components/TrackParamTruthInit.cpp @@ -69,7 +69,7 @@ namespace Jug::Reco { return StatusCode::FAILURE; } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); - if (!randSvc) { + if (randSvc == nullptr) { return StatusCode::FAILURE; } m_pidSvc = service("ParticleSvc"); diff --git a/JugTrack/src/components/TrackParamVertexClusterInit.cpp b/JugTrack/src/components/TrackParamVertexClusterInit.cpp index f1a9969b..5c143d62 100644 --- a/JugTrack/src/components/TrackParamVertexClusterInit.cpp +++ b/JugTrack/src/components/TrackParamVertexClusterInit.cpp @@ -55,7 +55,7 @@ public: return StatusCode::FAILURE; } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); - if (!randSvc) { + if (randSvc == nullptr) { return StatusCode::FAILURE; } return StatusCode::SUCCESS; diff --git a/JugTrack/src/components/TruthTrackSeeding.cpp b/JugTrack/src/components/TruthTrackSeeding.cpp index 6c44b6cf..5bffd3b9 100644 --- a/JugTrack/src/components/TruthTrackSeeding.cpp +++ b/JugTrack/src/components/TruthTrackSeeding.cpp @@ -49,7 +49,7 @@ namespace Jug::Reco { return StatusCode::FAILURE; } IRndmGenSvc* randSvc = svc("RndmGenSvc", true); - if (!randSvc) { + if (randSvc == nullptr) { return StatusCode::FAILURE; } m_pidSvc = service("ParticleSvc"); -- GitLab From 2a04f361b078f7b989ffd23c12376256cd540c4f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 22:12:28 -0500 Subject: [PATCH 19/29] cppcoreguidelines-pro-type-member-init --- JugBase/src/components/PodioInput.cpp | 3 ++- JugBase/src/components/PodioOutput.cpp | 4 +++- JugDigi/src/components/CalorimeterBirksCorr.cpp | 2 +- JugDigi/src/components/CalorimeterHitDigi.cpp | 7 +++---- JugFast/src/components/InclusiveKinematicsTruth.cpp | 4 ++-- JugReco/src/components/CalorimeterHitReco.cpp | 8 ++++---- JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp | 2 +- JugReco/src/components/CalorimeterHitsMerger.cpp | 2 +- JugReco/src/components/CalorimeterIslandCluster.cpp | 5 +++-- JugReco/src/components/ClusterRecoCoG.cpp | 2 +- JugReco/src/components/EnergyPositionClusterMerger.cpp | 4 ++-- JugReco/src/components/FarForwardParticles.cpp | 2 +- JugReco/src/components/ImagingPixelReco.cpp | 4 ++-- JugReco/src/components/ImagingTopoCluster.cpp | 4 ++-- 14 files changed, 28 insertions(+), 25 deletions(-) diff --git a/JugBase/src/components/PodioInput.cpp b/JugBase/src/components/PodioInput.cpp index c818e9fd..1c5a807f 100644 --- a/JugBase/src/components/PodioInput.cpp +++ b/JugBase/src/components/PodioInput.cpp @@ -9,7 +9,8 @@ // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) DECLARE_COMPONENT(PodioInput) -PodioInput::PodioInput(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) {} +PodioInput::PodioInput(const std::string& name, ISvcLocator* svcLoc) +: GaudiAlgorithm(name, svcLoc),m_podioDataSvc(nullptr) {} StatusCode PodioInput::initialize() { if (GaudiAlgorithm::initialize().isFailure()) { diff --git a/JugBase/src/components/PodioOutput.cpp b/JugBase/src/components/PodioOutput.cpp index 00f747e4..eefd45fe 100644 --- a/JugBase/src/components/PodioOutput.cpp +++ b/JugBase/src/components/PodioOutput.cpp @@ -9,7 +9,9 @@ DECLARE_COMPONENT(PodioOutput) PodioOutput::PodioOutput(const std::string& name, ISvcLocator* svcLoc) - : GaudiAlgorithm(name, svcLoc), m_firstEvent(true) {} + : GaudiAlgorithm(name, svcLoc), m_firstEvent(true), + m_podioDataSvc(nullptr), m_datatree(nullptr), m_metadatatree(nullptr), + m_runMDtree(nullptr), m_evtMDtree(nullptr), m_colMDtree(nullptr) {} StatusCode PodioOutput::initialize() { if (GaudiAlgorithm::initialize().isFailure()) { diff --git a/JugDigi/src/components/CalorimeterBirksCorr.cpp b/JugDigi/src/components/CalorimeterBirksCorr.cpp index 2203a823..8ecaeb4a 100644 --- a/JugDigi/src/components/CalorimeterBirksCorr.cpp +++ b/JugDigi/src/components/CalorimeterBirksCorr.cpp @@ -44,7 +44,7 @@ namespace Jug::Digi { SmartIF m_pidSvc; // unitless conterpart of arguments - double birksConstant; + double birksConstant{0}; // ill-formed: using GaudiAlgorithm::GaudiAlgorithm; CalorimeterBirksCorr(const std::string& name, ISvcLocator* svcLoc) diff --git a/JugDigi/src/components/CalorimeterHitDigi.cpp b/JugDigi/src/components/CalorimeterHitDigi.cpp index 05538cfe..d3df0cea 100644 --- a/JugDigi/src/components/CalorimeterHitDigi.cpp +++ b/JugDigi/src/components/CalorimeterHitDigi.cpp @@ -70,10 +70,10 @@ namespace Jug::Digi { Gaudi::Property m_readout{this, "readoutClass", ""}; // unitless counterparts of inputs - double dyRangeADC, stepTDC, tRes, eRes[3] = {0., 0., 0.}; + double dyRangeADC{0}, stepTDC{0}, tRes{0}, eRes[3] = {0., 0., 0.}; Rndm::Numbers m_normDist; SmartIF m_geoSvc; - uint64_t id_mask, ref_mask; + uint64_t id_mask{0}, ref_mask{0}; DataHandle m_inputHitCollection{ "inputHitCollection", Gaudi::DataHandle::Reader, this}; @@ -82,8 +82,7 @@ namespace Jug::Digi { // ill-formed: using GaudiAlgorithm::GaudiAlgorithm; CalorimeterHitDigi(const std::string& name, ISvcLocator* svcLoc) - : GaudiAlgorithm(name, svcLoc) - { + : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHitCollection", m_inputHitCollection, ""); declareProperty("outputHitCollection", m_outputHitCollection, ""); } diff --git a/JugFast/src/components/InclusiveKinematicsTruth.cpp b/JugFast/src/components/InclusiveKinematicsTruth.cpp index dab2132d..3b37f46c 100644 --- a/JugFast/src/components/InclusiveKinematicsTruth.cpp +++ b/JugFast/src/components/InclusiveKinematicsTruth.cpp @@ -25,8 +25,8 @@ private: Gaudi::DataHandle::Writer, this}; SmartIF m_pidSvc; - double m_proton; - double m_neutron; + double m_proton{0}; + double m_neutron{0}; public: InclusiveKinematicsTruth(const std::string& name, ISvcLocator* svcLoc) diff --git a/JugReco/src/components/CalorimeterHitReco.cpp b/JugReco/src/components/CalorimeterHitReco.cpp index 85c09ec1..42aa9385 100644 --- a/JugReco/src/components/CalorimeterHitReco.cpp +++ b/JugReco/src/components/CalorimeterHitReco.cpp @@ -55,9 +55,9 @@ private: Gaudi::Property m_sampFrac{this, "samplingFraction", 1.0}; // unitless counterparts of the input parameters - double dyRangeADC; - double thresholdADC; - double stepTDC; + double dyRangeADC{0}; + double thresholdADC{0}; + double stepTDC{0}; DataHandle m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this}; @@ -71,7 +71,7 @@ private: Gaudi::Property m_sectorField{this, "sectorField", ""}; SmartIF m_geoSvc; dd4hep::BitFieldCoder* id_dec = nullptr; - size_t sector_idx, layer_idx; + size_t sector_idx{0}, layer_idx{0}; // name of detelment or fields to find the local detector (for global->local transform) // if nothing is provided, the lowest level DetElement (from cellID) will be used diff --git a/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp b/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp index cfb3ca8a..991ab749 100644 --- a/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp +++ b/JugReco/src/components/CalorimeterHitsEtaPhiProjector.cpp @@ -62,7 +62,7 @@ private: DataHandle m_outputHitCollection{"outputHitCollection", Gaudi::DataHandle::Writer, this}; - double gridSizes[2]; + double gridSizes[2]{0.0, 0.0}; public: CalorimeterHitsEtaPhiProjector(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { diff --git a/JugReco/src/components/CalorimeterHitsMerger.cpp b/JugReco/src/components/CalorimeterHitsMerger.cpp index 9f1ff286..e84b21cb 100644 --- a/JugReco/src/components/CalorimeterHitsMerger.cpp +++ b/JugReco/src/components/CalorimeterHitsMerger.cpp @@ -55,7 +55,7 @@ private: this}; SmartIF m_geoSvc; - uint64_t id_mask, ref_mask; + uint64_t id_mask{0}, ref_mask{0}; public: CalorimeterHitsMerger(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { diff --git a/JugReco/src/components/CalorimeterIslandCluster.cpp b/JugReco/src/components/CalorimeterIslandCluster.cpp index ade647da..f4bee7d2 100644 --- a/JugReco/src/components/CalorimeterIslandCluster.cpp +++ b/JugReco/src/components/CalorimeterIslandCluster.cpp @@ -110,7 +110,7 @@ namespace Jug::Reco { * \ingroup reco */ class CalorimeterIslandCluster : public GaudiAlgorithm { -public: +private: Gaudi::Property m_splitCluster{this, "splitCluster", true}; Gaudi::Property m_minClusterHitEdep{this, "minClusterHitEdep", 0.}; Gaudi::Property m_minClusterCenterEdep{this, "minClusterCenterEdep", 50.0 * MeV}; @@ -130,9 +130,10 @@ public: std::function hitsDist; // unitless counterparts of the input parameters - double minClusterHitEdep, minClusterCenterEdep, sectorDist; + double minClusterHitEdep{0}, minClusterCenterEdep{0}, sectorDist{0}; std::array neighbourDist = {0., 0.}; +public: CalorimeterIslandCluster(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { declareProperty("inputHitCollection", m_inputHitCollection, ""); declareProperty("outputProtoClusterCollection", m_outputProtoCollection, ""); diff --git a/JugReco/src/components/ClusterRecoCoG.cpp b/JugReco/src/components/ClusterRecoCoG.cpp index 8742920e..3273cca9 100644 --- a/JugReco/src/components/ClusterRecoCoG.cpp +++ b/JugReco/src/components/ClusterRecoCoG.cpp @@ -78,7 +78,7 @@ private: // Pointer to the geometry service SmartIF m_geoSvc; - double m_depthCorr; + double m_depthCorr{0}; std::function weightFunc; public: diff --git a/JugReco/src/components/EnergyPositionClusterMerger.cpp b/JugReco/src/components/EnergyPositionClusterMerger.cpp index bb390e4a..0c402629 100644 --- a/JugReco/src/components/EnergyPositionClusterMerger.cpp +++ b/JugReco/src/components/EnergyPositionClusterMerger.cpp @@ -43,8 +43,8 @@ private: Gaudi::Property m_phiToleranceUnits{this, "phiTolerance", 20 * degree}; Gaudi::Property m_energyRelTolerance{this, "energyRelTolerance", 0.3}; // Unitless (GeV/mm/ns/rad) versions of these tolerances - double m_zTolerance; - double m_phiTolerance; + double m_zTolerance{0}; + double m_phiTolerance{0}; public: EnergyPositionClusterMerger(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { diff --git a/JugReco/src/components/FarForwardParticles.cpp b/JugReco/src/components/FarForwardParticles.cpp index f8778b43..828dfb59 100644 --- a/JugReco/src/components/FarForwardParticles.cpp +++ b/JugReco/src/components/FarForwardParticles.cpp @@ -43,7 +43,7 @@ private: Gaudi::Property m_sectorField{this, "sectorField", ""}; SmartIF m_geoSvc; dd4hep::BitFieldCoder* id_dec = nullptr; - size_t sector_idx, layer_idx; + size_t sector_idx{0}, layer_idx{0}; Gaudi::Property m_localDetElement{this, "localDetElement", ""}; Gaudi::Property> u_localDetFields{this, "localDetFields", {}}; diff --git a/JugReco/src/components/ImagingPixelReco.cpp b/JugReco/src/components/ImagingPixelReco.cpp index e84760a5..0f325d12 100644 --- a/JugReco/src/components/ImagingPixelReco.cpp +++ b/JugReco/src/components/ImagingPixelReco.cpp @@ -54,7 +54,7 @@ private: Gaudi::Property m_sampFrac{this, "samplingFraction", 1.0}; // unitless counterparts for the input parameters - double dyRangeADC; + double dyRangeADC{0}; // hits containers DataHandle m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, @@ -66,7 +66,7 @@ private: SmartIF m_geoSvc; // visit readout fields dd4hep::BitFieldCoder* id_dec; - size_t sector_idx, layer_idx; + size_t sector_idx{0}, layer_idx{0}; public: ImagingPixelReco(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { diff --git a/JugReco/src/components/ImagingTopoCluster.cpp b/JugReco/src/components/ImagingTopoCluster.cpp index f2a29b9d..81f1046a 100644 --- a/JugReco/src/components/ImagingTopoCluster.cpp +++ b/JugReco/src/components/ImagingTopoCluster.cpp @@ -72,8 +72,8 @@ private: Gaudi::DataHandle::Writer, this}; // unitless counterparts of the input parameters - double localDistXY[2], layerDistEtaPhi[2], sectorDist; - double minClusterHitEdep, minClusterCenterEdep, minClusterEdep, minClusterNhits; + double localDistXY[2]{0,0}, layerDistEtaPhi[2]{0,0}, sectorDist{0}; + double minClusterHitEdep{0}, minClusterCenterEdep{0}, minClusterEdep{0}, minClusterNhits{0}; public: ImagingTopoCluster(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { -- GitLab From 435866b4bc70f01d6e73e039f0c0e2fcba045aa9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 22:19:00 -0500 Subject: [PATCH 20/29] modernize-use-emplace instead of push_back --- JugDigi/src/components/CalorimeterHitDigi.cpp | 2 +- JugFast/src/components/SmearedFarForwardParticles.cpp | 8 ++++---- JugReco/src/components/CalorimeterHitReco.cpp | 2 +- JugReco/src/components/CalorimeterHitsMerger.cpp | 2 +- JugReco/src/components/CalorimeterIslandCluster.cpp | 4 ++-- JugReco/src/components/FarForwardParticles.cpp | 2 +- JugReco/src/components/ImagingTopoCluster.cpp | 2 +- JugReco/src/components/SimpleClustering.cpp | 6 +++--- JugTrack/src/components/ConformalXYPeakProtoTracks.cpp | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/JugDigi/src/components/CalorimeterHitDigi.cpp b/JugDigi/src/components/CalorimeterHitDigi.cpp index d3df0cea..4e6d516a 100644 --- a/JugDigi/src/components/CalorimeterHitDigi.cpp +++ b/JugDigi/src/components/CalorimeterHitDigi.cpp @@ -133,7 +133,7 @@ namespace Jug::Digi { id_mask |= id_desc.field(u_fields[i])->mask(); // use the provided id number to find ref cell, or use 0 int ref = i < u_refs.size() ? u_refs[i] : 0; - ref_fields.push_back({u_fields[i], ref}); + ref_fields.emplace_back(u_fields[i], ref); } ref_mask = id_desc.encode(ref_fields); // debug() << fmt::format("Referece id mask for the fields {:#064b}", ref_mask) << endmsg; diff --git a/JugFast/src/components/SmearedFarForwardParticles.cpp b/JugFast/src/components/SmearedFarForwardParticles.cpp index adb317eb..99461250 100644 --- a/JugFast/src/components/SmearedFarForwardParticles.cpp +++ b/JugFast/src/components/SmearedFarForwardParticles.cpp @@ -207,7 +207,7 @@ private: assoc.setRec(rec_part); // rec_part.mcID(); - rc.push_back({rec_part, assoc}); + rc.emplace_back(rec_part, assoc); if (msgLevel(MSG::DEBUG)) { const auto& part_p = part.getMomentum(); @@ -251,7 +251,7 @@ private: rc_part.setEnergy(0); } rc_part.setType(kTagB0); - rc.push_back({rc_part, assoc}); + rc.emplace_back(rc_part, assoc); if (msgLevel(MSG::DEBUG)) { const auto& part_p = part.getMomentum(); const auto part_p_pt = eicd::magnitudeTransverse(part_p); @@ -290,7 +290,7 @@ private: } auto [rc_part, assoc] = smearMomentum(part); rc_part.setType(kTagRP); - rc.push_back({rc_part, assoc}); + rc.emplace_back(rc_part, assoc); if (msgLevel(MSG::DEBUG)) { const auto& part_p = part.getMomentum(); const auto part_p_pt = eicd::magnitudeTransverse(part_p); @@ -326,7 +326,7 @@ private: } auto [rc_part, assoc] = smearMomentum(part); rc_part.setType(kTagOMD); - rc.push_back({rc_part, assoc}); + rc.emplace_back(rc_part, assoc); if (msgLevel(MSG::DEBUG)) { const auto& part_p = part.getMomentum(); const auto part_p_pt = eicd::magnitudeTransverse(part_p); diff --git a/JugReco/src/components/CalorimeterHitReco.cpp b/JugReco/src/components/CalorimeterHitReco.cpp index 42aa9385..8924afe7 100644 --- a/JugReco/src/components/CalorimeterHitReco.cpp +++ b/JugReco/src/components/CalorimeterHitReco.cpp @@ -141,7 +141,7 @@ public: } else { std::vector> fields; for (auto& f : u_localDetFields.value()) { - fields.push_back({f, 0}); + fields.emplace_back(f, 0); } local_mask = id_spec.get_mask(fields); // use all fields if nothing provided diff --git a/JugReco/src/components/CalorimeterHitsMerger.cpp b/JugReco/src/components/CalorimeterHitsMerger.cpp index e84b21cb..4cccc7d2 100644 --- a/JugReco/src/components/CalorimeterHitsMerger.cpp +++ b/JugReco/src/components/CalorimeterHitsMerger.cpp @@ -88,7 +88,7 @@ public: id_mask |= id_desc.field(u_fields[i])->mask(); // use the provided id number to find ref cell, or use 0 int ref = i < u_refs.size() ? u_refs[i] : 0; - ref_fields.push_back({u_fields[i], ref}); + ref_fields.emplace_back(u_fields[i], ref); } ref_mask = id_desc.encode(ref_fields); // debug() << fmt::format("Referece id mask for the fields {:#064b}", ref_mask) << endmsg; diff --git a/JugReco/src/components/CalorimeterIslandCluster.cpp b/JugReco/src/components/CalorimeterIslandCluster.cpp index f4bee7d2..ab3fe2a0 100644 --- a/JugReco/src/components/CalorimeterIslandCluster.cpp +++ b/JugReco/src/components/CalorimeterIslandCluster.cpp @@ -263,7 +263,7 @@ private: return; } - group.push_back({idx, hits[idx]}); + group.emplace_back(idx, hits[idx]); visits[idx] = true; for (size_t i = 0; i < hits.size(); ++i) { if (visits[i] || !is_neighbour(hits[idx], hits[i])) { @@ -359,7 +359,7 @@ private: std::vector weights(maxima.size(), 1.); std::vector pcls; for (size_t k = 0; k < maxima.size(); ++k) { - pcls.push_back({}); + pcls.emplace_back(); } size_t i = 0; diff --git a/JugReco/src/components/FarForwardParticles.cpp b/JugReco/src/components/FarForwardParticles.cpp index 828dfb59..df3c25e9 100644 --- a/JugReco/src/components/FarForwardParticles.cpp +++ b/JugReco/src/components/FarForwardParticles.cpp @@ -114,7 +114,7 @@ public: } else { std::vector> fields; for (auto& f : u_localDetFields.value()) { - fields.push_back({f, 0}); + fields.emplace_back(f, 0); } local_mask = id_spec.get_mask(fields); // use all fields if nothing provided diff --git a/JugReco/src/components/ImagingTopoCluster.cpp b/JugReco/src/components/ImagingTopoCluster.cpp index 81f1046a..a70c66ce 100644 --- a/JugReco/src/components/ImagingTopoCluster.cpp +++ b/JugReco/src/components/ImagingTopoCluster.cpp @@ -213,7 +213,7 @@ private: return; } - group.push_back({idx, hits[idx]}); + group.emplace_back(idx, hits[idx]); visits[idx] = true; for (size_t i = 0; i < hits.size(); ++i) { // visited, or not a neighbor diff --git a/JugReco/src/components/SimpleClustering.cpp b/JugReco/src/components/SimpleClustering.cpp index a419b483..d394d953 100644 --- a/JugReco/src/components/SimpleClustering.cpp +++ b/JugReco/src/components/SimpleClustering.cpp @@ -110,7 +110,7 @@ namespace Jug::Reco { ref_hit = h; have_ref = true; } - the_hits.push_back({idx, h}); + the_hits.emplace_back(idx, h); idx += 1; } } @@ -125,9 +125,9 @@ namespace Jug::Reco { for (const auto& [idx, h] : the_hits) { if (eicd::magnitude(h.getPosition() - ref_hit.getPosition()) < max_dist) { - cluster_hits.push_back({idx, h}); + cluster_hits.emplace_back(idx, h); } else { - remaining_hits.push_back({idx, h}); + remaining_hits.emplace_back(idx, h); } } diff --git a/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp b/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp index f2e0e8d8..7c232d1c 100644 --- a/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp +++ b/JugTrack/src/components/ConformalXYPeakProtoTracks.cpp @@ -68,7 +68,7 @@ public: double xc = ahit.getPosition().x - ref_hit.x(); double yc = ahit.getPosition().y - ref_hit.y(); double r = std::hypot(xc, yc); - conformal_hits.push_back({2.0*xc/r,2.0*yc/r}); + conformal_hits.emplace_back(2.0*xc/r,2.0*yc/r); h_phi.Fill(conformal_hits.back().phi()); } // 3. Get location of maxima -- GitLab From e9a66dd4564ec21506e07bb59649072f4208ef63 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 22:21:58 -0500 Subject: [PATCH 21/29] readability-qualified-auto --- JugTrack/src/components/TrackerSourceLinker.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/JugTrack/src/components/TrackerSourceLinker.cpp b/JugTrack/src/components/TrackerSourceLinker.cpp index 6a76872b..763ff7a8 100644 --- a/JugTrack/src/components/TrackerSourceLinker.cpp +++ b/JugTrack/src/components/TrackerSourceLinker.cpp @@ -77,9 +77,9 @@ public: // input collection const eicd::TrackerHitCollection* hits = m_inputHitCollection.get(); // Create output collections - auto linkStorage = m_sourceLinkStorage.createAndPut(); - auto sourceLinks = m_outputSourceLinks.createAndPut(); - auto measurements = m_outputMeasurements.createAndPut(); + auto* linkStorage = m_sourceLinkStorage.createAndPut(); + auto* sourceLinks = m_outputSourceLinks.createAndPut(); + auto* measurements = m_outputMeasurements.createAndPut(); sourceLinks->reserve(hits->size()); measurements->reserve(hits->size()); @@ -96,8 +96,8 @@ public: debug() << "cov matrix:\n" << cov << endmsg; } - auto vol_ctx = m_geoSvc->cellIDPositionConverter()->findContext(ahit.getCellID()); - auto vol_id = vol_ctx->identifier; + const auto* vol_ctx = m_geoSvc->cellIDPositionConverter()->findContext(ahit.getCellID()); + auto vol_id = vol_ctx->identifier; const auto is = m_geoSvc->surfaceMap().find(vol_id); if (is == m_geoSvc->surfaceMap().end()) { -- GitLab From 5972724b55f0d68e567b97cdc03a17775caf298b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 22:28:53 -0500 Subject: [PATCH 22/29] readability-convert-member-functions-to-static --- JugReco/src/components/CalorimeterIslandCluster.cpp | 2 +- JugReco/src/components/ImagingClusterReco.cpp | 4 ++-- JugReco/src/components/ImagingPixelMerger.cpp | 10 +++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/JugReco/src/components/CalorimeterIslandCluster.cpp b/JugReco/src/components/CalorimeterIslandCluster.cpp index ab3fe2a0..f1b7caa3 100644 --- a/JugReco/src/components/CalorimeterIslandCluster.cpp +++ b/JugReco/src/components/CalorimeterIslandCluster.cpp @@ -322,7 +322,7 @@ private: } // helper function - inline void vec_normalize(std::vector& vals) const { + inline static void vec_normalize(std::vector& vals) { double total = 0.; for (auto& val : vals) { total += val; diff --git a/JugReco/src/components/ImagingClusterReco.cpp b/JugReco/src/components/ImagingClusterReco.cpp index 7f22df52..6ea87d03 100644 --- a/JugReco/src/components/ImagingClusterReco.cpp +++ b/JugReco/src/components/ImagingClusterReco.cpp @@ -132,7 +132,7 @@ public: private: template static inline T pow2(const T& x) { return x * x; } - std::vector reconstruct_cluster_layers(const eicd::ProtoCluster& pcl) const { + static std::vector reconstruct_cluster_layers(const eicd::ProtoCluster& pcl) { const auto& hits = pcl.getHits(); const auto& weights = pcl.getWeights(); // using map to have hits sorted by layer @@ -155,7 +155,7 @@ private: return cl_layers; } - eicd::Cluster reconstruct_layer(const std::vector>& hits) const { + static eicd::Cluster reconstruct_layer(const std::vector>& hits) { eicd::MutableCluster layer; layer.setType(ClusterType::kClusterSlice); // Calculate averages diff --git a/JugReco/src/components/ImagingPixelMerger.cpp b/JugReco/src/components/ImagingPixelMerger.cpp index 88ec82ef..1dbbfd31 100644 --- a/JugReco/src/components/ImagingPixelMerger.cpp +++ b/JugReco/src/components/ImagingPixelMerger.cpp @@ -147,9 +147,13 @@ public: } private: - int pos2grid(float pos, float size, float offset = 0.) const { return std::floor((pos - offset) / size); } - int grid2pos(float grid, float size, float offset = 0.) const { return (grid + 0.5) * size + offset; } - float cotan(float theta) const { + static int pos2grid(float pos, float size, float offset = 0.) { + return std::floor((pos - offset) / size); + } + static int grid2pos(float grid, float size, float offset = 0.) { + return (grid + 0.5) * size + offset; + } + static float cotan(float theta) { if (std::abs(std::sin(theta)) < 1e-6) { return 0.; } else { -- GitLab From 95c46403fe264c0a93b267732d5ea250675890ed Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 22:31:52 -0500 Subject: [PATCH 23/29] Fix to 8bb5105a05f33bd0885a106bd9ddd385896edb2d --- JugBase/src/components/GeoSvc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JugBase/src/components/GeoSvc.cpp b/JugBase/src/components/GeoSvc.cpp index c1b68a10..49170876 100644 --- a/JugBase/src/components/GeoSvc.cpp +++ b/JugBase/src/components/GeoSvc.cpp @@ -185,7 +185,7 @@ StatusCode GeoSvc::initialize() { const auto* det_element = dynamic_cast(surface->associatedDetectorElement()); - if (det_element != nullptr) { + if (det_element == nullptr) { error() << "invalid det_element!!! " << endmsg; return; } -- GitLab From 0a860ff2066fd90da874d26497bfba774f42139b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 22:58:09 -0500 Subject: [PATCH 24/29] readability-uppercase-literal-suffix --- JugBase/src/Utilities/Paths.cpp | 2 +- .../components/TrackerHitReconstruction.cpp | 2 +- JugTrack/src/components/TruthTrackSeeding.cpp | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/JugBase/src/Utilities/Paths.cpp b/JugBase/src/Utilities/Paths.cpp index cc4d3bff..00fab6d0 100644 --- a/JugBase/src/Utilities/Paths.cpp +++ b/JugBase/src/Utilities/Paths.cpp @@ -106,7 +106,7 @@ std::pair Jug::determineEventFilesRange( // should only occur if no files matched and the initial values persisted. if (eventMax < eventMin) { - return std::make_pair(0u, 0u); + return std::make_pair(0U, 0U); } return std::make_pair(eventMin, eventMax + 1); } diff --git a/JugReco/src/components/TrackerHitReconstruction.cpp b/JugReco/src/components/TrackerHitReconstruction.cpp index d96a9cf5..90a669c6 100644 --- a/JugReco/src/components/TrackerHitReconstruction.cpp +++ b/JugReco/src/components/TrackerHitReconstruction.cpp @@ -111,7 +111,7 @@ namespace Jug::Reco { static_cast(ahit.getTimeStamp() / 1000), // ns m_timeResolution, // in ns static_cast(ahit.getCharge() / 1.0e6), // Collected energy (GeV) - 0.0f}; // Error on the energy + 0.0F}; // Error on the energy rec_hits->push_back(hit); } return StatusCode::SUCCESS; diff --git a/JugTrack/src/components/TruthTrackSeeding.cpp b/JugTrack/src/components/TruthTrackSeeding.cpp index 5bffd3b9..231c2c84 100644 --- a/JugTrack/src/components/TruthTrackSeeding.cpp +++ b/JugTrack/src/components/TruthTrackSeeding.cpp @@ -90,16 +90,16 @@ namespace Jug::Reco { const auto q_over_p = charge / p; - eicd::TrackParameters params{-1, // type --> seed (-1) - {0.0f, 0.0f}, // location on surface - {0.1, 0.1, 0.1}, // Covariance on location - theta, // theta (rad) - phi, // phi (rad) - q_over_p * .05f, // Q/P (e/GeV) - {0.1, 0.1, 0.1}, // Covariance on theta/phi/Q/P - part.getTime(), // Time (ns) - 0.1, // Error on time - charge}; // Charge + eicd::TrackParameters params{-1, // type --> seed (-1) + {0.0F, 0.0F}, // location on surface + {0.1, 0.1, 0.1}, // Covariance on location + theta, // theta (rad) + phi, // phi (rad) + q_over_p * .05F, // Q/P (e/GeV) + {0.1, 0.1, 0.1}, // Covariance on theta/phi/Q/P + part.getTime(), // Time (ns) + 0.1, // Error on time + charge}; // Charge ////// Construct a perigee surface as the target surface //auto pSurface = Acts::Surface::makeShared( -- GitLab From 176ce891b6a55cb656d7e5cb846e69422b107df8 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 23:13:39 -0500 Subject: [PATCH 25/29] Disable cppcoreguidelines-avoid-magic-numbers test --- .clang-tidy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index 42649476..7f2ef9d3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -9,6 +9,7 @@ Checks: ' -modernize-use-trailing-return-type, -modernize-avoid-c-arrays, -modernize-use-nodiscard, - -readability-magic-numbers + -readability-magic-numbers. + -cppcoreguidelines-avoid-magic-numbers ' FormatStyle: file -- GitLab From b9dcfcd53d8d8e6ab61e01f7b85bb33b4e6c20dc Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 23:24:30 -0500 Subject: [PATCH 26/29] Use GSL --- CMakeLists.txt | 2 ++ JugBase/src/Utilities/Helpers.cpp | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 278e3bec..77fe13ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,8 @@ if(ENABLE_CLANG_TIDY) endif() endif() +find_package(Microsoft.GSL CONFIG) + find_package(EICD REQUIRED) find_package(EDM4HEP 0.4.1 REQUIRED) diff --git a/JugBase/src/Utilities/Helpers.cpp b/JugBase/src/Utilities/Helpers.cpp index 84191223..4d47fb0d 100644 --- a/JugBase/src/Utilities/Helpers.cpp +++ b/JugBase/src/Utilities/Helpers.cpp @@ -8,11 +8,13 @@ #include "JugBase/Utilities/Helpers.hpp" +#include + namespace Jug::PlotHelpers { TH1F* bookHisto(const char* histName, const char* histTitle, const Binning& varBinning) { - TH1F* hist = new TH1F(histName, histTitle, varBinning.nBins, varBinning.min, - varBinning.max); + gsl::owner hist = new TH1F(histName, histTitle, varBinning.nBins, varBinning.min, + varBinning.max); hist->GetXaxis()->SetTitle(varBinning.title.c_str()); hist->GetYaxis()->SetTitle("Entries"); hist->Sumw2(); @@ -21,9 +23,9 @@ TH1F* bookHisto(const char* histName, const char* histTitle, TH2F* bookHisto(const char* histName, const char* histTitle, const Binning& varXBinning, const Binning& varYBinning) { - TH2F* hist = new TH2F(histName, histTitle, varXBinning.nBins, varXBinning.min, - varXBinning.max, varYBinning.nBins, varYBinning.min, - varYBinning.max); + gsl::owner hist = new TH2F(histName, histTitle, varXBinning.nBins, varXBinning.min, + varXBinning.max, varYBinning.nBins, varYBinning.min, + varYBinning.max); hist->GetXaxis()->SetTitle(varXBinning.title.c_str()); hist->GetYaxis()->SetTitle(varYBinning.title.c_str()); hist->Sumw2(); -- GitLab From bc262d3c25291c0ee143389522788c45846ce53d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 23:26:13 -0500 Subject: [PATCH 27/29] Type on .clang-tidy --- .clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index 7f2ef9d3..8d55f1f3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -9,7 +9,7 @@ Checks: ' -modernize-use-trailing-return-type, -modernize-avoid-c-arrays, -modernize-use-nodiscard, - -readability-magic-numbers. + -readability-magic-numbers, -cppcoreguidelines-avoid-magic-numbers ' FormatStyle: file -- GitLab From 8a0073d96a7feeb10625ff66b6531afe25316722 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 23 Mar 2022 23:49:14 -0500 Subject: [PATCH 28/29] gsl::owner around TTree* in podio in/output --- JugBase/src/components/PodioOutput.cpp | 8 ++++---- JugBase/src/components/PodioOutput.h | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/JugBase/src/components/PodioOutput.cpp b/JugBase/src/components/PodioOutput.cpp index eefd45fe..18d23dc6 100644 --- a/JugBase/src/components/PodioOutput.cpp +++ b/JugBase/src/components/PodioOutput.cpp @@ -74,8 +74,8 @@ void PodioOutput::resetBranches(const std::vector>& collections) { // collectionID, collection type, subset collection - auto* collectionInfo = new std::vector>(); - collectionInfo->reserve(collections.size()); + std::vector> collectionInfo; + collectionInfo.reserve(collections.size()); for (const auto& [collName, collBuffers] : collections) { auto buffers = collBuffers->getBuffers(); @@ -113,14 +113,14 @@ void PodioOutput::createBranches(const std::vectorgetCollectionIDs()->collectionID(collName); const auto collType = collBuffers->getValueTypeName() + "Collection"; - collectionInfo->emplace_back(collID, std::move(collType), collBuffers->isSubsetCollection()); + collectionInfo.emplace_back(collID, std::move(collType), collBuffers->isSubsetCollection()); debug() << isOn << " Registering collection " << collClassName << " " << collName.c_str() << " containing type " << className << endmsg; collBuffers->prepareForWrite(); } - m_metadatatree->Branch("CollectionTypeInfo", collectionInfo); + m_metadatatree->Branch("CollectionTypeInfo", &collectionInfo); } StatusCode PodioOutput::execute() { diff --git a/JugBase/src/components/PodioOutput.h b/JugBase/src/components/PodioOutput.h index 8ae67b72..3bd8e216 100644 --- a/JugBase/src/components/PodioOutput.h +++ b/JugBase/src/components/PodioOutput.h @@ -8,6 +8,7 @@ #include "TTree.h" #include +#include // forward declarations class TFile; @@ -46,12 +47,12 @@ private: /// The actual ROOT file std::unique_ptr m_file; /// The tree to be filled with collections - TTree* m_datatree; + gsl::owner m_datatree; /// The tree to be filled with meta data - TTree* m_metadatatree; - TTree* m_runMDtree; - TTree* m_evtMDtree; - TTree* m_colMDtree; + gsl::owner m_metadatatree; + gsl::owner m_runMDtree; + gsl::owner m_evtMDtree; + gsl::owner m_colMDtree; /// The stored collections std::vector m_storedCollections; }; -- GitLab From 2c0fd127eb1cd186d757a05768a8f50656c8dd3e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 24 Mar 2022 09:21:00 -0500 Subject: [PATCH 29/29] Revert 8a0073d96a7feeb10625ff66b6531afe25316722 for PodioOutput --- JugBase/src/components/PodioOutput.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/JugBase/src/components/PodioOutput.cpp b/JugBase/src/components/PodioOutput.cpp index 18d23dc6..eefd45fe 100644 --- a/JugBase/src/components/PodioOutput.cpp +++ b/JugBase/src/components/PodioOutput.cpp @@ -74,8 +74,8 @@ void PodioOutput::resetBranches(const std::vector>& collections) { // collectionID, collection type, subset collection - std::vector> collectionInfo; - collectionInfo.reserve(collections.size()); + auto* collectionInfo = new std::vector>(); + collectionInfo->reserve(collections.size()); for (const auto& [collName, collBuffers] : collections) { auto buffers = collBuffers->getBuffers(); @@ -113,14 +113,14 @@ void PodioOutput::createBranches(const std::vectorgetCollectionIDs()->collectionID(collName); const auto collType = collBuffers->getValueTypeName() + "Collection"; - collectionInfo.emplace_back(collID, std::move(collType), collBuffers->isSubsetCollection()); + collectionInfo->emplace_back(collID, std::move(collType), collBuffers->isSubsetCollection()); debug() << isOn << " Registering collection " << collClassName << " " << collName.c_str() << " containing type " << className << endmsg; collBuffers->prepareForWrite(); } - m_metadatatree->Branch("CollectionTypeInfo", &collectionInfo); + m_metadatatree->Branch("CollectionTypeInfo", collectionInfo); } StatusCode PodioOutput::execute() { -- GitLab