From 02e8ee4625685a9eed73a4e9701a9b61e95e8c80 Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Thu, 9 Jan 2025 15:37:10 +0100 Subject: [PATCH 1/5] fixing some blocker reported sonar-cloud issues --- .../Acts/EventData/VectorMultiTrajectory.hpp | 4 ++-- .../Acts/Geometry/GeometryHierarchyMap.hpp | 4 ++-- .../Acts/Seeding/BinnedGroupIterator.ipp | 3 ++- Core/include/Acts/Utilities/Any.hpp | 2 +- Core/include/Acts/Utilities/MultiIndex.hpp | 2 +- Core/include/Acts/Utilities/Result.hpp | 6 +++--- .../GenericDetector/ProtoLayerCreatorT.hpp | 20 +++++++++---------- .../EventData/GeometryContainers.hpp | 10 +++++----- .../include/ActsExamples/Utilities/Range.hpp | 4 ++-- .../Acts/Plugins/FpeMonitoring/FpeMonitor.hpp | 2 +- 10 files changed, 29 insertions(+), 28 deletions(-) diff --git a/Core/include/Acts/EventData/VectorMultiTrajectory.hpp b/Core/include/Acts/EventData/VectorMultiTrajectory.hpp index 8f416dd6969..4238afd88f6 100644 --- a/Core/include/Acts/EventData/VectorMultiTrajectory.hpp +++ b/Core/include/Acts/EventData/VectorMultiTrajectory.hpp @@ -192,7 +192,7 @@ class VectorMultiTrajectoryBase { TrackStatePropMask allocMask = TrackStatePropMask::None; }; - VectorMultiTrajectoryBase() = default; + VectorMultiTrajectoryBase() noexcept = default; VectorMultiTrajectoryBase(const VectorMultiTrajectoryBase& other) : m_index{other.m_index}, @@ -388,7 +388,7 @@ class VectorMultiTrajectory final VectorMultiTrajectory(const VectorMultiTrajectory& other) : VectorMultiTrajectoryBase{other} {} - VectorMultiTrajectory(VectorMultiTrajectory&& other) + VectorMultiTrajectory(VectorMultiTrajectory&& other) noexcept : VectorMultiTrajectoryBase{std::move(other)} {} Statistics statistics() const { diff --git a/Core/include/Acts/Geometry/GeometryHierarchyMap.hpp b/Core/include/Acts/Geometry/GeometryHierarchyMap.hpp index 3bdfc63425b..61cdcdb5e6d 100644 --- a/Core/include/Acts/Geometry/GeometryHierarchyMap.hpp +++ b/Core/include/Acts/Geometry/GeometryHierarchyMap.hpp @@ -79,10 +79,10 @@ class GeometryHierarchyMap { // defaulted constructors and assignment operators GeometryHierarchyMap() = default; GeometryHierarchyMap(const GeometryHierarchyMap&) = default; - GeometryHierarchyMap(GeometryHierarchyMap&&) = default; + GeometryHierarchyMap(GeometryHierarchyMap&&) noexcept = default; ~GeometryHierarchyMap() = default; GeometryHierarchyMap& operator=(const GeometryHierarchyMap&) = default; - GeometryHierarchyMap& operator=(GeometryHierarchyMap&&) = default; + GeometryHierarchyMap& operator=(GeometryHierarchyMap&&) noexcept = default; /// Return an iterator pointing to the beginning of the stored values. Iterator begin() const { return m_values.begin(); } diff --git a/Core/include/Acts/Seeding/BinnedGroupIterator.ipp b/Core/include/Acts/Seeding/BinnedGroupIterator.ipp index 8bcd0ac04b8..906017b6d4e 100644 --- a/Core/include/Acts/Seeding/BinnedGroupIterator.ipp +++ b/Core/include/Acts/Seeding/BinnedGroupIterator.ipp @@ -85,7 +85,8 @@ void Acts::BinnedGroupIterator::findNotEmptyBin() { passesMask = m_group->mask().at(m_gridItr.globalBinIndex()); } // loop and only stop when we find a non-empty bin which is not masked - while ((dimCollection == 0ul || !passesMask) && ++m_gridItr != m_gridItrEnd) { + while ((++m_gridItr != m_gridItrEnd) && + (dimCollection == 0ul || !passesMask)) { dimCollection = (*m_gridItr).size(); if (dimCollection == 0ul) { continue; diff --git a/Core/include/Acts/Utilities/Any.hpp b/Core/include/Acts/Utilities/Any.hpp index 337dafb2c24..bf04ec47ca7 100644 --- a/Core/include/Acts/Utilities/Any.hpp +++ b/Core/include/Acts/Utilities/Any.hpp @@ -213,7 +213,7 @@ class AnyBase : public AnyBaseAll { return *this; } - AnyBase(AnyBase&& other) { + AnyBase(AnyBase&& other) noexcept { _ACTS_ANY_VERBOSE("Move construct (this=" << this << ") at: " << static_cast(m_data.data())); if (m_handler == nullptr && other.m_handler == nullptr) { diff --git a/Core/include/Acts/Utilities/MultiIndex.hpp b/Core/include/Acts/Utilities/MultiIndex.hpp index f809771fd60..ca7d330ba6b 100644 --- a/Core/include/Acts/Utilities/MultiIndex.hpp +++ b/Core/include/Acts/Utilities/MultiIndex.hpp @@ -70,7 +70,7 @@ class MultiIndex { MultiIndex(const MultiIndex&) = default; MultiIndex(MultiIndex&) = default; MultiIndex& operator=(const MultiIndex&) = default; - MultiIndex& operator=(MultiIndex&&) = default; + MultiIndex& operator=(MultiIndex&&) noexcept = default; /// Allow setting the MultiIndex from an already encoded value. constexpr MultiIndex& operator=(Value encoded) { m_value = encoded; diff --git a/Core/include/Acts/Utilities/Result.hpp b/Core/include/Acts/Utilities/Result.hpp index 475019fc99b..c71836cc788 100644 --- a/Core/include/Acts/Utilities/Result.hpp +++ b/Core/include/Acts/Utilities/Result.hpp @@ -43,12 +43,12 @@ class Result { Result& operator=(const Result& other) = delete; /// Move construction is allowed - Result(Result&& other) : m_var(std::move(other.m_var)) {} + Result(Result&& other) noexcept : m_var(std::move(other.m_var)) {} /// Move assignment is allowed /// @param other The other result instance, rvalue reference /// @return The assigned instance - Result& operator=(Result&& other) { + Result& operator=(Result&& other) noexcept { m_var = std::move(other.m_var); return *this; } @@ -357,7 +357,7 @@ class Result { /// Move constructor /// @param other The other result object, rvalue ref - Result(Result&& other) : m_opt(std::move(other.m_opt)) {} + Result(Result&& other) noexcept : m_opt(std::move(other.m_opt)) {} /// Move assignment operator /// @param other The other result object, rvalue ref diff --git a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp index d8e1ce24fb0..ae8357a2a1b 100644 --- a/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp +++ b/Examples/Detectors/GenericDetector/include/ActsExamples/GenericDetector/ProtoLayerCreatorT.hpp @@ -280,14 +280,14 @@ ProtoLayerCreatorT::centralProtoLayers( auto moduleTransform = std::const_pointer_cast( mutableModuleTransform); // create the module - auto module = std::make_shared( + auto moduleElement = std::make_shared( moduleIdentifier, moduleTransform, moduleBounds, moduleThickness, moduleMaterialPtr); // put the module into the detector store - layerStore.push_back(module); + layerStore.push_back(moduleElement); // register the surface - sVector.push_back(module->surface().getSharedPtr()); + sVector.push_back(moduleElement->surface().getSharedPtr()); // IF double modules exist // and the backside one (if configured to do so) if (!m_cfg.centralModuleBacksideGap.empty()) { @@ -311,11 +311,11 @@ ProtoLayerCreatorT::centralProtoLayers( moduleTransform = std::const_pointer_cast( mutableModuleTransform); // create the backseide moulde - auto bsmodule = std::make_shared( + auto bsModuleElement = std::make_shared( moduleIdentifier, moduleTransform, moduleBounds, moduleThickness, moduleMaterialPtr); // everything is set for the next module - layerStore.push_back(std::move(bsmodule)); + layerStore.push_back(std::move(bsModuleElement)); } } @@ -456,10 +456,10 @@ ProtoLayerCreatorT::createProtoLayers( static_cast(imodule++); // create the module - auto module = std::make_shared( + auto moduleElement = std::make_shared( moduleIdentifier, moduleTransform, moduleBounds, moduleThickness, moduleMaterialPtr); - layerStore.push_back(module); + layerStore.push_back(moduleElement); // now deal with the potential backside if (!m_cfg.posnegModuleBacksideGap.empty()) { @@ -485,14 +485,14 @@ ProtoLayerCreatorT::createProtoLayers( moduleTransform = std::const_pointer_cast( mutableModuleTransform); // everything is set for the next module - auto bsmodule = std::make_shared( + auto bsModuleElement = std::make_shared( moduleIdentifier, moduleTransform, moduleBounds, moduleThickness, moduleMaterialPtr); // Put into the detector store - layerStore.push_back(std::move(bsmodule)); + layerStore.push_back(std::move(bsModuleElement)); } // create the surface - esVector.push_back(module->surface().getSharedPtr()); + esVector.push_back(moduleElement->surface().getSharedPtr()); } // counter of rings ++ipnR; diff --git a/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp b/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp index e88e8e9db38..3ffb0c0ac3b 100644 --- a/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp @@ -162,11 +162,11 @@ template inline auto selectModule(const GeometryIdMultiset& container, Acts::GeometryIdentifier::Value volume, Acts::GeometryIdentifier::Value layer, - Acts::GeometryIdentifier::Value module) { + Acts::GeometryIdentifier::Value sensitive) { return selectModule( container, Acts::GeometryIdentifier().setVolume(volume).setLayer(layer).setSensitive( - module)); + sensitive)); } /// Select all elements for the lowest non-zero identifier component. @@ -176,9 +176,9 @@ inline auto selectModule(const GeometryIdMultiset& container, /// applies to the lower components and not to intermediate zeros. /// /// Examples: -/// - volume=2,layer=0,module=3 -> select all elements in the module -/// - volume=1,layer=2,module=0 -> select all elements in the layer -/// - volume=3,layer=0,module=0 -> select all elements in the volume +/// - volume=2,layer=0,sensitive=3 -> select all elements in the sensitive +/// - volume=1,layer=2,sensitive=0 -> select all elements in the layer +/// - volume=3,layer=0,sensitive=0 -> select all elements in the volume /// /// @note An identifier with all components set to zero selects the whole input /// container. diff --git a/Examples/Framework/include/ActsExamples/Utilities/Range.hpp b/Examples/Framework/include/ActsExamples/Utilities/Range.hpp index 5acc97f082b..db1574ae72c 100644 --- a/Examples/Framework/include/ActsExamples/Utilities/Range.hpp +++ b/Examples/Framework/include/ActsExamples/Utilities/Range.hpp @@ -27,10 +27,10 @@ template class Range { public: Range(Iterator b, Iterator e) : m_begin(b), m_end(e) {} - Range(Range&&) = default; + Range(Range&&) noexcept = default; Range(const Range&) = default; ~Range() = default; - Range& operator=(Range&&) = default; + Range& operator=(Range&&) noexcept = default; Range& operator=(const Range&) = default; Iterator begin() const { return m_begin; } diff --git a/Plugins/FpeMonitoring/include/Acts/Plugins/FpeMonitoring/FpeMonitor.hpp b/Plugins/FpeMonitoring/include/Acts/Plugins/FpeMonitoring/FpeMonitor.hpp index 022a07a3426..ee96ecdc29f 100644 --- a/Plugins/FpeMonitoring/include/Acts/Plugins/FpeMonitoring/FpeMonitor.hpp +++ b/Plugins/FpeMonitoring/include/Acts/Plugins/FpeMonitoring/FpeMonitor.hpp @@ -45,7 +45,7 @@ class FpeMonitor { m_size{bufferSize} {} Buffer(const Buffer &) = delete; - Buffer(Buffer &&other) { + Buffer(Buffer &&other) noexcept { m_data = std::move(other.m_data); m_size = other.m_size; m_offset = other.m_offset; From 116e5bd0e5922c7ca9de76156efa4bc882f2d2b5 Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Thu, 9 Jan 2025 16:17:11 +0100 Subject: [PATCH 2/5] revert Iterator change --- Core/include/Acts/Seeding/BinnedGroupIterator.ipp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/include/Acts/Seeding/BinnedGroupIterator.ipp b/Core/include/Acts/Seeding/BinnedGroupIterator.ipp index 906017b6d4e..13427525f6c 100644 --- a/Core/include/Acts/Seeding/BinnedGroupIterator.ipp +++ b/Core/include/Acts/Seeding/BinnedGroupIterator.ipp @@ -85,8 +85,8 @@ void Acts::BinnedGroupIterator::findNotEmptyBin() { passesMask = m_group->mask().at(m_gridItr.globalBinIndex()); } // loop and only stop when we find a non-empty bin which is not masked - while ((++m_gridItr != m_gridItrEnd) && - (dimCollection == 0ul || !passesMask)) { + while ((dimCollection == 0ul || !passesMask) && + (++m_gridItr != m_gridItrEnd)) { dimCollection = (*m_gridItr).size(); if (dimCollection == 0ul) { continue; From 07c8157235a44caac4e336745af2da5c2eb46e0b Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Fri, 10 Jan 2025 09:03:27 +0100 Subject: [PATCH 3/5] more SonarCloud fixes --- .../Kernel/detail/AlignmentEngine.hpp | 59 ++++++++++--------- Core/include/Acts/Detector/DetectorVolume.hpp | 2 +- .../IndexedRootVolumeFinderBuilder.hpp | 3 +- .../Acts/Detector/LayerStructureBuilder.hpp | 2 +- Core/include/Acts/Detector/Portal.hpp | 2 +- .../EventData/GenericBoundTrackParameters.hpp | 6 +- .../GenericCurvilinearTrackParameters.hpp | 6 +- .../EventData/GenericFreeTrackParameters.hpp | 5 +- .../Acts/EventData/MultiTrajectory.hpp | 2 +- Core/include/Acts/EventData/ProxyAccessor.hpp | 4 +- Core/include/Acts/EventData/SourceLink.hpp | 4 +- .../Acts/EventData/TrackStateProxy.hpp | 2 +- .../Acts/EventData/VectorMultiTrajectory.hpp | 4 +- .../Acts/EventData/VectorTrackContainer.hpp | 4 +- .../CorrectedTransformationFreeToBound.hpp | 2 +- .../Core/EventData/MultiTrajectoryTests.cpp | 2 +- 16 files changed, 56 insertions(+), 53 deletions(-) diff --git a/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp b/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp index b26175abcdd..a5dacf69f50 100644 --- a/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp +++ b/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp @@ -21,7 +21,6 @@ namespace ActsAlignment::detail { -using namespace Acts; /// ///@brief struct to store info needed for track-based alignment /// @@ -36,35 +35,35 @@ struct TrackAlignmentState { std::size_t alignmentDof = 0; // The measurements covariance - ActsDynamicMatrix measurementCovariance; + Acts::ActsDynamicMatrix measurementCovariance; // The track parameters covariance - ActsDynamicMatrix trackParametersCovariance; + Acts::ActsDynamicMatrix trackParametersCovariance; // The projection matrix - ActsDynamicMatrix projectionMatrix; + Acts::ActsDynamicMatrix projectionMatrix; // The residual - ActsDynamicVector residual; + Acts::ActsDynamicVector residual; // The covariance of residual - ActsDynamicMatrix residualCovariance; + Acts::ActsDynamicMatrix residualCovariance; // The chi2 double chi2 = 0; // The derivative of residual w.r.t. alignment parameters - ActsDynamicMatrix alignmentToResidualDerivative; + Acts::ActsDynamicMatrix alignmentToResidualDerivative; // The derivative of chi2 w.r.t. alignment parameters - ActsDynamicVector alignmentToChi2Derivative; + Acts::ActsDynamicVector alignmentToChi2Derivative; // The second derivative of chi2 w.r.t. alignment parameters - ActsDynamicMatrix alignmentToChi2SecondDerivative; + Acts::ActsDynamicMatrix alignmentToChi2SecondDerivative; // The alignable surfaces on the track and their indices in both the global // alignable surfaces pool and those relevant with this track - std::unordered_map> + std::unordered_map> alignedSurfaces; }; @@ -103,9 +102,9 @@ void resetAlignmentDerivative(Acts::AlignmentToBoundMatrix& alignToBound, /// ingredients template TrackAlignmentState trackAlignmentState( - const GeometryContext& gctx, const traj_t& multiTraj, + const Acts::GeometryContext& gctx, const traj_t& multiTraj, const std::size_t& entryIndex, - const std::pair>& globalTrackParamsCov, const std::unordered_map& idxedAlignSurfaces, @@ -136,7 +135,7 @@ TrackAlignmentState trackAlignmentState( // Only measurement states matter (we can't align non-measurement states, // no?) - if (!ts.typeFlags().test(TrackStateFlag::MeasurementFlag)) { + if (!ts.typeFlags().test(Acts::TrackStateFlag::MeasurementFlag)) { return true; } // Check if the reference surface is to be aligned @@ -170,19 +169,20 @@ TrackAlignmentState trackAlignmentState( // Initialize the alignment matrices with components from the measurement // states // The measurement covariance - alignState.measurementCovariance = ActsDynamicMatrix::Zero( + alignState.measurementCovariance = Acts::ActsDynamicMatrix::Zero( alignState.measurementDim, alignState.measurementDim); // The bound parameters to measurement projection matrix - alignState.projectionMatrix = ActsDynamicMatrix::Zero( + alignState.projectionMatrix = Acts::ActsDynamicMatrix::Zero( alignState.measurementDim, alignState.trackParametersDim); // The derivative of residual w.r.t. alignment parameters - alignState.alignmentToResidualDerivative = ActsDynamicMatrix::Zero( + alignState.alignmentToResidualDerivative = Acts::ActsDynamicMatrix::Zero( alignState.measurementDim, alignState.alignmentDof); // The track parameters covariance - alignState.trackParametersCovariance = ActsDynamicMatrix::Zero( + alignState.trackParametersCovariance = Acts::ActsDynamicMatrix::Zero( alignState.trackParametersDim, alignState.trackParametersDim); // The residual - alignState.residual = ActsDynamicVector::Zero(alignState.measurementDim); + alignState.residual = + Acts::ActsDynamicVector::Zero(alignState.measurementDim); // Unpack global track parameters covariance and the starting row/column for // all smoothed states. @@ -202,13 +202,13 @@ TrackAlignmentState trackAlignmentState( iMeasurement -= measdim; iParams -= eBoundSize; // (a) Get and fill the measurement covariance matrix - const ActsDynamicMatrix measCovariance = + const Acts::ActsDynamicMatrix measCovariance = state.effectiveCalibratedCovariance(); alignState.measurementCovariance.block(iMeasurement, iMeasurement, measdim, measdim) = measCovariance; // (b) Get and fill the bound parameters to measurement projection matrix - const ActsDynamicMatrix H = + const Acts::ActsDynamicMatrix H = state.projectorSubspaceHelper().fullProjector().topLeftCorner( measdim, eBoundSize); alignState.projectionMatrix.block(iMeasurement, iParams, measdim, @@ -227,18 +227,19 @@ TrackAlignmentState trackAlignmentState( const FreeVector freeParams = Acts::MultiTrajectoryHelpers::freeSmoothed(gctx, state); // The position - const Vector3 position = freeParams.segment<3>(eFreePos0); + const Acts::Vector3 position = freeParams.segment<3>(eFreePos0); // The direction - const Vector3 direction = freeParams.segment<3>(eFreeDir0); + const Acts::Vector3 direction = freeParams.segment<3>(eFreeDir0); // The derivative of free parameters w.r.t. path length. @note Here, we // assume a linear track model, i.e. neglecting the change of track // direction. Otherwise, we need to know the magnetic field at the free // parameters - FreeVector pathDerivative = FreeVector::Zero(); + Acts::FreeVector pathDerivative = FreeVector::Zero(); pathDerivative.head<3>() = direction; // Get the derivative of bound parameters w.r.t. alignment parameters - AlignmentToBoundMatrix alignToBound = surface->alignmentToBoundDerivative( - gctx, position, direction, pathDerivative); + Acts::AlignmentToBoundMatrix alignToBound = + surface->alignmentToBoundDerivative(gctx, position, direction, + pathDerivative); // Set the degree of freedom per surface. // @Todo: don't allocate memory for fixed degree of freedom and consider surface/layer/volume wise align mask (instead of using global mask as now) resetAlignmentDerivative(alignToBound, alignMask); @@ -274,11 +275,11 @@ TrackAlignmentState trackAlignmentState( alignState.measurementCovariance.inverse() * alignState.residual; alignState.alignmentToChi2Derivative = - ActsDynamicVector::Zero(alignState.alignmentDof); - alignState.alignmentToChi2SecondDerivative = - ActsDynamicMatrix::Zero(alignState.alignmentDof, alignState.alignmentDof); + Acts::ActsDynamicVector::Zero(alignState.alignmentDof); + alignState.alignmentToChi2SecondDerivative = Acts::ActsDynamicMatrix::Zero( + alignState.alignmentDof, alignState.alignmentDof); // The covariance of residual - alignState.residualCovariance = ActsDynamicMatrix::Zero( + alignState.residualCovariance = Acts::ActsDynamicMatrix::Zero( alignState.measurementDim, alignState.measurementDim); alignState.residualCovariance = alignState.measurementCovariance - alignState.projectionMatrix * diff --git a/Core/include/Acts/Detector/DetectorVolume.hpp b/Core/include/Acts/Detector/DetectorVolume.hpp index 903532361f7..6cd98fc1837 100644 --- a/Core/include/Acts/Detector/DetectorVolume.hpp +++ b/Core/include/Acts/Detector/DetectorVolume.hpp @@ -84,7 +84,7 @@ class DetectorVolume : public std::enable_shared_from_this { /// Store constructor /// /// @param objects are the ones copied into the internal store - ObjectStore(std::vector objects) + explicit ObjectStore(std::vector objects) : internal(std::move(objects)) { external = unpack_shared_const_vector(internal); } diff --git a/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp b/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp index 64483115c61..3bd07be98cb 100644 --- a/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp +++ b/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp @@ -26,7 +26,8 @@ class IndexedRootVolumeFinderBuilder final : public IRootVolumeFinderBuilder { public: /// @brief Constructor with binning casts /// @param binning the cast values for the grid binning - IndexedRootVolumeFinderBuilder(std::vector binning); + explicit IndexedRootVolumeFinderBuilder( + std::vector binning); /// The virtual interface definition for root volume finder builders /// diff --git a/Core/include/Acts/Detector/LayerStructureBuilder.hpp b/Core/include/Acts/Detector/LayerStructureBuilder.hpp index 02fd726824e..e2317d5a30b 100644 --- a/Core/include/Acts/Detector/LayerStructureBuilder.hpp +++ b/Core/include/Acts/Detector/LayerStructureBuilder.hpp @@ -58,7 +58,7 @@ class LayerStructureBuilder : public IInternalStructureBuilder { public: /// Constructor with predefined surfaces /// @param isurfaces is the vector of surfaces - SurfacesHolder(std::vector> isurfaces) + explicit SurfacesHolder(std::vector> isurfaces) : m_surfaces(std::move(isurfaces)) {} /// Return the surfaces from the holder diff --git a/Core/include/Acts/Detector/Portal.hpp b/Core/include/Acts/Detector/Portal.hpp index 3cdfce02dc4..5425d3cdc5b 100644 --- a/Core/include/Acts/Detector/Portal.hpp +++ b/Core/include/Acts/Detector/Portal.hpp @@ -47,7 +47,7 @@ class Portal { /// Constructor from surface w/o portal links /// /// @param surface is the representing surface - Portal(std::shared_ptr surface); + explicit Portal(std::shared_ptr surface); /// The vector of attached volumes forward/backward, this is useful in the /// geometry building diff --git a/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp b/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp index bd2d2063831..3070e691fc3 100644 --- a/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp +++ b/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp @@ -111,12 +111,12 @@ class GenericBoundTrackParameters { /// Parameters are not default constructible due to the charge type. GenericBoundTrackParameters() = delete; GenericBoundTrackParameters(const GenericBoundTrackParameters&) = default; - GenericBoundTrackParameters(GenericBoundTrackParameters&&) = default; + GenericBoundTrackParameters(GenericBoundTrackParameters&&) noexcept = default; ~GenericBoundTrackParameters() = default; GenericBoundTrackParameters& operator=(const GenericBoundTrackParameters&) = default; - GenericBoundTrackParameters& operator=(GenericBoundTrackParameters&&) = - default; + GenericBoundTrackParameters& operator=( + GenericBoundTrackParameters&&) noexcept = default; /// Parameters vector. ParametersVector& parameters() { return m_params; } diff --git a/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp b/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp index 9764ad68cfc..036aefa811b 100644 --- a/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp +++ b/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp @@ -91,13 +91,13 @@ class GenericCurvilinearTrackParameters GenericCurvilinearTrackParameters() = delete; GenericCurvilinearTrackParameters(const GenericCurvilinearTrackParameters&) = default; - GenericCurvilinearTrackParameters(GenericCurvilinearTrackParameters&&) = - default; + GenericCurvilinearTrackParameters( + GenericCurvilinearTrackParameters&&) noexcept = default; ~GenericCurvilinearTrackParameters() = default; GenericCurvilinearTrackParameters& operator=( const GenericCurvilinearTrackParameters&) = default; GenericCurvilinearTrackParameters& operator=( - GenericCurvilinearTrackParameters&&) = default; + GenericCurvilinearTrackParameters&&) noexcept = default; using GenericBoundTrackParameters::fourPosition; using GenericBoundTrackParameters::position; diff --git a/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp b/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp index b0499dd3137..a684c580e32 100644 --- a/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp +++ b/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp @@ -130,11 +130,12 @@ class GenericFreeTrackParameters { /// Parameters are not default constructible due to the charge type. GenericFreeTrackParameters() = delete; GenericFreeTrackParameters(const GenericFreeTrackParameters&) = default; - GenericFreeTrackParameters(GenericFreeTrackParameters&&) = default; + GenericFreeTrackParameters(GenericFreeTrackParameters&&) noexcept = default; ~GenericFreeTrackParameters() = default; GenericFreeTrackParameters& operator=(const GenericFreeTrackParameters&) = default; - GenericFreeTrackParameters& operator=(GenericFreeTrackParameters&&) = default; + GenericFreeTrackParameters& operator=(GenericFreeTrackParameters&&) noexcept = + default; /// Parameters vector. const ParametersVector& parameters() const { return m_params; } diff --git a/Core/include/Acts/EventData/MultiTrajectory.hpp b/Core/include/Acts/EventData/MultiTrajectory.hpp index 1951d558ee7..cb456f865e3 100644 --- a/Core/include/Acts/EventData/MultiTrajectory.hpp +++ b/Core/include/Acts/EventData/MultiTrajectory.hpp @@ -108,7 +108,7 @@ class TrackStateRange { ProxyType operator*() { return *proxy; } }; - TrackStateRange(ProxyType _begin) : m_begin{_begin} {} + explicit TrackStateRange(ProxyType _begin) : m_begin{_begin} {} TrackStateRange() : m_begin{std::nullopt} {} Iterator begin() { return m_begin; } diff --git a/Core/include/Acts/EventData/ProxyAccessor.hpp b/Core/include/Acts/EventData/ProxyAccessor.hpp index d6a9a3497ce..bf0a068d85b 100644 --- a/Core/include/Acts/EventData/ProxyAccessor.hpp +++ b/Core/include/Acts/EventData/ProxyAccessor.hpp @@ -70,11 +70,11 @@ struct ProxyAccessorBase { /// Create the accessor from an already-hashed string key /// @param _key the key - constexpr ProxyAccessorBase(HashedString _key) : key{_key} {} + explicit constexpr ProxyAccessorBase(HashedString _key) : key{_key} {} /// Create the accessor from a string key /// @param _key the key - constexpr ProxyAccessorBase(const std::string& _key) + explicit constexpr ProxyAccessorBase(const std::string& _key) : key{hashStringDynamic(_key)} {} /// Access the stored key on the proxy given as an argument. Mutable version diff --git a/Core/include/Acts/EventData/SourceLink.hpp b/Core/include/Acts/EventData/SourceLink.hpp index ba1515738e6..c1d69ff293b 100644 --- a/Core/include/Acts/EventData/SourceLink.hpp +++ b/Core/include/Acts/EventData/SourceLink.hpp @@ -29,9 +29,9 @@ class SourceLink final { public: SourceLink(const SourceLink& other) = default; - SourceLink(SourceLink&& other) = default; + SourceLink(SourceLink&& other) noexcept = default; SourceLink& operator=(const SourceLink& other) = default; - SourceLink& operator=(SourceLink&& other) = default; + SourceLink& operator=(SourceLink&& other) noexcept = default; /// Constructor from concrete source link /// @tparam T The source link type diff --git a/Core/include/Acts/EventData/TrackStateProxy.hpp b/Core/include/Acts/EventData/TrackStateProxy.hpp index 3d91547c725..e4a29ad3923 100644 --- a/Core/include/Acts/EventData/TrackStateProxy.hpp +++ b/Core/include/Acts/EventData/TrackStateProxy.hpp @@ -42,7 +42,7 @@ template class TransitiveConstPointer { public: TransitiveConstPointer() = default; - TransitiveConstPointer(T* ptr) : m_ptr{ptr} {} + explicit TransitiveConstPointer(T* ptr) : m_ptr{ptr} {} template TransitiveConstPointer(const TransitiveConstPointer& other) diff --git a/Core/include/Acts/EventData/VectorMultiTrajectory.hpp b/Core/include/Acts/EventData/VectorMultiTrajectory.hpp index 4238afd88f6..ee5a3b1729b 100644 --- a/Core/include/Acts/EventData/VectorMultiTrajectory.hpp +++ b/Core/include/Acts/EventData/VectorMultiTrajectory.hpp @@ -569,10 +569,10 @@ class ConstVectorMultiTrajectory final ConstVectorMultiTrajectory(const ConstVectorMultiTrajectory& other) : VectorMultiTrajectoryBase{other} {} - ConstVectorMultiTrajectory(const VectorMultiTrajectory& other) + explicit ConstVectorMultiTrajectory(const VectorMultiTrajectory& other) : VectorMultiTrajectoryBase{other} {} - ConstVectorMultiTrajectory(VectorMultiTrajectory&& other) + explicit ConstVectorMultiTrajectory(VectorMultiTrajectory&& other) : VectorMultiTrajectoryBase{std::move(other)} {} ConstVectorMultiTrajectory(ConstVectorMultiTrajectory&&) = default; diff --git a/Core/include/Acts/EventData/VectorTrackContainer.hpp b/Core/include/Acts/EventData/VectorTrackContainer.hpp index d0ce9cf402d..bcbe6a138af 100644 --- a/Core/include/Acts/EventData/VectorTrackContainer.hpp +++ b/Core/include/Acts/EventData/VectorTrackContainer.hpp @@ -282,13 +282,13 @@ class ConstVectorTrackContainer final ConstVectorTrackContainer() : VectorTrackContainerBase{} {} ConstVectorTrackContainer(const ConstVectorTrackContainer& other) = default; - ConstVectorTrackContainer(const VectorTrackContainer& other) + explicit ConstVectorTrackContainer(const VectorTrackContainer& other) : VectorTrackContainerBase{other} { assert(checkConsistency()); } ConstVectorTrackContainer(ConstVectorTrackContainer&&) = default; - ConstVectorTrackContainer(VectorTrackContainer&& other) + explicit ConstVectorTrackContainer(VectorTrackContainer&& other) : VectorTrackContainerBase{std::move(other)} { assert(checkConsistency()); } diff --git a/Core/include/Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp b/Core/include/Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp index 72cb0965507..3dc60fd1cb6 100644 --- a/Core/include/Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp +++ b/Core/include/Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp @@ -72,7 +72,7 @@ struct CorrectedFreeToBoundTransformer { /// Construct from a FreeToBoundCorrection /// /// @param freeToBoundCorrection The freeToBoundCorrection object - CorrectedFreeToBoundTransformer( + explicit CorrectedFreeToBoundTransformer( const FreeToBoundCorrection& freeToBoundCorrection); /// Default constructors diff --git a/Tests/UnitTests/Core/EventData/MultiTrajectoryTests.cpp b/Tests/UnitTests/Core/EventData/MultiTrajectoryTests.cpp index 421fcc3c62f..c5164308750 100644 --- a/Tests/UnitTests/Core/EventData/MultiTrajectoryTests.cpp +++ b/Tests/UnitTests/Core/EventData/MultiTrajectoryTests.cpp @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(ConstCorrectness) { } // is this something we actually want? - ConstVectorMultiTrajectory ct = t; + ConstVectorMultiTrajectory ct(t); BOOST_CHECK_EQUAL(ct.size(), t.size()); ConstVectorMultiTrajectory ctm{std::move(t)}; From c522a5ed91bc4306bde5b7371acc51d6662c51fc Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Fri, 10 Jan 2025 09:31:43 +0100 Subject: [PATCH 4/5] fixing missing Acts:: --- .../Kernel/detail/AlignmentEngine.hpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp b/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp index a5dacf69f50..643127cc200 100644 --- a/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp +++ b/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp @@ -100,14 +100,14 @@ void resetAlignmentDerivative(Acts::AlignmentToBoundMatrix& alignToBound, /// /// @return The track alignment state containing fundamental alignment /// ingredients -template +template TrackAlignmentState trackAlignmentState( const Acts::GeometryContext& gctx, const traj_t& multiTraj, const std::size_t& entryIndex, const std::pair>& globalTrackParamsCov, - const std::unordered_map& idxedAlignSurfaces, + const std::unordered_map& idxedAlignSurfaces, const AlignmentMask& alignMask) { using CovMatrix = typename parameters_t::CovarianceMatrix; @@ -164,7 +164,7 @@ TrackAlignmentState trackAlignmentState( // The alignment degree of freedom alignState.alignmentDof = eAlignmentSize * nAlignSurfaces; // Dimension of global track parameters (from only measurement states) - alignState.trackParametersDim = eBoundSize * measurementStates.size(); + alignState.trackParametersDim = Acts::eBoundSize * measurementStates.size(); // Initialize the alignment matrices with components from the measurement // states @@ -224,17 +224,17 @@ TrackAlignmentState trackAlignmentState( const auto surface = &state.referenceSurface(); alignState.alignedSurfaces.at(surface).second = iSurface; // The free parameters transformed from the smoothed parameters - const FreeVector freeParams = + const Acts::FreeVector freeParams = Acts::MultiTrajectoryHelpers::freeSmoothed(gctx, state); // The position - const Acts::Vector3 position = freeParams.segment<3>(eFreePos0); + const Acts::Vector3 position = freeParams.segment<3>(Acts::eFreePos0); // The direction - const Acts::Vector3 direction = freeParams.segment<3>(eFreeDir0); + const Acts::Vector3 direction = freeParams.segment<3>(Acts::eFreeDir0); // The derivative of free parameters w.r.t. path length. @note Here, we // assume a linear track model, i.e. neglecting the change of track // direction. Otherwise, we need to know the magnetic field at the free // parameters - Acts::FreeVector pathDerivative = FreeVector::Zero(); + Acts::FreeVector pathDerivative = Acts::FreeVector::Zero(); pathDerivative.head<3>() = direction; // Get the derivative of bound parameters w.r.t. alignment parameters Acts::AlignmentToBoundMatrix alignToBound = @@ -259,13 +259,13 @@ TrackAlignmentState trackAlignmentState( std::size_t colStateIndex = measurementStates.at(iColState).first; // Retrieve the block from the source covariance matrix CovMatrix correlation = - sourceTrackParamsCov.block( + sourceTrackParamsCov.block( stateRowIndices.at(rowStateIndex), stateRowIndices.at(colStateIndex)); // Fill the block of the target covariance matrix std::size_t iCol = - alignState.trackParametersDim - (iColState + 1) * eBoundSize; - alignState.trackParametersCovariance.block( + alignState.trackParametersDim - (iColState + 1) * Acts::eBoundSize; + alignState.trackParametersCovariance.block( iParams, iCol) = correlation; } } From e7fe53606c500ed0e8158c8cba30f55b075c0e3b Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Fri, 10 Jan 2025 09:55:54 +0100 Subject: [PATCH 5/5] more fixes of namespace --- .../Kernel/detail/AlignmentEngine.hpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp b/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp index 643127cc200..2151b102c14 100644 --- a/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp +++ b/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp @@ -107,7 +107,8 @@ TrackAlignmentState trackAlignmentState( const std::pair>& globalTrackParamsCov, - const std::unordered_map& idxedAlignSurfaces, + const std::unordered_map& + idxedAlignSurfaces, const AlignmentMask& alignMask) { using CovMatrix = typename parameters_t::CovarianceMatrix; @@ -162,7 +163,7 @@ TrackAlignmentState trackAlignmentState( } // The alignment degree of freedom - alignState.alignmentDof = eAlignmentSize * nAlignSurfaces; + alignState.alignmentDof = Acts::eAlignmentSize * nAlignSurfaces; // Dimension of global track parameters (from only measurement states) alignState.trackParametersDim = Acts::eBoundSize * measurementStates.size(); @@ -200,7 +201,7 @@ TrackAlignmentState trackAlignmentState( const std::size_t measdim = state.calibratedSize(); // Update index of current measurement and parameter iMeasurement -= measdim; - iParams -= eBoundSize; + iParams -= Acts::eBoundSize; // (a) Get and fill the measurement covariance matrix const Acts::ActsDynamicMatrix measCovariance = state.effectiveCalibratedCovariance(); @@ -210,9 +211,9 @@ TrackAlignmentState trackAlignmentState( // (b) Get and fill the bound parameters to measurement projection matrix const Acts::ActsDynamicMatrix H = state.projectorSubspaceHelper().fullProjector().topLeftCorner( - measdim, eBoundSize); + measdim, Acts::eBoundSize); alignState.projectionMatrix.block(iMeasurement, iParams, measdim, - eBoundSize) = H; + Acts::eBoundSize) = H; // (c) Get and fill the residual alignState.residual.segment(iMeasurement, measdim) = state.effectiveCalibrated() - H * state.smoothed(); @@ -247,8 +248,8 @@ TrackAlignmentState trackAlignmentState( // Residual is calculated as the (measurement - parameters), thus we need // a minus sign below alignState.alignmentToResidualDerivative.block( - iMeasurement, iSurface * eAlignmentSize, measdim, eAlignmentSize) = - -H * (alignToBound); + iMeasurement, iSurface * Acts::eAlignmentSize, measdim, + Acts::eAlignmentSize) = -H * (alignToBound); } // (e) Extract and fill the track parameters covariance matrix for only @@ -265,8 +266,9 @@ TrackAlignmentState trackAlignmentState( // Fill the block of the target covariance matrix std::size_t iCol = alignState.trackParametersDim - (iColState + 1) * Acts::eBoundSize; - alignState.trackParametersCovariance.block( - iParams, iCol) = correlation; + alignState.trackParametersCovariance + .block(iParams, iCol) = + correlation; } }