From 464fd468fc31c61e030f6db97189bb1c180892ff Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:54:58 +0200 Subject: [PATCH 1/2] chore: remove some unnecessary includes (#3700) Builds fine on GCC 14 and Clang 18. --- Core/include/Acts/EventData/SourceLink.hpp | 1 - .../Acts/Seeding/EstimateTrackParamsFromSeed.hpp | 2 -- .../Acts/TrackFinding/CombinatorialKalmanFilter.hpp | 13 ------------- .../TrackFinding/TrackFindingAlgorithm.hpp | 4 ---- .../TrackFinding/src/TrackFindingAlgorithm.cpp | 3 --- .../src/TrackFindingAlgorithmFunction.cpp | 11 +---------- .../src/TrackParamsEstimationAlgorithm.cpp | 3 --- .../DD4hepDetector/src/DD4hepGeometryService.cpp | 1 - Examples/Framework/ML/src/NeuralCalibrator.cpp | 1 + .../EventData/MeasurementCalibration.hpp | 1 - .../include/ActsExamples/EventData/SimSeed.hpp | 1 - .../ActsExamples/Framework/AlgorithmContext.hpp | 2 -- .../include/ActsExamples/Framework/IAlgorithm.hpp | 2 +- 13 files changed, 3 insertions(+), 42 deletions(-) diff --git a/Core/include/Acts/EventData/SourceLink.hpp b/Core/include/Acts/EventData/SourceLink.hpp index 5e032d11e4f..ba1515738e6 100644 --- a/Core/include/Acts/EventData/SourceLink.hpp +++ b/Core/include/Acts/EventData/SourceLink.hpp @@ -14,7 +14,6 @@ #include #include -#include #include #include diff --git a/Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp b/Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp index 4b491c6ddc5..11d38f2eea9 100644 --- a/Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp +++ b/Core/include/Acts/Seeding/EstimateTrackParamsFromSeed.hpp @@ -10,7 +10,6 @@ #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Definitions/Units.hpp" -#include "Acts/EventData/Seed.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Logger.hpp" @@ -20,7 +19,6 @@ #include #include #include -#include namespace Acts { /// @todo: diff --git a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp index b28b7372252..afb74140b8d 100644 --- a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp +++ b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp @@ -11,43 +11,30 @@ // Workaround for building on clang+libstdc++ #include "Acts/Utilities/detail/ReferenceWrapperAnyCompat.hpp" -#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Common.hpp" -#include "Acts/EventData/MeasurementHelpers.hpp" #include "Acts/EventData/MultiTrajectory.hpp" #include "Acts/EventData/MultiTrajectoryHelpers.hpp" -#include "Acts/EventData/ProxyAccessor.hpp" -#include "Acts/EventData/TrackContainer.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/TrackStatePropMask.hpp" #include "Acts/EventData/Types.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/MagneticField/MagneticFieldContext.hpp" -#include "Acts/Material/MaterialSlab.hpp" #include "Acts/Propagator/ActorList.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" -#include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/StandardAborters.hpp" #include "Acts/Propagator/detail/LoopProtection.hpp" #include "Acts/Propagator/detail/PointwiseMaterialInteraction.hpp" -#include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/TrackFinding/CombinatorialKalmanFilterError.hpp" #include "Acts/TrackFitting/KalmanFitter.hpp" #include "Acts/TrackFitting/detail/VoidFitterComponents.hpp" #include "Acts/Utilities/CalibrationContext.hpp" -#include "Acts/Utilities/HashedString.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Result.hpp" -#include "Acts/Utilities/TrackHelpers.hpp" -#include "Acts/Utilities/Zip.hpp" #include #include #include -#include -#include #include -#include namespace Acts { diff --git a/Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/TrackFindingAlgorithm.hpp b/Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/TrackFindingAlgorithm.hpp index 8a36481fc41..f63581470e6 100644 --- a/Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/TrackFindingAlgorithm.hpp +++ b/Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/TrackFindingAlgorithm.hpp @@ -8,12 +8,10 @@ #pragma once -#include "Acts/EventData/MultiTrajectory.hpp" #include "Acts/EventData/SourceLink.hpp" #include "Acts/EventData/TrackContainer.hpp" #include "Acts/EventData/TrackProxy.hpp" #include "Acts/EventData/VectorMultiTrajectory.hpp" -#include "Acts/EventData/VectorTrackContainer.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" #include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp" #include "Acts/TrackFinding/MeasurementSelector.hpp" @@ -28,11 +26,9 @@ #include "ActsExamples/Framework/DataHandle.hpp" #include "ActsExamples/Framework/IAlgorithm.hpp" #include "ActsExamples/Framework/ProcessCode.hpp" -#include "ActsExamples/MagneticField/MagneticField.hpp" #include #include -#include #include #include #include diff --git a/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithm.cpp b/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithm.cpp index a6d5efc69e6..cca2fe7dfef 100644 --- a/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithm.cpp +++ b/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithm.cpp @@ -28,13 +28,10 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp" #include "Acts/TrackFitting/GainMatrixUpdater.hpp" -#include "Acts/TrackFitting/KalmanFitter.hpp" -#include "Acts/Utilities/Delegate.hpp" #include "Acts/Utilities/Enumerate.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/TrackHelpers.hpp" #include "ActsExamples/EventData/IndexSourceLink.hpp" -#include "ActsExamples/EventData/Measurement.hpp" #include "ActsExamples/EventData/MeasurementCalibration.hpp" #include "ActsExamples/EventData/SimSeed.hpp" #include "ActsExamples/EventData/Track.hpp" diff --git a/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithmFunction.cpp b/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithmFunction.cpp index aaed21134d3..65e0cf41970 100644 --- a/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithmFunction.cpp +++ b/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithmFunction.cpp @@ -6,26 +6,17 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -#include "Acts/Definitions/Direction.hpp" -#include "Acts/EventData/MultiTrajectory.hpp" #include "Acts/EventData/TrackContainer.hpp" -#include "Acts/EventData/TrackStatePropMask.hpp" -#include "Acts/EventData/VectorMultiTrajectory.hpp" -#include "Acts/EventData/VectorTrackContainer.hpp" #include "Acts/Propagator/Navigator.hpp" #include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/SympyStepper.hpp" #include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp" -#include "Acts/TrackFitting/GainMatrixSmoother.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/EventData/Track.hpp" #include "ActsExamples/TrackFinding/TrackFindingAlgorithm.hpp" -#include -#include #include #include -#include namespace Acts { class MagneticFieldProvider; @@ -53,7 +44,7 @@ struct TrackFinderFunctionImpl ActsExamples::TrackProxy rootBranch) const override { return trackFinder.findTracks(initialParameters, options, tracks, rootBranch); - }; + } }; } // namespace diff --git a/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp b/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp index 880e1571517..a54b10d2e7d 100644 --- a/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp +++ b/Examples/Algorithms/TrackFinding/src/TrackParamsEstimationAlgorithm.cpp @@ -10,12 +10,9 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" -#include "Acts/EventData/ParticleHypothesis.hpp" #include "Acts/EventData/Seed.hpp" -#include "Acts/EventData/SourceLink.hpp" #include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/MagneticField/MagneticFieldProvider.hpp" #include "Acts/Seeding/EstimateTrackParamsFromSeed.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Result.hpp" diff --git a/Examples/Detectors/DD4hepDetector/src/DD4hepGeometryService.cpp b/Examples/Detectors/DD4hepDetector/src/DD4hepGeometryService.cpp index 6856ff94a5c..2912e39b757 100644 --- a/Examples/Detectors/DD4hepDetector/src/DD4hepGeometryService.cpp +++ b/Examples/Detectors/DD4hepDetector/src/DD4hepGeometryService.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include diff --git a/Examples/Framework/ML/src/NeuralCalibrator.cpp b/Examples/Framework/ML/src/NeuralCalibrator.cpp index ee1a8566aa4..68d24d35468 100644 --- a/Examples/Framework/ML/src/NeuralCalibrator.cpp +++ b/Examples/Framework/ML/src/NeuralCalibrator.cpp @@ -14,6 +14,7 @@ #include "Acts/Utilities/CalibrationContext.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/UnitVectors.hpp" +#include "ActsExamples/EventData/IndexSourceLink.hpp" #include "ActsExamples/EventData/Measurement.hpp" #include diff --git a/Examples/Framework/include/ActsExamples/EventData/MeasurementCalibration.hpp b/Examples/Framework/include/ActsExamples/EventData/MeasurementCalibration.hpp index 248edacc032..f0b61363fba 100644 --- a/Examples/Framework/include/ActsExamples/EventData/MeasurementCalibration.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/MeasurementCalibration.hpp @@ -14,7 +14,6 @@ #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Utilities/CalibrationContext.hpp" #include "ActsExamples/EventData/Cluster.hpp" -#include "ActsExamples/EventData/IndexSourceLink.hpp" #include #include diff --git a/Examples/Framework/include/ActsExamples/EventData/SimSeed.hpp b/Examples/Framework/include/ActsExamples/EventData/SimSeed.hpp index 627b160b08f..5c211673f2a 100644 --- a/Examples/Framework/include/ActsExamples/EventData/SimSeed.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/SimSeed.hpp @@ -11,7 +11,6 @@ #include "Acts/EventData/Seed.hpp" #include "ActsExamples/EventData/SimSpacePoint.hpp" -#include #include namespace ActsExamples { diff --git a/Examples/Framework/include/ActsExamples/Framework/AlgorithmContext.hpp b/Examples/Framework/include/ActsExamples/Framework/AlgorithmContext.hpp index f78e5b9c798..c70eaea6539 100644 --- a/Examples/Framework/include/ActsExamples/Framework/AlgorithmContext.hpp +++ b/Examples/Framework/include/ActsExamples/Framework/AlgorithmContext.hpp @@ -13,8 +13,6 @@ #include #include -#include - namespace ActsExamples { class WhiteBoard; diff --git a/Examples/Framework/include/ActsExamples/Framework/IAlgorithm.hpp b/Examples/Framework/include/ActsExamples/Framework/IAlgorithm.hpp index 46856ed7103..77fd2b41c98 100644 --- a/Examples/Framework/include/ActsExamples/Framework/IAlgorithm.hpp +++ b/Examples/Framework/include/ActsExamples/Framework/IAlgorithm.hpp @@ -44,7 +44,7 @@ class IAlgorithm : public SequenceElement { /// @param context The algorithm context ProcessCode internalExecute(const AlgorithmContext& context) final { return execute(context); - }; + } /// Initialize the algorithm ProcessCode initialize() override { return ProcessCode::SUCCESS; } From 94698b3af583afbac4c3bb18018c7dde16477945 Mon Sep 17 00:00:00 2001 From: Benjamin Huth <37871400+benjaminhuth@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:39:36 +0200 Subject: [PATCH 2/2] fix: Copy whole trackstate did not copy calibrated (#3693) Know your defaults... --- .../Acts/EventData/TrackStateProxy.hpp | 3 ++- .../Core/EventData/TrackTestsExtra.cpp | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Core/include/Acts/EventData/TrackStateProxy.hpp b/Core/include/Acts/EventData/TrackStateProxy.hpp index bed0061ecbf..34de86cd3d7 100644 --- a/Core/include/Acts/EventData/TrackStateProxy.hpp +++ b/Core/include/Acts/EventData/TrackStateProxy.hpp @@ -1043,8 +1043,9 @@ class TrackStateProxy { jacobian() = other.jacobian(); } + // NOTE: we should not check hasCalibrated on this, since it + // may be not yet allocated if (ACTS_CHECK_BIT(mask, PM::Calibrated) && - has() && other.template has()) { allocateCalibrated(other.calibratedSize()); diff --git a/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp b/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp index 2c16463ebe1..ca444466216 100644 --- a/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp +++ b/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp @@ -447,4 +447,24 @@ BOOST_AUTO_TEST_CASE(ReverseTrackStates) { } } +BOOST_AUTO_TEST_CASE(CopyTrackProxyCalibrated) { + VectorTrackContainer vtc{}; + VectorMultiTrajectory mtj{}; + TrackContainer tc{vtc, mtj}; + + constexpr static std::size_t kMeasurementSize = 3; + + auto track1 = tc.makeTrack(); + auto ts = track1.appendTrackState(TrackStatePropMask::Calibrated); + ts.allocateCalibrated(kMeasurementSize); + ts.calibrated() = Vector3::Ones(); + ts.calibratedCovariance() = SquareMatrix3::Identity(); + ts.setSubspaceIndices(BoundSubspaceIndices{}); + + auto tsCopy = track1.appendTrackState(TrackStatePropMask::Calibrated); + tsCopy.copyFrom(ts, TrackStatePropMask::Calibrated, false); + + BOOST_CHECK_EQUAL(ts.calibratedSize(), tsCopy.calibratedSize()); +} + BOOST_AUTO_TEST_SUITE_END()