diff --git a/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp b/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp index b26175abcdd..2151b102c14 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; }; @@ -101,14 +100,15 @@ void resetAlignmentDerivative(Acts::AlignmentToBoundMatrix& alignToBound, /// /// @return The track alignment state containing fundamental alignment /// ingredients -template +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, + const std::unordered_map& + idxedAlignSurfaces, const AlignmentMask& alignMask) { using CovMatrix = typename parameters_t::CovarianceMatrix; @@ -136,7 +136,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 @@ -163,26 +163,27 @@ 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 = eBoundSize * measurementStates.size(); + alignState.trackParametersDim = Acts::eBoundSize * measurementStates.size(); // 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. @@ -200,19 +201,19 @@ 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 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); + 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(); @@ -224,21 +225,22 @@ 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 Vector3 position = freeParams.segment<3>(eFreePos0); + const Acts::Vector3 position = freeParams.segment<3>(Acts::eFreePos0); // The direction - const 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 - 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 - 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); @@ -246,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 @@ -258,14 +260,15 @@ 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( - iParams, iCol) = correlation; + alignState.trackParametersDim - (iColState + 1) * Acts::eBoundSize; + alignState.trackParametersCovariance + .block(iParams, iCol) = + correlation; } } @@ -274,11 +277,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)};