From c83597c6710ab27165ca43dcaa46cf7fea41f34d Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Sun, 20 Oct 2024 10:32:12 +0200 Subject: [PATCH] refactor: explicit constructors (non-core) (#3761) --- .../Algorithms/Alignment/src/AlignmentAlgorithmFunction.cpp | 2 +- .../ActsExamples/Digitization/DigitizationConfig.hpp | 2 +- .../Algorithms/Digitization/src/MeasurementCreation.cpp | 3 ++- .../include/ActsExamples/Geant4/MaterialPhysicsList.hpp | 6 +++--- .../include/ActsExamples/Geant4/PhysicsListFactory.hpp | 2 +- .../include/ActsExamples/Geant4/SteppingActionList.hpp | 2 +- Examples/Algorithms/Geant4HepMC/src/EventAction.hpp | 2 +- Examples/Algorithms/Geant4HepMC/src/SteppingAction.hpp | 2 +- .../ActsExamples/Generators/MultiplicityGenerators.hpp | 4 ++-- .../ActsExamples/Generators/ParametricParticleGenerator.cpp | 4 ++-- .../ActsExamples/Generators/ParametricParticleGenerator.hpp | 2 +- .../ActsExamples/Generators/Pythia8ProcessGenerator.cpp | 6 ++++-- .../ActsExamples/Propagation/PropagatorInterface.hpp | 2 +- .../TrackFinding/src/TrackFindingAlgorithmFunction.cpp | 2 +- .../Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp | 3 ++- .../include/ActsExamples/DD4hepDetector/DD4hepDetector.hpp | 3 ++- .../ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp | 2 +- .../include/ActsExamples/MagneticField/ScalableBField.hpp | 2 +- .../MuonSpectrometerMockupDetector/MockupSectorBuilder.hpp | 2 +- .../include/ActsExamples/TGeoDetector/TGeoDetector.hpp | 2 +- Examples/Framework/ML/src/NeuralCalibrator.cpp | 3 ++- .../include/ActsExamples/EventData/Measurement.hpp | 6 +++--- .../include/ActsExamples/EventData/ScalingCalibrator.hpp | 2 +- .../Framework/include/ActsExamples/EventData/SimVertex.hpp | 5 +++-- .../include/ActsExamples/EventData/SpacePointContainer.hpp | 6 ++++-- .../include/ActsExamples/Framework/RandomNumbers.hpp | 2 +- .../Framework/include/ActsExamples/Framework/Sequencer.hpp | 2 +- .../Framework/include/ActsExamples/Framework/WhiteBoard.hpp | 2 +- .../Framework/include/ActsExamples/Utilities/tbbWrap.hpp | 2 +- Examples/Framework/src/EventData/MeasurementCalibration.cpp | 3 ++- Examples/Framework/src/EventData/ScalingCalibrator.cpp | 3 ++- Examples/Framework/src/Framework/Sequencer.cpp | 2 +- Examples/HelloWorld/HelloLoggerAlgorithm.hpp | 2 +- .../Io/Csv/include/ActsExamples/Io/Csv/CsvInputOutput.hpp | 2 +- .../Io/Root/detail/NuclearInteractionParametrisation.hpp | 2 +- Examples/Io/Root/src/RootVertexReader.cpp | 2 +- Examples/Io/Root/src/VertexNTupleWriter.cpp | 5 +++-- Examples/Scripts/TrackingPerformance/TreeReader.h | 2 +- Fatras/include/ActsFatras/Utilities/LandauDistribution.hpp | 2 +- .../include/Acts/Plugins/DD4hep/DD4hepDetectorStructure.hpp | 6 +++--- .../Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp | 2 +- .../include/Acts/Plugins/DD4hep/DD4hepFieldAdapter.hpp | 2 +- .../Detray/include/Acts/Plugins/Detray/DetrayConverter.hpp | 5 +++-- .../Acts/Plugins/Geant4/Geant4PhysicalVolumeSelectors.hpp | 2 +- .../Acts/Plugins/Json/GeometryHierarchyMapJsonConverter.hpp | 2 +- .../include/Acts/Plugins/Podio/PodioDynamicColumns.hpp | 5 +++-- 46 files changed, 74 insertions(+), 60 deletions(-) diff --git a/Examples/Algorithms/Alignment/src/AlignmentAlgorithmFunction.cpp b/Examples/Algorithms/Alignment/src/AlignmentAlgorithmFunction.cpp index d36a6df9b95..de6780d817b 100644 --- a/Examples/Algorithms/Alignment/src/AlignmentAlgorithmFunction.cpp +++ b/Examples/Algorithms/Alignment/src/AlignmentAlgorithmFunction.cpp @@ -31,7 +31,7 @@ struct AlignmentFunctionImpl : public ActsExamples::AlignmentAlgorithm::AlignmentFunction { Alignment align; - AlignmentFunctionImpl(Alignment&& a) : align(std::move(a)) {} + explicit AlignmentFunctionImpl(Alignment&& a) : align(std::move(a)) {} ActsExamples::AlignmentAlgorithm::AlignmentResult operator()( const std::vector>& diff --git a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/DigitizationConfig.hpp b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/DigitizationConfig.hpp index 3521d0bef7d..6a933f50075 100644 --- a/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/DigitizationConfig.hpp +++ b/Examples/Algorithms/Digitization/include/ActsExamples/Digitization/DigitizationConfig.hpp @@ -130,7 +130,7 @@ class DigitizationConfig { bool doMerge, double mergeNsigma, bool mergeCommonCorner, Acts::GeometryHierarchyMap &&digiCfgs); - DigitizationConfig( + explicit DigitizationConfig( Acts::GeometryHierarchyMap &&digiCfgs); /// Input collection of simulated hits. diff --git a/Examples/Algorithms/Digitization/src/MeasurementCreation.cpp b/Examples/Algorithms/Digitization/src/MeasurementCreation.cpp index 9d5169ca6c9..066901cc0cf 100644 --- a/Examples/Algorithms/Digitization/src/MeasurementCreation.cpp +++ b/Examples/Algorithms/Digitization/src/MeasurementCreation.cpp @@ -30,6 +30,7 @@ ActsExamples::VariableBoundMeasurementProxy ActsExamples::createMeasurement( return Acts::visit_measurement( dParams.indices.size(), [&](auto dim) -> VariableBoundMeasurementProxy { auto [indices, par, cov] = measurementConstituents(dParams); - return container.emplaceMeasurement(geometryId, indices, par, cov); + return VariableBoundMeasurementProxy{ + container.emplaceMeasurement(geometryId, indices, par, cov)}; }); } diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialPhysicsList.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialPhysicsList.hpp index b53567b77a0..9cfb45d0453 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialPhysicsList.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/MaterialPhysicsList.hpp @@ -29,9 +29,9 @@ class MaterialPhysicsList final : public G4VUserPhysicsList { /// /// @param cfg the configuration struct for this Stepping action /// @param logger is an Acts::Logger for unique logging - MaterialPhysicsList(std::unique_ptr logger = - Acts::getDefaultLogger("MaterialPhysicsList", - Acts::Logging::INFO)); + explicit MaterialPhysicsList(std::unique_ptr logger = + Acts::getDefaultLogger("MaterialPhysicsList", + Acts::Logging::INFO)); ~MaterialPhysicsList() override = default; /// @brief Interface particle construction method diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/PhysicsListFactory.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/PhysicsListFactory.hpp index d3c4b9f33c2..6bbc39b4f04 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/PhysicsListFactory.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/PhysicsListFactory.hpp @@ -28,7 +28,7 @@ class PhysicsListFactoryFunction final : public PhysicsListFactory { public: using Function = std::function()>; - PhysicsListFactoryFunction(Function function); + explicit PhysicsListFactoryFunction(Function function); std::unique_ptr factorize() const final; diff --git a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SteppingActionList.hpp b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SteppingActionList.hpp index 569914007d8..b4a6d7e5d68 100644 --- a/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SteppingActionList.hpp +++ b/Examples/Algorithms/Geant4/include/ActsExamples/Geant4/SteppingActionList.hpp @@ -28,7 +28,7 @@ class SteppingActionList : public G4UserSteppingAction { std::vector> actions; }; - SteppingActionList(const Config &cfg) : m_cfg(cfg) {} + explicit SteppingActionList(const Config &cfg) : m_cfg(cfg) {} void UserSteppingAction(const G4Step *step) override { for (const auto &action : m_cfg.actions) { diff --git a/Examples/Algorithms/Geant4HepMC/src/EventAction.hpp b/Examples/Algorithms/Geant4HepMC/src/EventAction.hpp index 5c078e21cf8..dcf82b9543f 100644 --- a/Examples/Algorithms/Geant4HepMC/src/EventAction.hpp +++ b/Examples/Algorithms/Geant4HepMC/src/EventAction.hpp @@ -28,7 +28,7 @@ class EventAction final : public G4UserEventAction { static EventAction* instance(); /// Construct the action and ensure singleton usage. - EventAction(std::vector processFilter); + explicit EventAction(std::vector processFilter); ~EventAction() override; /// Interface method for begin of the event diff --git a/Examples/Algorithms/Geant4HepMC/src/SteppingAction.hpp b/Examples/Algorithms/Geant4HepMC/src/SteppingAction.hpp index 51144f3e83c..c19ed0a8560 100644 --- a/Examples/Algorithms/Geant4HepMC/src/SteppingAction.hpp +++ b/Examples/Algorithms/Geant4HepMC/src/SteppingAction.hpp @@ -20,7 +20,7 @@ namespace ActsExamples::Geant4::HepMC3 { /// Collects the particles history. class SteppingAction : public G4UserSteppingAction { public: - SteppingAction(std::vector eventRejectionProcess); + explicit SteppingAction(std::vector eventRejectionProcess); ~SteppingAction() override; /// Static access method to the instance diff --git a/Examples/Algorithms/Generators/ActsExamples/Generators/MultiplicityGenerators.hpp b/Examples/Algorithms/Generators/ActsExamples/Generators/MultiplicityGenerators.hpp index 42290a5e471..32c6d708235 100644 --- a/Examples/Algorithms/Generators/ActsExamples/Generators/MultiplicityGenerators.hpp +++ b/Examples/Algorithms/Generators/ActsExamples/Generators/MultiplicityGenerators.hpp @@ -19,7 +19,7 @@ struct FixedMultiplicityGenerator : public EventGenerator::MultiplicityGenerator { std::size_t n = 1; - FixedMultiplicityGenerator(std::size_t _n) : n{_n} {} + explicit FixedMultiplicityGenerator(std::size_t _n) : n{_n} {} FixedMultiplicityGenerator() = default; std::size_t operator()(RandomEngine& /*rng*/) const override { return n; } @@ -28,7 +28,7 @@ struct FixedMultiplicityGenerator struct PoissonMultiplicityGenerator : public EventGenerator::MultiplicityGenerator { double mean = 1; - PoissonMultiplicityGenerator(double _mean) : mean{_mean} {} + explicit PoissonMultiplicityGenerator(double _mean) : mean{_mean} {} PoissonMultiplicityGenerator() = default; std::size_t operator()(RandomEngine& rng) const override { diff --git a/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.cpp b/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.cpp index 104c8c0f04d..1e4e227df09 100644 --- a/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.cpp +++ b/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.cpp @@ -64,8 +64,8 @@ ParametricParticleGenerator::operator()(RandomEngine& rng) { SimParticleContainer::sequence_type particles; // create the primary vertex - auto& primaryVertex = - vertices.emplace_back(0, SimVertex::Vector4(0., 0., 0., 0.)); + auto& primaryVertex = vertices.emplace_back( + SimVertexBarcode{0}, SimVertex::Vector4(0., 0., 0., 0.)); // counter will be reused as barcode particle number which must be non-zero. for (std::size_t ip = 1; ip <= m_cfg.numParticles; ++ip) { diff --git a/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.hpp b/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.hpp index 3bb8ff9d836..a7d9bfe3e08 100644 --- a/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.hpp +++ b/Examples/Algorithms/Generators/ActsExamples/Generators/ParametricParticleGenerator.hpp @@ -64,7 +64,7 @@ class ParametricParticleGenerator : public EventGenerator::ParticlesGenerator { std::optional mass; }; - ParametricParticleGenerator(const Config& cfg); + explicit ParametricParticleGenerator(const Config& cfg); /// Generate a single primary vertex with the given number of particles. std::pair operator()( diff --git a/Examples/Algorithms/GeneratorsPythia8/ActsExamples/Generators/Pythia8ProcessGenerator.cpp b/Examples/Algorithms/GeneratorsPythia8/ActsExamples/Generators/Pythia8ProcessGenerator.cpp index e19e785ac5c..ae7c2b85403 100644 --- a/Examples/Algorithms/GeneratorsPythia8/ActsExamples/Generators/Pythia8ProcessGenerator.cpp +++ b/Examples/Algorithms/GeneratorsPythia8/ActsExamples/Generators/Pythia8ProcessGenerator.cpp @@ -121,7 +121,8 @@ Pythia8Generator::operator()(RandomEngine& rng) { } // create the primary vertex - vertices.emplace_back(0, SimVertex::Vector4(0., 0., 0., 0.)); + vertices.emplace_back(SimVertexBarcode{0}, + SimVertex::Vector4(0., 0., 0., 0.)); // convert generated final state particles into internal format for (int ip = 0; ip < m_pythia8->event.size(); ++ip) { @@ -166,7 +167,8 @@ Pythia8Generator::operator()(RandomEngine& rng) { } else { // no matching secondary vertex exists -> create new one particleId.setVertexSecondary(vertices.size()); - auto& vertex = vertices.emplace_back(particleId.vertexId(), pos4); + auto& vertex = vertices.emplace_back( + static_cast(particleId.vertexId()), pos4); vertex.outgoing.insert(particleId); ACTS_VERBOSE("created new secondary vertex " << pos4.transpose()); } diff --git a/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp b/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp index c063a2a1a48..2aa3b2292ac 100644 --- a/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp +++ b/Examples/Algorithms/Propagation/include/ActsExamples/Propagation/PropagatorInterface.hpp @@ -50,7 +50,7 @@ class PropagatorInterface { template class ConcretePropagator : public PropagatorInterface { public: - ConcretePropagator(propagator_t propagator) + explicit ConcretePropagator(propagator_t propagator) : m_propagator{std::move(propagator)} {} Acts::Result execute( diff --git a/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithmFunction.cpp b/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithmFunction.cpp index 65e0cf41970..e9f6ae315f3 100644 --- a/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithmFunction.cpp +++ b/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithmFunction.cpp @@ -35,7 +35,7 @@ struct TrackFinderFunctionImpl : public ActsExamples::TrackFindingAlgorithm::TrackFinderFunction { CKF trackFinder; - TrackFinderFunctionImpl(CKF&& f) : trackFinder(std::move(f)) {} + explicit TrackFinderFunctionImpl(CKF&& f) : trackFinder(std::move(f)) {} ActsExamples::TrackFindingAlgorithm::TrackFinderResult operator()( const ActsExamples::TrackParameters& initialParameters, diff --git a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp index 9ef72913e37..5330e55c76c 100644 --- a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp +++ b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp @@ -249,7 +249,8 @@ ProcessCode AdaptiveMultiVertexFinderAlgorithm::execute( // Count the number of particles associated with each vertex std::size_t particleCount = 0; for (const auto& particle : truthParticles) { - if (particle.particleId().vertexId() == truthVertex.vertexId()) { + if (static_cast(particle.particleId().vertexId()) == + truthVertex.vertexId()) { ++particleCount; } } diff --git a/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepDetector.hpp b/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepDetector.hpp index fec8cfdd052..015b511825f 100644 --- a/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepDetector.hpp +++ b/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepDetector.hpp @@ -52,7 +52,8 @@ struct DD4hepDetector { DD4hepDetector() = default; /// @brief Constructor from geometry service /// @param _geometryService the geometry service - DD4hepDetector(std::shared_ptr _geometryService); + explicit DD4hepDetector( + std::shared_ptr _geometryService); /// @brief Default destructor ~DD4hepDetector() = default; diff --git a/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp b/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp index 6fb17141814..9ce1ca5f2e9 100644 --- a/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp +++ b/Examples/Detectors/DD4hepDetector/include/ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp @@ -87,7 +87,7 @@ class DD4hepGeometryService { std::make_shared(); }; - DD4hepGeometryService(const Config& cfg); + explicit DD4hepGeometryService(const Config& cfg); DD4hepGeometryService(const DD4hepGeometryService&) = delete; DD4hepGeometryService(DD4hepGeometryService&&) = delete; ~DD4hepGeometryService(); diff --git a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp index bd7f7af38df..5def5740fa4 100644 --- a/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp +++ b/Examples/Detectors/MagneticField/include/ActsExamples/MagneticField/ScalableBField.hpp @@ -26,7 +26,7 @@ class ScalableBField final : public Acts::MagneticFieldProvider { Acts::ActsScalar scalor = 1.; /// @brief constructor with context - Cache(const Acts::MagneticFieldContext& mctx) { + explicit Cache(const Acts::MagneticFieldContext& mctx) { scalor = mctx.get().scalor; } }; diff --git a/Examples/Detectors/MuonSpectrometerMockupDetector/include/ActsExamples/MuonSpectrometerMockupDetector/MockupSectorBuilder.hpp b/Examples/Detectors/MuonSpectrometerMockupDetector/include/ActsExamples/MuonSpectrometerMockupDetector/MockupSectorBuilder.hpp index 62ae610224e..5b349bec9af 100644 --- a/Examples/Detectors/MuonSpectrometerMockupDetector/include/ActsExamples/MuonSpectrometerMockupDetector/MockupSectorBuilder.hpp +++ b/Examples/Detectors/MuonSpectrometerMockupDetector/include/ActsExamples/MuonSpectrometerMockupDetector/MockupSectorBuilder.hpp @@ -55,7 +55,7 @@ class MockupSectorBuilder { /// Constructor ///@param config The configuration struct - MockupSectorBuilder(const Config& config); + explicit MockupSectorBuilder(const Config& config); /// Destructor ~MockupSectorBuilder() = default; diff --git a/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/TGeoDetector.hpp b/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/TGeoDetector.hpp index 8982e3dbfb9..0fae0df1c5a 100644 --- a/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/TGeoDetector.hpp +++ b/Examples/Detectors/TGeoDetector/include/ActsExamples/TGeoDetector/TGeoDetector.hpp @@ -75,7 +75,7 @@ struct TGeoDetector { struct LayerTriplet { LayerTriplet() = default; - LayerTriplet(T value) + explicit LayerTriplet(T value) : negative{value}, central{value}, positive{value} {} LayerTriplet(T _negative, T _central, T _positive) diff --git a/Examples/Framework/ML/src/NeuralCalibrator.cpp b/Examples/Framework/ML/src/NeuralCalibrator.cpp index 68d24d35468..67c6e76db57 100644 --- a/Examples/Framework/ML/src/NeuralCalibrator.cpp +++ b/Examples/Framework/ML/src/NeuralCalibrator.cpp @@ -176,7 +176,8 @@ void ActsExamples::NeuralCalibrator::calibrate( Acts::visit_measurement(measurement.size(), [&](auto N) -> void { constexpr std::size_t kMeasurementSize = decltype(N)::value; const ConstFixedBoundMeasurementProxy fixedMeasurement = - measurement; + static_cast>( + measurement); Acts::ActsVector calibratedParameters = fixedMeasurement.parameters(); diff --git a/Examples/Framework/include/ActsExamples/EventData/Measurement.hpp b/Examples/Framework/include/ActsExamples/EventData/Measurement.hpp index 12286417c61..a0bf4559509 100644 --- a/Examples/Framework/include/ActsExamples/EventData/Measurement.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/Measurement.hpp @@ -205,7 +205,7 @@ class MeasurementProxyBase { MeasurementProxyBase(Container& container_, Index index_) : m_container(&container_), m_index(index_) {} template - MeasurementProxyBase( + explicit MeasurementProxyBase( const MeasurementProxyBase& other) requires(ReadOnly == OtherReadOnly || ReadOnly) : m_container(&other.container()), m_index(other.index()) {} @@ -358,7 +358,7 @@ class FixedMeasurementProxy assert(container().m_entries.at(index()).size == Size && "Size mismatch"); } template - FixedMeasurementProxy( + explicit FixedMeasurementProxy( const MeasurementProxyBase& other) requires(ReadOnly == OtherReadOnly || ReadOnly) : Base(other) { @@ -450,7 +450,7 @@ class VariableMeasurementProxy VariableMeasurementProxy(Container& container_, Index index_) : Base(container_, index_) {} template - VariableMeasurementProxy( + explicit VariableMeasurementProxy( const MeasurementProxyBase& other) requires(ReadOnly == OtherReadOnly || ReadOnly) : Base(other) {} diff --git a/Examples/Framework/include/ActsExamples/EventData/ScalingCalibrator.hpp b/Examples/Framework/include/ActsExamples/EventData/ScalingCalibrator.hpp index 706ef5291cd..a91b6d840cb 100644 --- a/Examples/Framework/include/ActsExamples/EventData/ScalingCalibrator.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/ScalingCalibrator.hpp @@ -47,7 +47,7 @@ class ScalingCalibrator : public MeasurementCalibrator { } }; - ScalingCalibrator(const std::filesystem::path& path); + explicit ScalingCalibrator(const std::filesystem::path& path); void calibrate( const MeasurementContainer& measurements, diff --git a/Examples/Framework/include/ActsExamples/EventData/SimVertex.hpp b/Examples/Framework/include/ActsExamples/EventData/SimVertex.hpp index d012ac3eb80..0bdfbb4925c 100644 --- a/Examples/Framework/include/ActsExamples/EventData/SimVertex.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/SimVertex.hpp @@ -21,8 +21,9 @@ class SimVertexBarcode { using Value = SimBarcode::Value; constexpr SimVertexBarcode() = default; - constexpr SimVertexBarcode(Value encoded) : m_id(SimBarcode(encoded)) {} - constexpr SimVertexBarcode(SimBarcode vertexId) + explicit constexpr SimVertexBarcode(Value encoded) + : m_id(SimBarcode(encoded)) {} + explicit constexpr SimVertexBarcode(SimBarcode vertexId) : m_id(vertexId.setParticle(0).setSubParticle(0)) { if (vertexId != vertexId.vertexId()) { throw std::invalid_argument("SimVertexBarcode: invalid vertexId"); diff --git a/Examples/Framework/include/ActsExamples/EventData/SpacePointContainer.hpp b/Examples/Framework/include/ActsExamples/EventData/SpacePointContainer.hpp index 14f50ff249a..dbf94345f0a 100644 --- a/Examples/Framework/include/ActsExamples/EventData/SpacePointContainer.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/SpacePointContainer.hpp @@ -31,8 +31,10 @@ class SpacePointContainer { // the memory backend is independetly handled. This is only interfacing it to // ACTS SpacePointContainer(CollectionType&& container) = delete; - SpacePointContainer(CollectionType& container) : m_storage(container) {} - SpacePointContainer(CollectionType* container) : m_storage(container) {} + explicit SpacePointContainer(CollectionType& container) + : m_storage(container) {} + explicit SpacePointContainer(CollectionType* container) + : m_storage(container) {} // No copy constructor or copy operation allowed SpacePointContainer(const SpacePointContainer&) = delete; diff --git a/Examples/Framework/include/ActsExamples/Framework/RandomNumbers.hpp b/Examples/Framework/include/ActsExamples/Framework/RandomNumbers.hpp index 5389ae5a8b6..6f9f9abbcd6 100644 --- a/Examples/Framework/include/ActsExamples/Framework/RandomNumbers.hpp +++ b/Examples/Framework/include/ActsExamples/Framework/RandomNumbers.hpp @@ -44,7 +44,7 @@ class RandomNumbers { std::uint64_t seed = 1234567890u; ///< random seed }; - RandomNumbers(const Config& cfg); + explicit RandomNumbers(const Config& cfg); /// Spawn an algorithm-local random number generator. To avoid inefficiencies /// and multiple uses of a given RNG seed, this should only be done once per diff --git a/Examples/Framework/include/ActsExamples/Framework/Sequencer.hpp b/Examples/Framework/include/ActsExamples/Framework/Sequencer.hpp index fa1c53618a0..91f229a8c0b 100644 --- a/Examples/Framework/include/ActsExamples/Framework/Sequencer.hpp +++ b/Examples/Framework/include/ActsExamples/Framework/Sequencer.hpp @@ -89,7 +89,7 @@ class Sequencer { std::size_t fpeStackTraceLength = 8; }; - Sequencer(const Config &cfg); + explicit Sequencer(const Config &cfg); /// Add a context decorator to the set of context decorators. /// diff --git a/Examples/Framework/include/ActsExamples/Framework/WhiteBoard.hpp b/Examples/Framework/include/ActsExamples/Framework/WhiteBoard.hpp index ca5e1904879..777d27fe898 100644 --- a/Examples/Framework/include/ActsExamples/Framework/WhiteBoard.hpp +++ b/Examples/Framework/include/ActsExamples/Framework/WhiteBoard.hpp @@ -76,7 +76,7 @@ class WhiteBoard { struct HolderT : public IHolder { T value; - HolderT(T&& v) : value(std::move(v)) {} + explicit HolderT(T&& v) : value(std::move(v)) {} const std::type_info& type() const override { return typeid(T); } }; diff --git a/Examples/Framework/include/ActsExamples/Utilities/tbbWrap.hpp b/Examples/Framework/include/ActsExamples/Utilities/tbbWrap.hpp index 985cbb2180b..84784c55d31 100644 --- a/Examples/Framework/include/ActsExamples/Utilities/tbbWrap.hpp +++ b/Examples/Framework/include/ActsExamples/Utilities/tbbWrap.hpp @@ -161,7 +161,7 @@ class queuing_mutex { #endif } - scoped_lock(queuing_mutex& ACTS_EXAMPLES_WITH_TBB(m)) { + explicit scoped_lock(queuing_mutex& ACTS_EXAMPLES_WITH_TBB(m)) { #ifndef ACTS_EXAMPLES_NO_TBB if (enableTBB()) { tbb.emplace(*m.tbb); diff --git a/Examples/Framework/src/EventData/MeasurementCalibration.cpp b/Examples/Framework/src/EventData/MeasurementCalibration.cpp index 963ef57ea24..b4764844770 100644 --- a/Examples/Framework/src/EventData/MeasurementCalibration.cpp +++ b/Examples/Framework/src/EventData/MeasurementCalibration.cpp @@ -38,7 +38,8 @@ void ActsExamples::PassThroughCalibrator::calibrate( Acts::visit_measurement(measurement.size(), [&](auto N) -> void { constexpr std::size_t kMeasurementSize = decltype(N)::value; const ConstFixedBoundMeasurementProxy fixedMeasurement = - measurement; + static_cast>( + measurement); trackState.allocateCalibrated(kMeasurementSize); trackState.calibrated() = fixedMeasurement.parameters(); diff --git a/Examples/Framework/src/EventData/ScalingCalibrator.cpp b/Examples/Framework/src/EventData/ScalingCalibrator.cpp index 12da0078659..ae5c1eca4fe 100644 --- a/Examples/Framework/src/EventData/ScalingCalibrator.cpp +++ b/Examples/Framework/src/EventData/ScalingCalibrator.cpp @@ -165,7 +165,8 @@ void ActsExamples::ScalingCalibrator::calibrate( Acts::visit_measurement(measurement.size(), [&](auto N) -> void { constexpr std::size_t kMeasurementSize = decltype(N)::value; const ConstFixedBoundMeasurementProxy fixedMeasurement = - measurement; + static_cast>( + measurement); Acts::ActsVector calibratedParameters = fixedMeasurement.parameters(); diff --git a/Examples/Framework/src/Framework/Sequencer.cpp b/Examples/Framework/src/Framework/Sequencer.cpp index f6bb69d44c0..5c1a76b5bd4 100644 --- a/Examples/Framework/src/Framework/Sequencer.cpp +++ b/Examples/Framework/src/Framework/Sequencer.cpp @@ -367,7 +367,7 @@ struct StopWatch { Timepoint start; Duration& store; - StopWatch(Duration& s) : start(Clock::now()), store(s) {} + explicit StopWatch(Duration& s) : start(Clock::now()), store(s) {} ~StopWatch() { store += Clock::now() - start; } }; diff --git a/Examples/HelloWorld/HelloLoggerAlgorithm.hpp b/Examples/HelloWorld/HelloLoggerAlgorithm.hpp index 934c0b67f5c..3cafd2c4f55 100644 --- a/Examples/HelloWorld/HelloLoggerAlgorithm.hpp +++ b/Examples/HelloWorld/HelloLoggerAlgorithm.hpp @@ -17,7 +17,7 @@ namespace ActsExamples { /// A simple algorithm that just prints hello world. class HelloLoggerAlgorithm : public ActsExamples::IAlgorithm { public: - HelloLoggerAlgorithm(Acts::Logging::Level level); + explicit HelloLoggerAlgorithm(Acts::Logging::Level level); // Log a few messages. ActsExamples::ProcessCode execute(const AlgorithmContext& ctx) const override; diff --git a/Examples/Io/Csv/include/ActsExamples/Io/Csv/CsvInputOutput.hpp b/Examples/Io/Csv/include/ActsExamples/Io/Csv/CsvInputOutput.hpp index 7f4e7b894c3..e141f470988 100644 --- a/Examples/Io/Csv/include/ActsExamples/Io/Csv/CsvInputOutput.hpp +++ b/Examples/Io/Csv/include/ActsExamples/Io/Csv/CsvInputOutput.hpp @@ -236,7 +236,7 @@ class DsvReader { /// Open a file at the given path. /// /// \param path Path to the input file - DsvReader(const std::string& path); + explicit DsvReader(const std::string& path); /// Read the next line from the file. /// diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/detail/NuclearInteractionParametrisation.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/detail/NuclearInteractionParametrisation.hpp index b0a6174a0d6..e00fb79c63a 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/detail/NuclearInteractionParametrisation.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/detail/NuclearInteractionParametrisation.hpp @@ -34,7 +34,7 @@ struct EventFraction { /// /// @param [in] event Tuple containing the initial particle, the particle /// before the interaction and all final state particles after the interaction - EventFraction(const ActsExamples::ExtractedSimulationProcess& event) + explicit EventFraction(const ActsExamples::ExtractedSimulationProcess& event) : initialParticle(event.initial), interactingParticle(event.before), finalParticles(event.after) {} diff --git a/Examples/Io/Root/src/RootVertexReader.cpp b/Examples/Io/Root/src/RootVertexReader.cpp index 93a986a6c04..336e0364f9b 100644 --- a/Examples/Io/Root/src/RootVertexReader.cpp +++ b/Examples/Io/Root/src/RootVertexReader.cpp @@ -114,7 +114,7 @@ ProcessCode RootVertexReader::read(const AlgorithmContext& context) { for (unsigned int i = 0; i < nVertices; i++) { SimVertex v; - v.id = (*m_vertexId)[i]; + v.id = SimVertexBarcode{(*m_vertexId)[i]}; v.process = static_cast((*m_process)[i]); v.position4 = Acts::Vector4((*m_vx)[i] * Acts::UnitConstants::mm, (*m_vy)[i] * Acts::UnitConstants::mm, diff --git a/Examples/Io/Root/src/VertexNTupleWriter.cpp b/Examples/Io/Root/src/VertexNTupleWriter.cpp index 36c9b7bfb29..c5a800741d3 100644 --- a/Examples/Io/Root/src/VertexNTupleWriter.cpp +++ b/Examples/Io/Root/src/VertexNTupleWriter.cpp @@ -497,7 +497,7 @@ ProcessCode VertexNTupleWriter::writeT( fmap[vtxId].second += weight; } double truthMajorityVertexTrackWeights = 0; - SimVertexBarcode truthMajorityVertexId = 0; + SimVertexBarcode truthMajorityVertexId{0}; for (const auto& [vtxId, counter] : fmap) { if (counter.second > truthMajorityVertexTrackWeights) { truthMajorityVertexId = vtxId; @@ -629,7 +629,8 @@ ProcessCode VertexNTupleWriter::writeT( // Count number of reconstructible tracks on truth vertex int nTracksOnTruthVertex = 0; for (const auto& particle : selectedParticles) { - if (particle.particleId().vertexId() == truthVertex.vertexId()) { + if (static_cast(particle.particleId().vertexId()) == + truthVertex.vertexId()) { ++nTracksOnTruthVertex; } } diff --git a/Examples/Scripts/TrackingPerformance/TreeReader.h b/Examples/Scripts/TrackingPerformance/TreeReader.h index d171fa85b72..4ab47746dc0 100644 --- a/Examples/Scripts/TrackingPerformance/TreeReader.h +++ b/Examples/Scripts/TrackingPerformance/TreeReader.h @@ -36,7 +36,7 @@ struct ParticleInfo { /// struct TreeReader { // The constructor - TreeReader(TTree* tree_) : tree(tree_) {} + explicit TreeReader(TTree* tree_) : tree(tree_) {} // Get entry void getEntry(unsigned int i) const { diff --git a/Fatras/include/ActsFatras/Utilities/LandauDistribution.hpp b/Fatras/include/ActsFatras/Utilities/LandauDistribution.hpp index 5fe4f57280c..2b29bd89066 100644 --- a/Fatras/include/ActsFatras/Utilities/LandauDistribution.hpp +++ b/Fatras/include/ActsFatras/Utilities/LandauDistribution.hpp @@ -51,7 +51,7 @@ class LandauDistribution { /// Construct directly from the distribution parameters. LandauDistribution(double location, double scale) : m_cfg(location, scale) {} /// Construct from a parameter object. - LandauDistribution(const param_type &cfg) : m_cfg(cfg) {} + explicit LandauDistribution(const param_type &cfg) : m_cfg(cfg) {} // Explicitlely defaulted construction and assignment LandauDistribution() = default; LandauDistribution(const LandauDistribution &) = default; diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorStructure.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorStructure.hpp index a11601b579b..eb69176aa19 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorStructure.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorStructure.hpp @@ -55,9 +55,9 @@ class DD4hepDetectorStructure { /// @param logger is the screen output logger /// /// @note this needs to be provided - DD4hepDetectorStructure(std::unique_ptr logger = - getDefaultLogger("DD4hepLayerStructure", - Acts::Logging::INFO)); + explicit DD4hepDetectorStructure(std::unique_ptr logger = + getDefaultLogger("DD4hepLayerStructure", + Acts::Logging::INFO)); DD4hepDetectorStructure() = delete; diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp index d6855443af2..b120358d537 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp @@ -90,7 +90,7 @@ class DD4hepDetectorSurfaceFactory { /// The DD4hep detector element factory /// /// @param mlogger a screen output logger - DD4hepDetectorSurfaceFactory( + explicit DD4hepDetectorSurfaceFactory( std::unique_ptr mlogger = getDefaultLogger( "DD4hepDetectorSurfaceFactory", Acts::Logging::INFO)); diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepFieldAdapter.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepFieldAdapter.hpp index 9d2007235e5..6f7b8077348 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepFieldAdapter.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepFieldAdapter.hpp @@ -22,7 +22,7 @@ class DD4hepFieldAdapter : public Acts::MagneticFieldProvider { struct Cache {}; public: - DD4hepFieldAdapter(dd4hep::OverlayedField field); + explicit DD4hepFieldAdapter(dd4hep::OverlayedField field); MagneticFieldProvider::Cache makeCache( const Acts::MagneticFieldContext& mctx) const override; diff --git a/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConverter.hpp b/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConverter.hpp index 441b8f121f0..104c71e1893 100644 --- a/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConverter.hpp +++ b/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConverter.hpp @@ -38,8 +38,9 @@ class DetrayConverter { }; /// Constructor with logger - DetrayConverter(std::unique_ptr logger = - getDefaultLogger("DetrayConverter", Logging::INFO)); + explicit DetrayConverter( + std::unique_ptr logger = getDefaultLogger("DetrayConverter", + Logging::INFO)); /// Convert an Acts::Experimental::Detector to a detray::detector object /// diff --git a/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4PhysicalVolumeSelectors.hpp b/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4PhysicalVolumeSelectors.hpp index 1fab98ea834..fd05274a34d 100644 --- a/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4PhysicalVolumeSelectors.hpp +++ b/Plugins/Geant4/include/Acts/Plugins/Geant4/Geant4PhysicalVolumeSelectors.hpp @@ -70,7 +70,7 @@ struct PositionSelector : public IGeant4PhysicalVolumeSelector { /// Constructor with arguments /// @param ranges the provided map of axes of ranges - PositionSelector( + explicit PositionSelector( const std::map>& ranges) : m_ranges(ranges) {} diff --git a/Plugins/Json/include/Acts/Plugins/Json/GeometryHierarchyMapJsonConverter.hpp b/Plugins/Json/include/Acts/Plugins/Json/GeometryHierarchyMapJsonConverter.hpp index 70f070e9dd7..74ce7109975 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/GeometryHierarchyMapJsonConverter.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/GeometryHierarchyMapJsonConverter.hpp @@ -42,7 +42,7 @@ class GeometryHierarchyMapJsonConverter { /// Construct the converter. /// /// @param valueIdentifier user-defined identifier for the stored value - GeometryHierarchyMapJsonConverter(std::string valueIdentifier) + explicit GeometryHierarchyMapJsonConverter(std::string valueIdentifier) : m_valueIdentifier(std::move(valueIdentifier)) { if (m_valueIdentifier.empty()) { throw std::invalid_argument("Value identifier must be non-empty"); diff --git a/Plugins/Podio/include/Acts/Plugins/Podio/PodioDynamicColumns.hpp b/Plugins/Podio/include/Acts/Plugins/Podio/PodioDynamicColumns.hpp index d72e78bd9f2..295937efe7e 100644 --- a/Plugins/Podio/include/Acts/Plugins/Podio/PodioDynamicColumns.hpp +++ b/Plugins/Podio/include/Acts/Plugins/Podio/PodioDynamicColumns.hpp @@ -18,7 +18,7 @@ namespace Acts::podio_detail { struct ConstDynamicColumnBase { - ConstDynamicColumnBase(std::string_view name) : m_name{name} {} + explicit ConstDynamicColumnBase(std::string_view name) : m_name{name} {} virtual ~ConstDynamicColumnBase() = default; @@ -45,7 +45,8 @@ struct ConstDynamicColumn : public ConstDynamicColumnBase { }; struct DynamicColumnBase : public ConstDynamicColumnBase { - DynamicColumnBase(std::string_view name) : ConstDynamicColumnBase{name} {} + explicit DynamicColumnBase(std::string_view name) + : ConstDynamicColumnBase{name} {} virtual std::any get(std::size_t i) = 0; std::any get(std::size_t i) const override = 0;