From c0d63d3c38cb8fc4186fa63d5c65bcef593c705b Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Mon, 18 Dec 2023 16:00:22 +0100 Subject: [PATCH 1/3] remove input_track_t from more types --- .../AdaptiveGridDensityVertexFinder.hpp | 38 +--------- .../Vertexing/AdaptiveMultiVertexFinder.hpp | 29 ++------ .../Vertexing/AdaptiveMultiVertexFitter.hpp | 23 +----- .../Vertexing/AdaptiveMultiVertexFitter.ipp | 72 +++++++++---------- .../Acts/Vertexing/GaussianTrackDensity.hpp | 1 - .../Acts/Vertexing/GaussianTrackDensity.ipp | 28 ++++---- .../Acts/Vertexing/ImpactPointEstimator.hpp | 2 +- .../Acts/Vertexing/ImpactPointEstimator.ipp | 38 +++++----- .../Acts/Vertexing/IterativeVertexFinder.hpp | 2 +- .../Acts/Vertexing/KalmanVertexUpdater.hpp | 2 +- .../Acts/Vertexing/KalmanVertexUpdater.ipp | 6 +- Core/include/Acts/Vertexing/TrackAtVertex.hpp | 4 ++ .../Vertexing/TrackDensityVertexFinder.hpp | 45 ++---------- .../Acts/Vertexing/ZScanVertexFinder.hpp | 30 ++------ .../AdaptiveMultiVertexFinderAlgorithm.hpp | 6 +- .../IterativeVertexFinderAlgorithm.hpp | 7 +- .../AdaptiveMultiVertexFinderAlgorithm.cpp | 14 ++-- .../src/IterativeVertexFinderAlgorithm.cpp | 3 +- .../AdaptiveMultiVertexFinderTests.cpp | 41 +++++------ .../AdaptiveMultiVertexFitterTests.cpp | 36 ++++------ .../GridDensityVertexFinderTests.cpp | 6 +- .../Vertexing/ImpactPointEstimatorTests.cpp | 6 +- .../Vertexing/IterativeVertexFinderTests.cpp | 10 +-- .../KalmanVertexTrackUpdaterTests.cpp | 2 +- .../Vertexing/KalmanVertexUpdaterTests.cpp | 3 +- .../TrackDensityVertexFinderTests.cpp | 19 +++-- .../Core/Vertexing/ZScanVertexFinderTests.cpp | 6 +- 27 files changed, 165 insertions(+), 314 deletions(-) diff --git a/Core/include/Acts/Vertexing/AdaptiveGridDensityVertexFinder.hpp b/Core/include/Acts/Vertexing/AdaptiveGridDensityVertexFinder.hpp index 1d04f7b9066..4bf38a5f1bc 100644 --- a/Core/include/Acts/Vertexing/AdaptiveGridDensityVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/AdaptiveGridDensityVertexFinder.hpp @@ -32,7 +32,6 @@ namespace Acts { /// @tparam vfitter_t Vertex fitter type template > class AdaptiveGridDensityVertexFinder { - using InputTrack_t = typename vfitter_t::InputTrack_t; using GridDensity = AdaptiveGridTrackDensity; public: @@ -95,45 +94,16 @@ class AdaptiveGridDensityVertexFinder { const VertexingOptions& vertexingOptions, State& state) const; - /// @brief Constructor used if InputTrack_t type == BoundTrackParameters + /// @brief Constructor for user-defined InputTrack type /// /// @param cfg Configuration object - template < - typename T = InputTrack_t, - std::enable_if_t::value, int> = 0> - AdaptiveGridDensityVertexFinder(const Config& cfg) - : m_cfg(cfg), m_extractParameters([](const InputTrack& params) { - return *params.as(); - }) {} - - /// @brief Default constructor used if InputTrack_t type == - /// BoundTrackParameters - template < - typename T = InputTrack_t, - std::enable_if_t::value, int> = 0> - AdaptiveGridDensityVertexFinder() - : m_extractParameters([](T params) { return params; }) {} - - /// @brief Constructor for user-defined InputTrack_t type =! - /// BoundTrackParameters - /// - /// @param cfg Configuration object - /// @param func Function extracting BoundTrackParameters from InputTrack_t - /// object + /// @param func Function extracting BoundTrackParameters from InputTrack + /// object AdaptiveGridDensityVertexFinder( const Config& cfg, const std::function& func) : m_cfg(cfg), m_extractParameters(func) {} - /// @brief Constructor for user-defined InputTrack_t type =! - /// BoundTrackParameters with default Config object - /// - /// @param func Function extracting BoundTrackParameters from InputTrack_t - /// object - AdaptiveGridDensityVertexFinder( - const std::function& func) - : m_extractParameters(func) {} - private: /// @brief Checks if a track passes the selection criteria for seeding /// @@ -146,8 +116,6 @@ class AdaptiveGridDensityVertexFinder { const Config m_cfg; /// @brief Function to extract track parameters, - /// InputTrack_t objects are BoundTrackParameters by default, function to be - /// overwritten to return BoundTrackParameters for other InputTrack_t objects. std::function m_extractParameters; }; diff --git a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp index e6d56a1cc26..d7d3f2d2c80 100644 --- a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp @@ -34,7 +34,6 @@ namespace Acts { template class AdaptiveMultiVertexFinder { using Propagator_t = typename vfitter_t::Propagator_t; - using InputTrack_t = typename vfitter_t::InputTrack_t; using Linearizer_t = typename vfitter_t::Linearizer_t; using FitterState_t = typename vfitter_t::State; using SeedFinderState_t = typename sfinder_t::State; @@ -59,8 +58,8 @@ class AdaptiveMultiVertexFinder { /// @param lin Track linearizer /// @param bIn Input magnetic field Config(vfitter_t fitter, sfinder_t sfinder, - ImpactPointEstimator ipEst, - Linearizer_t lin, std::shared_ptr bIn) + ImpactPointEstimator ipEst, Linearizer_t lin, + std::shared_ptr bIn) : vertexFitter(std::move(fitter)), seedFinder(std::move(sfinder)), ipEstimator(std::move(ipEst)), @@ -74,7 +73,7 @@ class AdaptiveMultiVertexFinder { sfinder_t seedFinder; // ImpactPointEstimator - ImpactPointEstimator ipEstimator; + ImpactPointEstimator ipEstimator; // Track linearizer Linearizer_t linearizer; @@ -168,29 +167,11 @@ class AdaptiveMultiVertexFinder { /// State struct for fulfilling interface struct State {}; - /// @brief Constructor used if InputTrack_t type == BoundTrackParameters - /// - /// @param cfg Configuration object - /// @param logger The logging instance - template < - typename T = InputTrack_t, - std::enable_if_t::value, int> = 0> - AdaptiveMultiVertexFinder(Config cfg, - std::unique_ptr logger = - getDefaultLogger("AdaptiveMultiVertexFinder", - Logging::INFO)) - : m_cfg(std::move(cfg)), - m_extractParameters([](const InputTrack& params) { - return *params.as(); - }), - m_logger(std::move(logger)) {} - /// @brief Constructor for user-defined InputTrack_t type != /// BoundTrackParameters /// /// @param cfg Configuration object - /// @param func Function extracting BoundTrackParameters from InputTrack_t - /// object + /// @param func Function extracting BoundTrackParameters from InputTrack /// @param logger The logging instance AdaptiveMultiVertexFinder( Config cfg, std::function func, @@ -219,8 +200,6 @@ class AdaptiveMultiVertexFinder { Config m_cfg; /// @brief Function to extract track parameters, - /// InputTrack_t objects are BoundTrackParameters by default, function to be - /// overwritten to return BoundTrackParameters for other InputTrack_t objects. std::function m_extractParameters; /// Logging instance diff --git a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp index 6589b29206a..b5fc8c41f67 100644 --- a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp +++ b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp @@ -34,20 +34,18 @@ namespace Acts { /// /////////////////////////////////////////////////////////////////////////// /// -/// @tparam input_track_t Track object type /// @tparam linearizer_t Track linearizer type -template +template class AdaptiveMultiVertexFitter { static_assert(LinearizerConcept, "Linearizer does not fulfill linearizer concept."); public: - using InputTrack_t = input_track_t; using Propagator_t = typename linearizer_t::Propagator_t; using Linearizer_t = linearizer_t; private: - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; public: /// @brief The fitter state @@ -153,23 +151,6 @@ class AdaptiveMultiVertexFitter { bool useTime{false}; }; - /// @brief Constructor used if InputTrack_t type == BoundTrackParameters - /// - /// @param cfg Configuration object - /// @param logger The logging instance - template < - typename T = InputTrack_t, - std::enable_if_t::value, int> = 0> - AdaptiveMultiVertexFitter(Config cfg, - std::unique_ptr logger = - getDefaultLogger("AdaptiveMultiVertexFitter", - Logging::INFO)) - : m_cfg(std::move(cfg)), - m_extractParameters([](const InputTrack& params) { - return *params.as(); - }), - m_logger(std::move(logger)) {} - /// @brief Constructor for user-defined InputTrack_t type != /// BoundTrackParameters /// diff --git a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.ipp b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.ipp index 0f5e715db28..4675bc8d145 100644 --- a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.ipp +++ b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.ipp @@ -10,9 +10,8 @@ #include "Acts/Vertexing/KalmanVertexUpdater.hpp" #include "Acts/Vertexing/VertexingError.hpp" -template -Acts::Result -Acts::AdaptiveMultiVertexFitter::fit( +template +Acts::Result Acts::AdaptiveMultiVertexFitter::fit( State& state, const linearizer_t& linearizer, const VertexingOptions& vertexingOptions) const { // Reset annealing tool @@ -116,9 +115,8 @@ Acts::AdaptiveMultiVertexFitter::fit( return {}; } -template -Acts::Result -Acts::AdaptiveMultiVertexFitter::addVtxToFit( +template +Acts::Result Acts::AdaptiveMultiVertexFitter::addVtxToFit( State& state, Vertex& newVertex, const linearizer_t& linearizer, const VertexingOptions& vertexingOptions) const { if (state.vtxInfoMap[&newVertex].trackLinks.empty()) { @@ -191,17 +189,16 @@ Acts::AdaptiveMultiVertexFitter::addVtxToFit( return {}; } -template -bool Acts::AdaptiveMultiVertexFitter:: - isAlreadyInList(Vertex* vtx, const std::vector& vertices) const { +template +bool Acts::AdaptiveMultiVertexFitter::isAlreadyInList( + Vertex* vtx, const std::vector& vertices) const { return std::find(vertices.begin(), vertices.end(), vtx) != vertices.end(); } -template -Acts::Result Acts:: - AdaptiveMultiVertexFitter::prepareVertexForFit( - State& state, Vertex* vtx, - const VertexingOptions& vertexingOptions) const { +template +Acts::Result +Acts::AdaptiveMultiVertexFitter::prepareVertexForFit( + State& state, Vertex* vtx, const VertexingOptions& vertexingOptions) const { // Vertex info object auto& vtxInfo = state.vtxInfoMap[vtx]; // Vertex seed position @@ -221,12 +218,10 @@ Acts::Result Acts:: return {}; } -template -Acts::Result Acts::AdaptiveMultiVertexFitter< - input_track_t, - linearizer_t>::setAllVertexCompatibilities(State& state, Vertex* vtx, - const VertexingOptions& - vertexingOptions) const { +template +Acts::Result +Acts::AdaptiveMultiVertexFitter::setAllVertexCompatibilities( + State& state, Vertex* vtx, const VertexingOptions& vertexingOptions) const { VertexInfo& vtxInfo = state.vtxInfoMap[vtx]; // Loop over all tracks that are associated with vtx and estimate their @@ -265,11 +260,11 @@ Acts::Result Acts::AdaptiveMultiVertexFitter< return {}; } -template -Acts::Result Acts:: - AdaptiveMultiVertexFitter::setWeightsAndUpdate( - State& state, const linearizer_t& linearizer, - const VertexingOptions& vertexingOptions) const { +template +Acts::Result +Acts::AdaptiveMultiVertexFitter::setWeightsAndUpdate( + State& state, const linearizer_t& linearizer, + const VertexingOptions& vertexingOptions) const { for (auto vtx : state.vertexCollection) { VertexInfo& vtxInfo = state.vtxInfoMap[vtx]; @@ -308,11 +303,9 @@ Acts::Result Acts:: // corresponds to the number of fitted vertex dimensions (i.e., 3 if we // only fit spatial coordinates and 4 if we also fit time). if (m_cfg.useTime) { - KalmanVertexUpdater::updateVertexWithTrack( - *vtx, trkAtVtx); + KalmanVertexUpdater::updateVertexWithTrack<4>(*vtx, trkAtVtx); } else { - KalmanVertexUpdater::updateVertexWithTrack( - *vtx, trkAtVtx); + KalmanVertexUpdater::updateVertexWithTrack<3>(*vtx, trkAtVtx); } } else { ACTS_VERBOSE("Track weight too low. Skip track."); @@ -324,9 +317,8 @@ Acts::Result Acts:: return {}; } -template -std::vector -Acts::AdaptiveMultiVertexFitter:: +template +std::vector Acts::AdaptiveMultiVertexFitter:: collectTrackToVertexCompatibilities(State& state, const InputTrack& trk) const { // Compatibilities of trk wrt all of its associated vertices @@ -350,9 +342,9 @@ Acts::AdaptiveMultiVertexFitter:: return trkToVtxCompatibilities; } -template -bool Acts::AdaptiveMultiVertexFitter< - input_track_t, linearizer_t>::checkSmallShift(State& state) const { +template +bool Acts::AdaptiveMultiVertexFitter::checkSmallShift( + State& state) const { for (auto* vtx : state.vertexCollection) { Vector3 diff = state.vtxInfoMap[vtx].oldPosition.template head<3>() - vtx->position(); @@ -365,9 +357,9 @@ bool Acts::AdaptiveMultiVertexFitter< return true; } -template -void Acts::AdaptiveMultiVertexFitter< - input_track_t, linearizer_t>::doVertexSmoothing(State& state) const { +template +void Acts::AdaptiveMultiVertexFitter::doVertexSmoothing( + State& state) const { for (const auto vtx : state.vertexCollection) { for (const auto& trk : state.vtxInfoMap[vtx].trackLinks) { auto& trkAtVtx = state.tracksAtVerticesMap.at(std::make_pair(trk, vtx)); @@ -384,8 +376,8 @@ void Acts::AdaptiveMultiVertexFitter< } } -template -void Acts::AdaptiveMultiVertexFitter::logDebugData( +template +void Acts::AdaptiveMultiVertexFitter::logDebugData( const State& state, const Acts::GeometryContext& geoContext) const { ACTS_DEBUG("Encountered an error when fitting the following " << state.vertexCollection.size() << " vertices:"); diff --git a/Core/include/Acts/Vertexing/GaussianTrackDensity.hpp b/Core/include/Acts/Vertexing/GaussianTrackDensity.hpp index 05f395a0c63..3f3904ba397 100644 --- a/Core/include/Acts/Vertexing/GaussianTrackDensity.hpp +++ b/Core/include/Acts/Vertexing/GaussianTrackDensity.hpp @@ -21,7 +21,6 @@ namespace Acts { /// @brief Class to model tracks as 2D density functions based on /// their d0 and z0 perigee parameters (mean value) and covariance /// matrices (determining the width of the function) -template class GaussianTrackDensity { // @TODO: Remove template public: diff --git a/Core/include/Acts/Vertexing/GaussianTrackDensity.ipp b/Core/include/Acts/Vertexing/GaussianTrackDensity.ipp index 246a49d7fa1..edd99c03f85 100644 --- a/Core/include/Acts/Vertexing/GaussianTrackDensity.ipp +++ b/Core/include/Acts/Vertexing/GaussianTrackDensity.ipp @@ -12,9 +12,9 @@ namespace Acts { -template + inline std::pair -Acts::GaussianTrackDensity::globalMaximumWithWidth( +Acts::GaussianTrackDensity::globalMaximumWithWidth( State& state, const std::vector& trackList, const std::function& extractParameters) const { @@ -66,16 +66,16 @@ Acts::GaussianTrackDensity::globalMaximumWithWidth( std::sqrt(-(maxDensity / maxSecondDerivative))); } -template -double Acts::GaussianTrackDensity::globalMaximum( +inline +double Acts::GaussianTrackDensity::globalMaximum( State& state, const std::vector& trackList, const std::function& extractParameters) const { return globalMaximumWithWidth(state, trackList, extractParameters).first; } -template -Result Acts::GaussianTrackDensity::addTracks( +inline +Result Acts::GaussianTrackDensity::addTracks( State& state, const std::vector& trackList, const std::function& extractParameters) const { @@ -130,9 +130,9 @@ Result Acts::GaussianTrackDensity::addTracks( return Result::success(); } -template +inline std::tuple -Acts::GaussianTrackDensity::trackDensityAndDerivatives( +Acts::GaussianTrackDensity::trackDensityAndDerivatives( State& state, double z) const { GaussianTrackDensityStore densityResult(z); for (const auto& trackEntry : state.trackEntries) { @@ -141,9 +141,9 @@ Acts::GaussianTrackDensity::trackDensityAndDerivatives( return densityResult.densityAndDerivatives(); } -template +inline std::tuple -Acts::GaussianTrackDensity::updateMaximum( +Acts::GaussianTrackDensity::updateMaximum( double newZ, double newValue, double newSecondDerivative, double maxZ, double maxValue, double maxSecondDerivative) const { if (newValue > maxValue) { @@ -154,14 +154,14 @@ Acts::GaussianTrackDensity::updateMaximum( return {maxZ, maxValue, maxSecondDerivative}; } -template -double Acts::GaussianTrackDensity::stepSize(double y, double dy, +inline +double Acts::GaussianTrackDensity::stepSize(double y, double dy, double ddy) const { return (m_cfg.isGaussianShaped ? (y * dy) / (dy * dy - y * ddy) : -dy / ddy); } -template -void Acts::GaussianTrackDensity::GaussianTrackDensityStore:: +inline +void Acts::GaussianTrackDensity::GaussianTrackDensityStore:: addTrackToDensity(const TrackEntry& entry) { // Take track only if it's within bounds if (entry.lowerBound < m_z && m_z < entry.upperBound) { diff --git a/Core/include/Acts/Vertexing/ImpactPointEstimator.hpp b/Core/include/Acts/Vertexing/ImpactPointEstimator.hpp index b762e6ddb22..ae75b9ab8f7 100644 --- a/Core/include/Acts/Vertexing/ImpactPointEstimator.hpp +++ b/Core/include/Acts/Vertexing/ImpactPointEstimator.hpp @@ -43,7 +43,7 @@ struct ImpactParametersAndSigma { /// A description of the underlying mathematics can be found here: /// https://github.com/acts-project/acts/pull/2506 /// TODO: Upload reference at a better place -template > class ImpactPointEstimator { public: diff --git a/Core/include/Acts/Vertexing/ImpactPointEstimator.ipp b/Core/include/Acts/Vertexing/ImpactPointEstimator.ipp index 7d051708f52..b7ff56c2207 100644 --- a/Core/include/Acts/Vertexing/ImpactPointEstimator.ipp +++ b/Core/include/Acts/Vertexing/ImpactPointEstimator.ipp @@ -11,10 +11,10 @@ #include "Acts/Surfaces/PlaneSurface.hpp" #include "Acts/Vertexing/VertexingError.hpp" -template Acts::Result -Acts::ImpactPointEstimator:: +Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: calculateDistance(const GeometryContext& gctx, const BoundTrackParameters& trkParams, const Vector3& vtxPos, State& state) const { @@ -28,10 +28,10 @@ Acts::ImpactPointEstimator:: return res.value().first.norm(); } -template Acts::Result -Acts::ImpactPointEstimator:: +Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: estimate3DImpactParameters(const GeometryContext& gctx, const Acts::MagneticFieldContext& mctx, const BoundTrackParameters& trkParams, @@ -106,11 +106,11 @@ Acts::ImpactPointEstimator:: } } -template template Acts::Result -Acts::ImpactPointEstimator:: +Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: getVertexCompatibility(const GeometryContext& gctx, const BoundTrackParameters* trkParams, const ActsVector& vertexPos) const { @@ -176,10 +176,10 @@ Acts::ImpactPointEstimator:: return residual.dot(weight * residual); } -template Acts::Result Acts::ImpactPointEstimator< - input_track_t, propagator_t, + propagator_t, propagator_options_t>::performNewtonOptimization(const Vector3& helixCenter, const Vector3& vtxPos, double phi, double theta, @@ -234,11 +234,11 @@ Acts::Result Acts::ImpactPointEstimator< return phi; } -template template Acts::Result, Acts::Vector3>> -Acts::ImpactPointEstimator:: +Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: getDistanceAndMomentum(const GeometryContext& gctx, const BoundTrackParameters& trkParams, const ActsVector& vtxPos, State& state) const { @@ -372,11 +372,12 @@ Acts::ImpactPointEstimator:: return std::make_pair(deltaR, momDir); } -template Acts::Result -Acts::ImpactPointEstimator:: - getImpactParameters(const BoundTrackParameters& track, const Vertex& vtx, +Acts::ImpactPointEstimator:: + getImpactParameters(const BoundTrackParameters& track, + const Vertex& vtx, const GeometryContext& gctx, const Acts::MagneticFieldContext& mctx, bool calculateTimeIP) const { @@ -458,11 +459,12 @@ Acts::ImpactPointEstimator:: return ipAndSigma; } -template Acts::Result> -Acts::ImpactPointEstimator:: - getLifetimeSignOfTrack(const BoundTrackParameters& track, const Vertex& vtx, +Acts::ImpactPointEstimator:: + getLifetimeSignOfTrack(const BoundTrackParameters& track, + const Vertex& vtx, const Acts::Vector3& direction, const GeometryContext& gctx, const MagneticFieldContext& mctx) const { @@ -501,10 +503,10 @@ Acts::ImpactPointEstimator:: return vszs; } -template Acts::Result -Acts::ImpactPointEstimator:: +Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: get3DLifetimeSignOfTrack(const BoundTrackParameters& track, const Vertex& vtx, const Acts::Vector3& direction, const GeometryContext& gctx, diff --git a/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp b/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp index 91528b619ab..53dfa081831 100644 --- a/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp @@ -65,7 +65,7 @@ class IterativeVertexFinder { public: using InputTrack_t = typename vfitter_t::InputTrack_t; - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; /// Configuration struct struct Config { diff --git a/Core/include/Acts/Vertexing/KalmanVertexUpdater.hpp b/Core/include/Acts/Vertexing/KalmanVertexUpdater.hpp index e742045cecf..159a3db1060 100644 --- a/Core/include/Acts/Vertexing/KalmanVertexUpdater.hpp +++ b/Core/include/Acts/Vertexing/KalmanVertexUpdater.hpp @@ -65,7 +65,7 @@ struct Cache { /// /// @param vtx Vertex to be updated /// @param trk Track to be used for updating the vertex -template +template void updateVertexWithTrack(Vertex& vtx, TrackAtVertex& trk); namespace detail { diff --git a/Core/include/Acts/Vertexing/KalmanVertexUpdater.ipp b/Core/include/Acts/Vertexing/KalmanVertexUpdater.ipp index 8ed1bf2dba4..37bb9d7fd46 100644 --- a/Core/include/Acts/Vertexing/KalmanVertexUpdater.ipp +++ b/Core/include/Acts/Vertexing/KalmanVertexUpdater.ipp @@ -8,9 +8,9 @@ #include -template -void Acts::KalmanVertexUpdater::updateVertexWithTrack(Vertex& vtx, - TrackAtVertex& trk) { +template +void Acts::KalmanVertexUpdater::updateVertexWithTrack( + Vertex& vtx, TrackAtVertex& trk) { std::pair fitQuality = vtx.fitQuality(); detail::updateVertexWithTrack(vtx.fullPosition(), vtx.fullCovariance(), fitQuality, trk, 1, nDimVertex); diff --git a/Core/include/Acts/Vertexing/TrackAtVertex.hpp b/Core/include/Acts/Vertexing/TrackAtVertex.hpp index 397cf199fda..944f664c09d 100644 --- a/Core/include/Acts/Vertexing/TrackAtVertex.hpp +++ b/Core/include/Acts/Vertexing/TrackAtVertex.hpp @@ -57,6 +57,10 @@ struct InputTrack { friend struct std::hash; + static BoundTrackParameters extractParameters(const InputTrack& track) { + return *track.as(); + } + private: std::type_index m_type; const void* m_ptr; diff --git a/Core/include/Acts/Vertexing/TrackDensityVertexFinder.hpp b/Core/include/Acts/Vertexing/TrackDensityVertexFinder.hpp index c13796b2be2..da28c770022 100644 --- a/Core/include/Acts/Vertexing/TrackDensityVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/TrackDensityVertexFinder.hpp @@ -31,9 +31,7 @@ namespace Acts { /// /// @tparam vfitter_t The vertex fitter type (needed to fulfill concept) /// @tparam track_density_t The track density type -template > +template class TrackDensityVertexFinder { // Provided vertex fitter type should comply with the VertexFitterConcept // to ensure providing an input track type InputTrack_t @@ -41,8 +39,6 @@ class TrackDensityVertexFinder { // static_assert(VertexFitterConcept, // "Vertex fitter does not fulfill vertex fitter concept."); - using InputTrack_t = typename vfitter_t::InputTrack_t; - public: /// @brief The Config struct struct Config { @@ -65,53 +61,20 @@ class TrackDensityVertexFinder { const VertexingOptions& vertexingOptions, State& state) const; - /// @brief Constructor used if InputTrack_t type == BoundTrackParameters - /// - /// @param cfg Configuration object - template < - typename T = InputTrack_t, - std::enable_if_t::value, int> = 0> - TrackDensityVertexFinder(const Config& cfg) - : m_cfg(cfg), m_extractParameters([](const InputTrack& params) { - return *params.as(); - }) {} - - /// @brief Default constructor used if InputTrack_t type == - /// BoundTrackParameters - template < - typename T = InputTrack_t, - std::enable_if_t::value, int> = 0> - TrackDensityVertexFinder() - : m_extractParameters([](const InputTrack& params) { - return *params.as(); - }) {} - - /// @brief Constructor for user-defined InputTrack_t type =! - /// BoundTrackParameters + /// @brief Constructor for user-defined InputTrack type /// /// @param cfg Configuration object - /// @param func Function extracting BoundTrackParameters from InputTrack_t - /// object + /// @param func Function extracting BoundTrackParameters from InputTrack + /// object TrackDensityVertexFinder( const Config& cfg, const std::function& func) : m_cfg(cfg), m_extractParameters(func) {} - /// @brief Constructor for user-defined InputTrack_t type =! - /// BoundTrackParameters with default Config object - /// - /// @param func Function extracting BoundTrackParameters from InputTrack_t - /// object - TrackDensityVertexFinder( - const std::function& func) - : m_extractParameters(func) {} - private: Config m_cfg; /// @brief Function to extract track parameters, - /// InputTrack_t objects are BoundTrackParameters by default, function to be - /// overwritten to return BoundTrackParameters for other InputTrack_t objects. std::function m_extractParameters; }; diff --git a/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp b/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp index 42545eb2fdd..e203dfbfdbb 100644 --- a/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp @@ -37,18 +37,16 @@ class ZScanVertexFinder { using Propagator_t = typename vfitter_t::Propagator_t; public: - using InputTrack_t = typename vfitter_t::InputTrack_t; - /// Configuration struct struct Config { /// @brief Finder configuration /// /// @param ipEst ImpactPointEstimator - Config(const ImpactPointEstimator& ipEst) + Config(const ImpactPointEstimator& ipEst) : ipEstimator(ipEst) {} // ImpactPointEstimator - ImpactPointEstimator ipEstimator; + ImpactPointEstimator ipEstimator; // FsmwMode1dFinder FsmwMode1dFinder mode1dFinder; @@ -73,29 +71,11 @@ class ZScanVertexFinder { /// State struct for fulfilling interface struct State {}; - /// @brief Constructor used if InputTrack_t type == BoundTrackParameters - /// - /// @param cfg Configuration object - /// @param logger The logging instance - template < - typename T = InputTrack_t, - std::enable_if_t::value, int> = 0> - - ZScanVertexFinder(const Config& cfg, - std::unique_ptr logger = - getDefaultLogger("ZScanVertexFinder", Logging::INFO)) - : m_cfg(std::move(cfg)), - m_extractParameters([](const InputTrack& params) { - return *params.as(); - }), - m_logger(std::move(logger)) {} - - /// @brief Constructor for user-defined InputTrack_t type =! - /// BoundTrackParameters + /// @brief Constructor for user-defined InputTrack type /// /// @param cfg Configuration object /// @param func Function extracting BoundTrackParameters from InputTrack_t - /// object + /// object /// @param logger Logging instance ZScanVertexFinder(const Config& cfg, std::function func, @@ -123,8 +103,6 @@ class ZScanVertexFinder { Config m_cfg; /// @brief Function to extract track parameters, - /// InputTrack_t objects are BoundTrackParameters by default, function to be - /// overwritten to return BoundTrackParameters for other InputTrack_t objects. std::function m_extractParameters; /// Logging instance diff --git a/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/AdaptiveMultiVertexFinderAlgorithm.hpp b/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/AdaptiveMultiVertexFinderAlgorithm.hpp index 6160e42aa9f..7ee3f1e71f5 100644 --- a/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/AdaptiveMultiVertexFinderAlgorithm.hpp +++ b/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/AdaptiveMultiVertexFinderAlgorithm.hpp @@ -52,11 +52,9 @@ struct AlgorithmContext; class AdaptiveMultiVertexFinderAlgorithm final : public IAlgorithm { public: using Propagator = Acts::Propagator>; - using IPEstimator = - Acts::ImpactPointEstimator; + using IPEstimator = Acts::ImpactPointEstimator; using Linearizer = Acts::HelicalTrackLinearizer; - using Fitter = - Acts::AdaptiveMultiVertexFitter; + using Fitter = Acts::AdaptiveMultiVertexFitter; using Options = Acts::VertexingOptions; using VertexCollection = std::vector; diff --git a/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/IterativeVertexFinderAlgorithm.hpp b/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/IterativeVertexFinderAlgorithm.hpp index 40071998253..333152ca6a0 100644 --- a/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/IterativeVertexFinderAlgorithm.hpp +++ b/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/IterativeVertexFinderAlgorithm.hpp @@ -52,13 +52,12 @@ struct AlgorithmContext; class IterativeVertexFinderAlgorithm final : public IAlgorithm { public: using Propagator = Acts::Propagator>; - using IPEstimator = - Acts::ImpactPointEstimator; + using IPEstimator = Acts::ImpactPointEstimator; using Linearizer = Acts::HelicalTrackLinearizer; using Fitter = Acts::FullBilloirVertexFitter; - using Seeder = Acts::TrackDensityVertexFinder< - Fitter, Acts::GaussianTrackDensity>; + using Seeder = + Acts::TrackDensityVertexFinder; using Finder = Acts::IterativeVertexFinder; using Options = Acts::VertexingOptions; diff --git a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp index 902d81a652a..e27cdb676b6 100644 --- a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp +++ b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp @@ -18,6 +18,7 @@ #include "Acts/Vertexing/AdaptiveGridTrackDensity.hpp" #include "Acts/Vertexing/AdaptiveMultiVertexFinder.hpp" #include "Acts/Vertexing/AdaptiveMultiVertexFitter.hpp" +#include "Acts/Vertexing/TrackAtVertex.hpp" #include "Acts/Vertexing/Vertex.hpp" #include "Acts/Vertexing/VertexingOptions.hpp" #include "ActsExamples/EventData/ProtoVertex.hpp" @@ -56,10 +57,10 @@ ActsExamples::ProcessCode ActsExamples::AdaptiveMultiVertexFinderAlgorithm::execute( const ActsExamples::AlgorithmContext& ctx) const { if (m_cfg.seedFinder == SeedFinder::GaussianSeeder) { - using Seeder = Acts::TrackDensityVertexFinder< - Fitter, Acts::GaussianTrackDensity>; + using Seeder = + Acts::TrackDensityVertexFinder; using Finder = Acts::AdaptiveMultiVertexFinder; - Seeder seedFinder; + Seeder seedFinder{{}, Acts::InputTrack::extractParameters}; return executeAfterSeederChoice(ctx, seedFinder); } else if (m_cfg.seedFinder == SeedFinder::AdaptiveGridSeeder) { // Set up track density used during vertex seeding @@ -75,7 +76,7 @@ ActsExamples::AdaptiveMultiVertexFinderAlgorithm::execute( using Seeder = Acts::AdaptiveGridDensityVertexFinder; using Finder = Acts::AdaptiveMultiVertexFinder; Seeder::Config seederConfig(trkDensity); - Seeder seedFinder(seederConfig); + Seeder seedFinder(seederConfig, Acts::InputTrack::extractParameters); return executeAfterSeederChoice(ctx, seedFinder); } else { return ActsExamples::ProcessCode::ABORT; @@ -116,7 +117,7 @@ ActsExamples::AdaptiveMultiVertexFinderAlgorithm::executeAfterSeederChoice( fitterCfg.minWeight = 0.001; fitterCfg.doSmoothing = true; fitterCfg.useTime = m_cfg.useTime; - Fitter fitter(std::move(fitterCfg), + Fitter fitter(std::move(fitterCfg), Acts::InputTrack::extractParameters, logger().cloneWithSuffix("AdaptiveMultiVertexFitter")); typename Finder::Config finderConfig(std::move(fitter), std::move(seedFinder), @@ -145,7 +146,8 @@ ActsExamples::AdaptiveMultiVertexFinderAlgorithm::executeAfterSeederChoice( } // Instantiate the finder - Finder finder(std::move(finderConfig), logger().clone()); + Finder finder(std::move(finderConfig), Acts::InputTrack::extractParameters, + logger().clone()); // retrieve input tracks and convert into the expected format diff --git a/Examples/Algorithms/Vertexing/src/IterativeVertexFinderAlgorithm.cpp b/Examples/Algorithms/Vertexing/src/IterativeVertexFinderAlgorithm.cpp index 8134d3cf84e..e3004766e24 100644 --- a/Examples/Algorithms/Vertexing/src/IterativeVertexFinderAlgorithm.cpp +++ b/Examples/Algorithms/Vertexing/src/IterativeVertexFinderAlgorithm.cpp @@ -14,6 +14,7 @@ #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Result.hpp" #include "Acts/Vertexing/IterativeVertexFinder.hpp" +#include "Acts/Vertexing/TrackAtVertex.hpp" #include "Acts/Vertexing/Vertex.hpp" #include "ActsExamples/EventData/ProtoVertex.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" @@ -82,7 +83,7 @@ ActsExamples::ProcessCode ActsExamples::IterativeVertexFinderAlgorithm::execute( // Setup the seed finder IPEstimator::Config ipEstCfg(m_cfg.bField, propagator); IPEstimator ipEst(ipEstCfg, logger().cloneWithSuffix("ImpactPointEstimator")); - Seeder seeder; + Seeder seeder{{}, Acts::InputTrack::extractParameters}; // Set up the actual vertex finder Finder::Config finderCfg(std::move(vertexFitter), std::move(linearizer), std::move(seeder), ipEst); diff --git a/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp index 58d42cfbd6b..879c44c2878 100644 --- a/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp @@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) { auto propagator = std::make_shared(stepper); // IP 3D Estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ipEstimatorCfg(bField, propagator); IPEstimator ipEstimator(ipEstimatorCfg); @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) { annealingConfig.setOfTemperatures = temperatures; AnnealingUtility annealingUtility(annealingConfig); - using Fitter = AdaptiveMultiVertexFitter; + using Fitter = AdaptiveMultiVertexFitter; Fitter::Config fitterCfg(ipEstimator); @@ -107,20 +107,18 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) { // Test smoothing fitterCfg.doSmoothing = true; - Fitter fitter(fitterCfg); + Fitter fitter(fitterCfg, InputTrack::extractParameters); - using SeedFinder = - TrackDensityVertexFinder>; + using SeedFinder = TrackDensityVertexFinder; - SeedFinder seedFinder; + SeedFinder seedFinder{{}, InputTrack::extractParameters}; using Finder = AdaptiveMultiVertexFinder; Finder::Config finderConfig(std::move(fitter), std::move(seedFinder), ipEstimator, std::move(linearizer), bField); - Finder finder(std::move(finderConfig)); + Finder finder(std::move(finderConfig), InputTrack::extractParameters); Finder::State state; auto csvData = readTracksAndVertexCSV(toolString); @@ -243,7 +241,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_usertype_test) { }; // IP 3D Estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ipEstimatorCfg(bField, propagator); IPEstimator ipEstimator(ipEstimatorCfg); @@ -253,7 +251,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_usertype_test) { annealingConfig.setOfTemperatures = temperatures; AnnealingUtility annealingUtility(annealingConfig); - using Fitter = AdaptiveMultiVertexFitter; + using Fitter = AdaptiveMultiVertexFitter; Fitter::Config fitterCfg(ipEstimator); @@ -268,10 +266,9 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_usertype_test) { Fitter fitter(fitterCfg, extractParameters); - using SeedFinder = - TrackDensityVertexFinder>; + using SeedFinder = TrackDensityVertexFinder; - SeedFinder seedFinder(extractParameters); + SeedFinder seedFinder({}, extractParameters); using Finder = AdaptiveMultiVertexFinder; @@ -385,7 +382,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_grid_seed_finder_test) { auto propagator = std::make_shared(stepper); // IP Estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ipEstCfg(bField, propagator); IPEstimator ipEst(ipEstCfg); @@ -395,7 +392,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_grid_seed_finder_test) { annealingConfig.setOfTemperatures = temperatures; AnnealingUtility annealingUtility(annealingConfig); - using Fitter = AdaptiveMultiVertexFitter; + using Fitter = AdaptiveMultiVertexFitter; Fitter::Config fitterCfg(ipEst); @@ -408,7 +405,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_grid_seed_finder_test) { // Test smoothing fitterCfg.doSmoothing = true; - Fitter fitter(fitterCfg); + Fitter fitter(fitterCfg, InputTrack::extractParameters); using SeedFinder = GridDensityVertexFinder<4000, 55>; SeedFinder::Config seedFinderCfg(250); @@ -421,7 +418,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_grid_seed_finder_test) { Finder::Config finderConfig(std::move(fitter), std::move(seedFinder), ipEst, std::move(linearizer), bField); - Finder finder(std::move(finderConfig)); + Finder finder(std::move(finderConfig), InputTrack::extractParameters); Finder::State state; auto csvData = readTracksAndVertexCSV(toolString); @@ -532,7 +529,7 @@ BOOST_AUTO_TEST_CASE( auto propagator = std::make_shared(stepper); // IP Estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ipEstCfg(bField, propagator); IPEstimator ipEst(ipEstCfg); @@ -542,7 +539,7 @@ BOOST_AUTO_TEST_CASE( annealingConfig.setOfTemperatures = temperatures; AnnealingUtility annealingUtility(annealingConfig); - using Fitter = AdaptiveMultiVertexFitter; + using Fitter = AdaptiveMultiVertexFitter; Fitter::Config fitterCfg(ipEst); @@ -555,7 +552,7 @@ BOOST_AUTO_TEST_CASE( // Test smoothing fitterCfg.doSmoothing = true; - Fitter fitter(fitterCfg); + Fitter fitter(fitterCfg, InputTrack::extractParameters); // Grid density used during vertex seed finding AdaptiveGridTrackDensity::Config gridDensityCfg; @@ -569,14 +566,14 @@ BOOST_AUTO_TEST_CASE( SeedFinder::Config seedFinderCfg(gridDensity); seedFinderCfg.cacheGridStateForTrackRemoval = true; - SeedFinder seedFinder(seedFinderCfg); + SeedFinder seedFinder(seedFinderCfg, InputTrack::extractParameters); using Finder = AdaptiveMultiVertexFinder; Finder::Config finderConfig(std::move(fitter), std::move(seedFinder), ipEst, std::move(linearizer), bField); - Finder finder(std::move(finderConfig)); + Finder finder(std::move(finderConfig), InputTrack::extractParameters); Finder::State state; auto csvData = readTracksAndVertexCSV(toolString); diff --git a/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFitterTests.cpp b/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFitterTests.cpp index 25d6a28ddd9..9840f30691c 100644 --- a/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFitterTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFitterTests.cpp @@ -114,13 +114,12 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test) { VertexingOptions vertexingOptions(geoContext, magFieldContext); // IP 3D Estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ip3dEstCfg(bField, propagator); IPEstimator ip3dEst(ip3dEstCfg); - AdaptiveMultiVertexFitter::Config fitterCfg( - ip3dEst); + AdaptiveMultiVertexFitter::Config fitterCfg(ip3dEst); // Linearizer for BoundTrackParameters type test Linearizer::Config ltConfig(bField, propagator); @@ -129,8 +128,8 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test) { // Test smoothing fitterCfg.doSmoothing = true; - AdaptiveMultiVertexFitter fitter( - std::move(fitterCfg)); + AdaptiveMultiVertexFitter fitter( + std::move(fitterCfg), Acts::InputTrack::extractParameters); // Create positions of three vertices, two of which (1 and 2) are // close to one another and will share a common track later @@ -205,8 +204,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test) { ACTS_DEBUG("\t" << ct << ". track ptr: " << &trk); } - AdaptiveMultiVertexFitter::State state( - *bField, magFieldContext); + AdaptiveMultiVertexFitter::State state(*bField, magFieldContext); for (unsigned int iTrack = 0; iTrack < nTracksPerVtx * vtxPosVec.size(); iTrack++) { @@ -337,13 +335,12 @@ BOOST_AUTO_TEST_CASE(time_fitting) { VertexingOptions vertexingOptions(geoContext, magFieldContext); // IP 3D Estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ip3dEstCfg(bField, propagator); IPEstimator ip3dEst(ip3dEstCfg); - AdaptiveMultiVertexFitter::Config fitterCfg( - ip3dEst); + AdaptiveMultiVertexFitter::Config fitterCfg(ip3dEst); // Linearizer for BoundTrackParameters type test Linearizer::Config ltConfig(bField, propagator); @@ -354,8 +351,8 @@ BOOST_AUTO_TEST_CASE(time_fitting) { // Do time fit fitterCfg.useTime = true; - AdaptiveMultiVertexFitter fitter( - std::move(fitterCfg)); + AdaptiveMultiVertexFitter fitter( + std::move(fitterCfg), Acts::InputTrack::extractParameters); // Vertex position double trueVtxTime = 40.0_ps; @@ -416,8 +413,7 @@ BOOST_AUTO_TEST_CASE(time_fitting) { } // Prepare fitter state - AdaptiveMultiVertexFitter::State state( - *bField, magFieldContext); + AdaptiveMultiVertexFitter::State state(*bField, magFieldContext); for (const auto& trk : trks) { ACTS_DEBUG("Track parameters:\n" << trk); @@ -474,7 +470,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) { VertexingOptions vertexingOptions(geoContext, magFieldContext); // IP 3D Estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ip3dEstCfg(bField, propagator); IPEstimator ip3dEst(ip3dEstCfg); @@ -484,8 +480,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) { annealingConfig.setOfTemperatures = temperatures; AnnealingUtility annealingUtility(annealingConfig); - AdaptiveMultiVertexFitter::Config fitterCfg( - ip3dEst); + AdaptiveMultiVertexFitter::Config fitterCfg(ip3dEst); fitterCfg.annealingTool = annealingUtility; @@ -496,8 +491,8 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) { // Test smoothing // fitterCfg.doSmoothing = true; - AdaptiveMultiVertexFitter fitter( - std::move(fitterCfg)); + AdaptiveMultiVertexFitter fitter( + std::move(fitterCfg), Acts::InputTrack::extractParameters); // Create first vector of tracks Vector3 pos1a(0.5_mm, -0.5_mm, 2.4_mm); @@ -583,8 +578,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) { .value(), }; - AdaptiveMultiVertexFitter::State state( - *bField, magFieldContext); + AdaptiveMultiVertexFitter::State state(*bField, magFieldContext); // The constraint vertex position covariance SquareMatrix4 covConstr(SquareMatrix4::Identity()); diff --git a/Tests/UnitTests/Core/Vertexing/GridDensityVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/GridDensityVertexFinderTests.cpp index 5a2d374c2b3..bbda5f7c9b3 100644 --- a/Tests/UnitTests/Core/Vertexing/GridDensityVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/GridDensityVertexFinderTests.cpp @@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(grid_density_vertex_finder_test) { using Finder2 = AdaptiveGridDensityVertexFinder<>; Finder2::Config cfg2(adaptiveDensity); cfg2.cacheGridStateForTrackRemoval = false; - Finder2 finder2(cfg2); + Finder2 finder2(cfg2, InputTrack::extractParameters); Finder2::State state2; int mySeed = 31415; @@ -229,7 +229,7 @@ BOOST_AUTO_TEST_CASE(grid_density_vertex_finder_track_caching_test) { using Finder2 = AdaptiveGridDensityVertexFinder<>; Finder2::Config cfg2(adaptiveDensity); cfg2.cacheGridStateForTrackRemoval = true; - Finder2 finder2(cfg2); + Finder2 finder2(cfg2, InputTrack::extractParameters); int mySeed = 31415; std::mt19937 gen(mySeed); @@ -394,7 +394,7 @@ BOOST_AUTO_TEST_CASE(grid_density_vertex_finder_seed_width_test) { Finder2::Config cfg2(adaptiveDensity); cfg2.cacheGridStateForTrackRemoval = false; cfg2.estimateSeedWidth = true; - Finder2 finder2(cfg2); + Finder2 finder2(cfg2, InputTrack::extractParameters); Finder2::State state2; int mySeed = 31415; diff --git a/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp b/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp index a6d689f08c3..bed3a84d8f4 100644 --- a/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp @@ -58,10 +58,8 @@ using MagneticField = Acts::ConstantBField; using StraightPropagator = Acts::Propagator; using Stepper = Acts::EigenStepper<>; using Propagator = Acts::Propagator; -using Estimator = - Acts::ImpactPointEstimator; -using StraightLineEstimator = - Acts::ImpactPointEstimator; +using Estimator = Acts::ImpactPointEstimator; +using StraightLineEstimator = Acts::ImpactPointEstimator; const Acts::GeometryContext geoContext; const Acts::MagneticFieldContext magFieldContext; diff --git a/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp index e09b93f89c9..e2b28523df9 100644 --- a/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp @@ -147,7 +147,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { BilloirFitter bFitter(vertexFitterCfg); // Impact point estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ipEstimatorCfg(bField, propagator); IPEstimator ipEstimator(ipEstimatorCfg); @@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { ZScanSeedFinder::Config seedFinderCfg(ipEstimator); - ZScanSeedFinder sFinder(seedFinderCfg); + ZScanSeedFinder sFinder(seedFinderCfg, Acts::InputTrack::extractParameters); // Vertex Finder using VertexFinder = IterativeVertexFinder; @@ -371,7 +371,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_user_track_type) { BilloirFitter bFitter(vertexFitterCfg, extractParameters); // IP Estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ipEstimatorCfg(bField, propagator); IPEstimator ipEstimator(ipEstimatorCfg); @@ -569,7 +569,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_athena_reference) { BilloirFitter bFitter(vertexFitterCfg); // Impact point estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ipEstimatorCfg(bField, propagator); IPEstimator ipEstimator(ipEstimatorCfg); @@ -581,7 +581,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_athena_reference) { ZScanSeedFinder::Config seedFinderCfg(ipEstimator); - ZScanSeedFinder sFinder(seedFinderCfg); + ZScanSeedFinder sFinder(seedFinderCfg, Acts::InputTrack::extractParameters); // Vertex Finder using VertexFinder = IterativeVertexFinder; diff --git a/Tests/UnitTests/Core/Vertexing/KalmanVertexTrackUpdaterTests.cpp b/Tests/UnitTests/Core/Vertexing/KalmanVertexTrackUpdaterTests.cpp index 9f95f764f47..5a0f208d133 100644 --- a/Tests/UnitTests/Core/Vertexing/KalmanVertexTrackUpdaterTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/KalmanVertexTrackUpdaterTests.cpp @@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(Kalman_Vertex_TrackUpdater) { auto propagator = std::make_shared(stepper); // Set up ImpactPointEstimator, used for comparisons later - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ip3dEstConfig(bField, propagator); IPEstimator ip3dEst(ip3dEstConfig); IPEstimator::State state(bField->makeCache(magFieldContext)); diff --git a/Tests/UnitTests/Core/Vertexing/KalmanVertexUpdaterTests.cpp b/Tests/UnitTests/Core/Vertexing/KalmanVertexUpdaterTests.cpp index e8f10acd7f8..9aa8640852f 100644 --- a/Tests/UnitTests/Core/Vertexing/KalmanVertexUpdaterTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/KalmanVertexUpdaterTests.cpp @@ -172,8 +172,7 @@ BOOST_AUTO_TEST_CASE(Kalman_Vertex_Updater) { vtx.setFullCovariance(SquareMatrix4::Identity() * 0.01); // Update trkAtVertex with assumption of originating from vtx - KalmanVertexUpdater::updateVertexWithTrack( - vtx, trkAtVtx); + KalmanVertexUpdater::updateVertexWithTrack<3>(vtx, trkAtVtx); if (debug) { std::cout << "Old vertex position: " << vtxPos << std::endl; diff --git a/Tests/UnitTests/Core/Vertexing/TrackDensityVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/TrackDensityVertexFinderTests.cpp index e2214f6e13c..940d220568c 100644 --- a/Tests/UnitTests/Core/Vertexing/TrackDensityVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/TrackDensityVertexFinderTests.cpp @@ -71,9 +71,8 @@ BOOST_AUTO_TEST_CASE(track_density_finder_test) { VertexingOptions vertexingOptions(geoContext, magFieldContext); using Finder = - TrackDensityVertexFinder, - GaussianTrackDensity>; - Finder finder; + TrackDensityVertexFinder, GaussianTrackDensity>; + Finder finder{{}, InputTrack::extractParameters}; Finder::State state; // Start creating some track parameters @@ -151,9 +150,8 @@ BOOST_AUTO_TEST_CASE(track_density_finder_constr_test) { // Finder options VertexingOptions vertexingOptions(geoContext, magFieldContext, constraint); using Finder = - TrackDensityVertexFinder, - GaussianTrackDensity>; - Finder finder; + TrackDensityVertexFinder, GaussianTrackDensity>; + Finder finder{{}, InputTrack::extractParameters}; Finder::State state; // Start creating some track parameters @@ -228,9 +226,8 @@ BOOST_AUTO_TEST_CASE(track_density_finder_random_test) { VertexingOptions vertexingOptions(geoContext, magFieldContext); using Finder = - TrackDensityVertexFinder, - GaussianTrackDensity>; - Finder finder; + TrackDensityVertexFinder, GaussianTrackDensity>; + Finder finder{{}, InputTrack::extractParameters}; Finder::State state; int mySeed = 31415; @@ -330,9 +327,9 @@ BOOST_AUTO_TEST_CASE(track_density_finder_usertrack_test) { }; using Finder = TrackDensityVertexFinder, - GaussianTrackDensity>; + GaussianTrackDensity>; - Finder finder(extractParameters); + Finder finder({}, extractParameters); Finder::State state; // Start creating some track parameters diff --git a/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp index 6629c34883c..f5a43a44021 100644 --- a/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp @@ -169,14 +169,14 @@ BOOST_AUTO_TEST_CASE(zscan_finder_test) { "Vertex finder does not fulfill vertex finder concept."); // Impact point estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ipEstimatorCfg(bField, propagator); IPEstimator ipEstimator(ipEstimatorCfg); VertexFinder::Config cfg(ipEstimator); - VertexFinder finder(cfg); + VertexFinder finder(cfg, Acts::InputTrack::extractParameters); VertexingOptions vertexingOptions(geoContext, magFieldContext); @@ -292,7 +292,7 @@ BOOST_AUTO_TEST_CASE(zscan_finder_usertrack_test) { "Vertex finder does not fulfill vertex finder concept."); // Impact point estimator - using IPEstimator = ImpactPointEstimator; + using IPEstimator = ImpactPointEstimator; IPEstimator::Config ipEstimatorCfg(bField, propagator); IPEstimator ipEstimator(ipEstimatorCfg); From aecff9489b768ba41ac25cc9dce61d7e889ba0bb Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Mon, 18 Dec 2023 16:26:06 +0100 Subject: [PATCH 2/3] remove input_track_t from billoir fitter --- .../Acts/Vertexing/DummyVertexFitter.hpp | 6 +-- .../Vertexing/FullBilloirVertexFitter.hpp | 31 ++------------- .../Vertexing/FullBilloirVertexFitter.ipp | 4 +- .../Vertexing/GridDensityVertexFinder.hpp | 38 ++----------------- .../Acts/Vertexing/IterativeVertexFinder.hpp | 26 ++----------- .../Vertexing/KalmanVertexTrackUpdater.hpp | 3 +- .../Acts/Vertexing/KalmanVertexUpdater.hpp | 1 - .../Acts/Vertexing/VertexFitterConcept.hpp | 5 --- .../IterativeVertexFinderAlgorithm.hpp | 3 +- .../Vertexing/VertexFitterAlgorithm.hpp | 3 +- .../src/IterativeVertexFinderAlgorithm.cpp | 5 ++- .../Vertexing/src/VertexFitterAlgorithm.cpp | 3 +- .../AdaptiveMultiVertexFinderTests.cpp | 2 +- .../FullBilloirVertexFitterTests.cpp | 14 +++---- .../GridDensityVertexFinderTests.cpp | 6 +-- .../Vertexing/IterativeVertexFinderTests.cpp | 16 ++++---- .../Core/Vertexing/ZScanVertexFinderTests.cpp | 5 +-- 17 files changed, 41 insertions(+), 130 deletions(-) diff --git a/Core/include/Acts/Vertexing/DummyVertexFitter.hpp b/Core/include/Acts/Vertexing/DummyVertexFitter.hpp index a85b7c62505..545ac17f1f1 100644 --- a/Core/include/Acts/Vertexing/DummyVertexFitter.hpp +++ b/Core/include/Acts/Vertexing/DummyVertexFitter.hpp @@ -22,11 +22,9 @@ class DummyTrackLinearizer; /// @brief Dummy vertex fitter class, only to be used /// for ensuring interfaces where a vertex fitter type is /// required but no fitter is actually needed -template +template class DummyVertexFitter { public: - using InputTrack_t = input_track_t; using Linearizer_t = linearizer_t; using Propagator_t = void; @@ -34,7 +32,7 @@ class DummyVertexFitter { DummyVertexFitter() = delete; /// @brief Dummy fit method - Result fit(const std::vector&, const linearizer_t&, + Result fit(const std::vector&, const linearizer_t&, const VertexingOptions&) const; }; diff --git a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp index 95119b7cc55..046a4f4786a 100644 --- a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp +++ b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp @@ -44,15 +44,13 @@ namespace Acts { /// https://acts.readthedocs.io/en/latest/white_papers/billoir-covariances.html /// Author(s) Russo, F /// -/// @tparam input_track_t Track object type /// @tparam linearizer_t Track linearizer type -template +template class FullBilloirVertexFitter { static_assert(LinearizerConcept, "Linearizer does not fulfill linearizer concept."); public: - using InputTrack_t = input_track_t; using Propagator_t = typename linearizer_t::Propagator_t; using Linearizer_t = linearizer_t; @@ -71,29 +69,11 @@ class FullBilloirVertexFitter { int maxIterations = 5; }; - /// @brief Constructor used if input_track_t type == BoundTrackParameters + /// @brief Constructor for user-defined InputTrack type /// /// @param cfg Configuration object - /// @param logger Logging instance - template < - typename T = input_track_t, - std::enable_if_t::value, int> = 0> - FullBilloirVertexFitter(const Config& cfg, - std::unique_ptr logger = - getDefaultLogger("FullBilloirVertexFitter", - Logging::INFO)) - : m_cfg(cfg), - extractParameters([](const InputTrack& params) { - return *params.as(); - }), - m_logger(std::move(logger)) {} - - /// @brief Constructor for user-defined input_track_t type =! - /// BoundTrackParameters - /// - /// @param cfg Configuration object - /// @param func Function extracting BoundTrackParameters from input_track_t - /// object + /// @param func Function extracting BoundTrackParameters from InputTrack + /// object /// @param logger Logging instance FullBilloirVertexFitter( const Config& cfg, @@ -122,9 +102,6 @@ class FullBilloirVertexFitter { Config m_cfg; /// @brief Function to extract track parameters, - /// input_track_t objects are BoundTrackParameters by default, function to be - /// overwritten to return BoundTrackParameters for other input_track_t - /// objects. std::function extractParameters; /// Logging instance diff --git a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp index 4391538db0e..a6366ccbcd3 100644 --- a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp +++ b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp @@ -54,9 +54,9 @@ struct BilloirVertex { } // namespace Acts::detail -template +template < typename linearizer_t> Acts::Result -Acts::FullBilloirVertexFitter::fit( +Acts::FullBilloirVertexFitter::fit( const std::vector& paramVector, const linearizer_t& linearizer, const VertexingOptions& vertexingOptions, State& state) const { unsigned int nTracks = paramVector.size(); diff --git a/Core/include/Acts/Vertexing/GridDensityVertexFinder.hpp b/Core/include/Acts/Vertexing/GridDensityVertexFinder.hpp index 3d5840c0eae..4097446b659 100644 --- a/Core/include/Acts/Vertexing/GridDensityVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/GridDensityVertexFinder.hpp @@ -39,7 +39,6 @@ class GridDensityVertexFinder { // Assert bigger main grid than track grid static_assert(mainGridSize > trkGridSize); - using InputTrack_t = typename vfitter_t::InputTrack_t; using GridDensity = GaussianGridTrackDensity; public: @@ -109,45 +108,16 @@ class GridDensityVertexFinder { const VertexingOptions& vertexingOptions, State& state) const; - /// @brief Constructor used if InputTrack_t type == BoundTrackParameters + /// @brief Constructor for user-defined InputTrack type /// /// @param cfg Configuration object - template < - typename T = InputTrack_t, - std::enable_if_t::value, int> = 0> - GridDensityVertexFinder(const Config& cfg) - : m_cfg(cfg), m_extractParameters([](const InputTrack& params) { - return *params.as(); - }) {} - - /// @brief Default constructor used if InputTrack_t type == - /// BoundTrackParameters - template < - typename T = InputTrack_t, - std::enable_if_t::value, int> = 0> - GridDensityVertexFinder() - : m_extractParameters([](T params) { return params; }) {} - - /// @brief Constructor for user-defined InputTrack_t type =! - /// BoundTrackParameters - /// - /// @param cfg Configuration object - /// @param func Function extracting BoundTrackParameters from InputTrack_t - /// object + /// @param func Function extracting BoundTrackParameters from InputTrack + /// object GridDensityVertexFinder( const Config& cfg, const std::function& func) : m_cfg(cfg), m_extractParameters(func) {} - /// @brief Constructor for user-defined InputTrack_t type =! - /// BoundTrackParameters with default Config object - /// - /// @param func Function extracting BoundTrackParameters from InputTrack_t - /// object - GridDensityVertexFinder( - const std::function& func) - : m_extractParameters(func) {} - private: /// @brief Checks if a track passes the selection criteria for seeding /// @@ -160,8 +130,6 @@ class GridDensityVertexFinder { const Config m_cfg; /// @brief Function to extract track parameters, - /// InputTrack_t objects are BoundTrackParameters by default, function to be - /// overwritten to return BoundTrackParameters for other InputTrack_t objects. std::function m_extractParameters; }; diff --git a/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp b/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp index 53dfa081831..9a38003126e 100644 --- a/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp @@ -64,7 +64,6 @@ class IterativeVertexFinder { using Linearizer_t = typename vfitter_t::Linearizer_t; public: - using InputTrack_t = typename vfitter_t::InputTrack_t; using IPEstimator = ImpactPointEstimator; /// Configuration struct @@ -135,28 +134,11 @@ class IterativeVertexFinder { typename vfitter_t::State fitterState; }; - /// @brief Constructor used if InputTrack_t type == BoundTrackParameters + /// @brief Constructor for user-defined InputTrack type /// /// @param cfg Configuration object - /// @param logger The logging instance - template < - typename T = InputTrack_t, - std::enable_if_t::value, int> = 0> - IterativeVertexFinder(Config cfg, - std::unique_ptr logger = getDefaultLogger( - "IterativeVertexFinder", Logging::INFO)) - : m_cfg(std::move(cfg)), - m_extractParameters([](const InputTrack& params) { - return *params.as(); - }), - m_logger(std::move(logger)) {} - - /// @brief Constructor for user-defined InputTrack_t type =! - /// BoundTrackParameters - /// - /// @param cfg Configuration object - /// @param func Function extracting BoundTrackParameters from InputTrack_t - /// object + /// @param func Function extracting BoundTrackParameters from InputTrack + /// object /// @param logger The logging instance IterativeVertexFinder( Config cfg, std::function func, @@ -182,8 +164,6 @@ class IterativeVertexFinder { const Config m_cfg; /// @brief Function to extract track parameters, - /// InputTrack_t objects are BoundTrackParameters by default, function to be - /// overwritten to return BoundTrackParameters for other InputTrack_t objects. std::function m_extractParameters; /// Logging instance diff --git a/Core/include/Acts/Vertexing/KalmanVertexTrackUpdater.hpp b/Core/include/Acts/Vertexing/KalmanVertexTrackUpdater.hpp index 7c4d46b1d40..9ce58e47238 100644 --- a/Core/include/Acts/Vertexing/KalmanVertexTrackUpdater.hpp +++ b/Core/include/Acts/Vertexing/KalmanVertexTrackUpdater.hpp @@ -34,7 +34,8 @@ namespace KalmanVertexTrackUpdater { /// @param track Track to update /// @param vtxPosFull full vertex position /// @param vtxCovFull full vertex covariance matrix -/// @param nDimVertex number of dimensions of the vertex +/// @param nDimVertex number of dimensions of the vertex. Can be 3 (if we only +/// fit its spatial coordinates) or 4 (if we also fit time). void update(TrackAtVertexRef track, const Vector4& vtxPosFull, const SquareMatrix4& vtxCovFull, unsigned int nDimVertex); diff --git a/Core/include/Acts/Vertexing/KalmanVertexUpdater.hpp b/Core/include/Acts/Vertexing/KalmanVertexUpdater.hpp index 159a3db1060..3baecfbf7fc 100644 --- a/Core/include/Acts/Vertexing/KalmanVertexUpdater.hpp +++ b/Core/include/Acts/Vertexing/KalmanVertexUpdater.hpp @@ -59,7 +59,6 @@ struct Cache { /// However, it does not add the track to the TrackAtVertex list. This to be /// done manually after calling the method. /// -/// @tparam input_track_t Track object type /// @tparam nDimVertex number of dimensions of the vertex. Can be 3 (if we only /// fit its spatial coordinates) or 4 (if we also fit time). /// diff --git a/Core/include/Acts/Vertexing/VertexFitterConcept.hpp b/Core/include/Acts/Vertexing/VertexFitterConcept.hpp index 16d6421bea9..77f0adcc0e6 100644 --- a/Core/include/Acts/Vertexing/VertexFitterConcept.hpp +++ b/Core/include/Acts/Vertexing/VertexFitterConcept.hpp @@ -19,8 +19,6 @@ namespace Acts { namespace Concepts { namespace VertexFitter { -template -using track_t = typename T::InputTrack_t; template using propagator_t = typename T::Propagator_t; template @@ -41,8 +39,6 @@ METHOD_TRAIT(fit_t, fit); typename S::State&>; static_assert(fit_exists, "fit method not found"); - constexpr static bool track_exists = exists; - static_assert(track_exists, "Track type not found"); constexpr static bool propagator_exists = exists; static_assert(propagator_exists, "Propagator type not found"); constexpr static bool linearizer_exists = exists; @@ -51,7 +47,6 @@ METHOD_TRAIT(fit_t, fit); static_assert(state_exists, "State type not found"); constexpr static bool value = require; diff --git a/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/IterativeVertexFinderAlgorithm.hpp b/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/IterativeVertexFinderAlgorithm.hpp index 333152ca6a0..b8c699eb8d4 100644 --- a/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/IterativeVertexFinderAlgorithm.hpp +++ b/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/IterativeVertexFinderAlgorithm.hpp @@ -54,8 +54,7 @@ class IterativeVertexFinderAlgorithm final : public IAlgorithm { using Propagator = Acts::Propagator>; using IPEstimator = Acts::ImpactPointEstimator; using Linearizer = Acts::HelicalTrackLinearizer; - using Fitter = - Acts::FullBilloirVertexFitter; + using Fitter = Acts::FullBilloirVertexFitter; using Seeder = Acts::TrackDensityVertexFinder; using Finder = Acts::IterativeVertexFinder; diff --git a/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/VertexFitterAlgorithm.hpp b/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/VertexFitterAlgorithm.hpp index ded945a2e39..86935e4c778 100644 --- a/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/VertexFitterAlgorithm.hpp +++ b/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/VertexFitterAlgorithm.hpp @@ -48,8 +48,7 @@ class VertexFitterAlgorithm final : public IAlgorithm { using Propagator = Acts::Propagator>; using PropagatorOptions = Acts::PropagatorOptions<>; using Linearizer = Acts::HelicalTrackLinearizer; - using VertexFitter = - Acts::FullBilloirVertexFitter; + using VertexFitter = Acts::FullBilloirVertexFitter; using VertexFitterOptions = Acts::VertexingOptions; using VertexCollection = std::vector; diff --git a/Examples/Algorithms/Vertexing/src/IterativeVertexFinderAlgorithm.cpp b/Examples/Algorithms/Vertexing/src/IterativeVertexFinderAlgorithm.cpp index e3004766e24..c7b4bc6becd 100644 --- a/Examples/Algorithms/Vertexing/src/IterativeVertexFinderAlgorithm.cpp +++ b/Examples/Algorithms/Vertexing/src/IterativeVertexFinderAlgorithm.cpp @@ -74,7 +74,7 @@ ActsExamples::ProcessCode ActsExamples::IterativeVertexFinderAlgorithm::execute( stepper, Acts::VoidNavigator{}, logger().cloneWithSuffix("Propagator")); // Setup the vertex fitter Fitter::Config vertexFitterCfg; - Fitter vertexFitter(vertexFitterCfg, + Fitter vertexFitter(vertexFitterCfg, Acts::InputTrack::extractParameters, logger().cloneWithSuffix("FullBilloirVertexFitter")); // Setup the track linearizer Linearizer::Config linearizerCfg(m_cfg.bField, propagator); @@ -89,7 +89,8 @@ ActsExamples::ProcessCode ActsExamples::IterativeVertexFinderAlgorithm::execute( std::move(seeder), ipEst); finderCfg.maxVertices = 200; finderCfg.reassignTracksAfterFirstFit = false; - Finder finder(std::move(finderCfg), logger().clone()); + Finder finder(std::move(finderCfg), Acts::InputTrack::extractParameters, + logger().clone()); Finder::State state(*m_cfg.bField, ctx.magFieldContext); Options finderOpts(ctx.geoContext, ctx.magFieldContext); diff --git a/Examples/Algorithms/Vertexing/src/VertexFitterAlgorithm.cpp b/Examples/Algorithms/Vertexing/src/VertexFitterAlgorithm.cpp index 596376b91d7..adcc1b35275 100644 --- a/Examples/Algorithms/Vertexing/src/VertexFitterAlgorithm.cpp +++ b/Examples/Algorithms/Vertexing/src/VertexFitterAlgorithm.cpp @@ -49,7 +49,8 @@ ActsExamples::ProcessCode ActsExamples::VertexFitterAlgorithm::execute( PropagatorOptions propagatorOpts(ctx.geoContext, ctx.magFieldContext); // Setup the vertex fitter VertexFitter::Config vertexFitterCfg; - VertexFitter vertexFitter(vertexFitterCfg); + VertexFitter vertexFitter(vertexFitterCfg, + Acts::InputTrack::extractParameters); VertexFitter::State state(m_cfg.bField->makeCache(ctx.magFieldContext)); // Setup the linearizer Linearizer::Config ltConfig(m_cfg.bField, propagator); diff --git a/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp index 879c44c2878..04c3c2b3a45 100644 --- a/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp @@ -411,7 +411,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_grid_seed_finder_test) { SeedFinder::Config seedFinderCfg(250); seedFinderCfg.cacheGridStateForTrackRemoval = true; - SeedFinder seedFinder(seedFinderCfg); + SeedFinder seedFinder(seedFinderCfg, InputTrack::extractParameters); using Finder = AdaptiveMultiVertexFinder; diff --git a/Tests/UnitTests/Core/Vertexing/FullBilloirVertexFitterTests.cpp b/Tests/UnitTests/Core/Vertexing/FullBilloirVertexFitterTests.cpp index 4db0df4d602..8c8c5c0e42c 100644 --- a/Tests/UnitTests/Core/Vertexing/FullBilloirVertexFitterTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/FullBilloirVertexFitterTests.cpp @@ -142,10 +142,9 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_defaulttrack_test) { customConstraint.setFullPosition(Vector4(0, 0, 0, 0)); // Set up Billoir vertex fitter with default tracks - using VertexFitter = - FullBilloirVertexFitter; + using VertexFitter = FullBilloirVertexFitter; VertexFitter::Config vertexFitterCfg; - VertexFitter billoirFitter(vertexFitterCfg); + VertexFitter billoirFitter(vertexFitterCfg, InputTrack::extractParameters); VertexFitter::State state(bField->makeCache(magFieldContext)); // Vertexing options for default tracks VertexingOptions vfOptions(geoContext, magFieldContext); @@ -159,12 +158,9 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_defaulttrack_test) { }; // Set up Billoir vertex fitter with user-defined input tracks - using CustomVertexFitter = - FullBilloirVertexFitter; - CustomVertexFitter::Config customVertexFitterCfg; - CustomVertexFitter customBilloirFitter(customVertexFitterCfg, - extractParameters); - CustomVertexFitter::State customState(bField->makeCache(magFieldContext)); + VertexFitter::Config customVertexFitterCfg; + VertexFitter customBilloirFitter(customVertexFitterCfg, extractParameters); + VertexFitter::State customState(bField->makeCache(magFieldContext)); // Vertexing options for custom tracks VertexingOptions customVfOptions(geoContext, magFieldContext); VertexingOptions customVfOptionsConstr(geoContext, magFieldContext, diff --git a/Tests/UnitTests/Core/Vertexing/GridDensityVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/GridDensityVertexFinderTests.cpp index bbda5f7c9b3..8ed6e7adf3c 100644 --- a/Tests/UnitTests/Core/Vertexing/GridDensityVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/GridDensityVertexFinderTests.cpp @@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(grid_density_vertex_finder_test) { using Finder1 = GridDensityVertexFinder; Finder1::Config cfg1; cfg1.cacheGridStateForTrackRemoval = false; - Finder1 finder1(cfg1); + Finder1 finder1(cfg1, InputTrack::extractParameters); Finder1::State state1; // Use custom grid density here with same bin size as Finder1 @@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(grid_density_vertex_finder_track_caching_test) { Finder1::Config cfg(density); cfg.cacheGridStateForTrackRemoval = true; - Finder1 finder1(cfg); + Finder1 finder1(cfg, InputTrack::extractParameters); // Use custom grid density here with same bin size as Finder1 AdaptiveGridTrackDensity::Config adaptiveDensityConfig; @@ -381,7 +381,7 @@ BOOST_AUTO_TEST_CASE(grid_density_vertex_finder_seed_width_test) { Finder1::Config cfg1; cfg1.cacheGridStateForTrackRemoval = false; cfg1.estimateSeedWidth = true; - Finder1 finder1(cfg1); + Finder1 finder1(cfg1, InputTrack::extractParameters); Finder1::State state1; // Use custom grid density here with same bin size as Finder1 diff --git a/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp index e2b28523df9..ccedeaec179 100644 --- a/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp @@ -138,13 +138,12 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { Linearizer::Config ltConfig(bField, propagator); Linearizer linearizer(ltConfig); - using BilloirFitter = - FullBilloirVertexFitter; + using BilloirFitter = FullBilloirVertexFitter; // Set up Billoir Vertex Fitter BilloirFitter::Config vertexFitterCfg; - BilloirFitter bFitter(vertexFitterCfg); + BilloirFitter bFitter(vertexFitterCfg, InputTrack::extractParameters); // Impact point estimator using IPEstimator = ImpactPointEstimator; @@ -172,7 +171,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { cfg.reassignTracksAfterFirstFit = true; - VertexFinder finder(std::move(cfg)); + VertexFinder finder(std::move(cfg), InputTrack::extractParameters); VertexFinder::State state(*bField, magFieldContext); // Vector to be filled with all tracks in current event @@ -356,7 +355,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_user_track_type) { Linearizer linearizer(ltConfigUT); // Set up vertex fitter for user track type - using BilloirFitter = FullBilloirVertexFitter; + using BilloirFitter = FullBilloirVertexFitter; // Create a custom std::function to extract BoundTrackParameters from // user-defined InputTrack @@ -560,13 +559,12 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_athena_reference) { Linearizer::Config ltConfig(bField, propagator); Linearizer linearizer(ltConfig); - using BilloirFitter = - FullBilloirVertexFitter; + using BilloirFitter = FullBilloirVertexFitter; // Set up Billoir Vertex Fitter BilloirFitter::Config vertexFitterCfg; - BilloirFitter bFitter(vertexFitterCfg); + BilloirFitter bFitter(vertexFitterCfg, InputTrack::extractParameters); // Impact point estimator using IPEstimator = ImpactPointEstimator; @@ -595,7 +593,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_athena_reference) { cfg.maximumChi2cutForSeeding = 49; cfg.significanceCutSeeding = 12; - VertexFinder finder(std::move(cfg)); + VertexFinder finder(std::move(cfg), InputTrack::extractParameters); VertexFinder::State state(*bField, magFieldContext); auto csvData = readTracksAndVertexCSV(toolString); diff --git a/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp index f5a43a44021..a3a50610d6f 100644 --- a/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp @@ -107,8 +107,7 @@ BOOST_AUTO_TEST_CASE(zscan_finder_test) { // Set up propagator with void navigator auto propagator = std::make_shared(stepper); - using BilloirFitter = - FullBilloirVertexFitter; + using BilloirFitter = FullBilloirVertexFitter; // Create perigee surface std::shared_ptr perigeeSurface = @@ -232,7 +231,7 @@ BOOST_AUTO_TEST_CASE(zscan_finder_usertrack_test) { // Set up propagator with void navigator auto propagator = std::make_shared(stepper); - using BilloirFitter = FullBilloirVertexFitter; + using BilloirFitter = FullBilloirVertexFitter; // Create perigee surface std::shared_ptr perigeeSurface = From ab87dd97f646b78533162723263db7a99a873dcd Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Wed, 7 Feb 2024 17:19:16 +0100 Subject: [PATCH 3/3] fix format --- .../Vertexing/FullBilloirVertexFitter.ipp | 5 +- .../Acts/Vertexing/GaussianTrackDensity.ipp | 37 ++++++-------- .../Acts/Vertexing/ImpactPointEstimator.ipp | 49 +++++++------------ .../Acts/Vertexing/KalmanVertexUpdater.ipp | 4 +- 4 files changed, 39 insertions(+), 56 deletions(-) diff --git a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp index a6366ccbcd3..6cc73a8df64 100644 --- a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp +++ b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp @@ -54,9 +54,8 @@ struct BilloirVertex { } // namespace Acts::detail -template < typename linearizer_t> -Acts::Result -Acts::FullBilloirVertexFitter::fit( +template +Acts::Result Acts::FullBilloirVertexFitter::fit( const std::vector& paramVector, const linearizer_t& linearizer, const VertexingOptions& vertexingOptions, State& state) const { unsigned int nTracks = paramVector.size(); diff --git a/Core/include/Acts/Vertexing/GaussianTrackDensity.ipp b/Core/include/Acts/Vertexing/GaussianTrackDensity.ipp index edd99c03f85..20583295339 100644 --- a/Core/include/Acts/Vertexing/GaussianTrackDensity.ipp +++ b/Core/include/Acts/Vertexing/GaussianTrackDensity.ipp @@ -12,8 +12,7 @@ namespace Acts { - inline -std::pair +inline std::pair Acts::GaussianTrackDensity::globalMaximumWithWidth( State& state, const std::vector& trackList, const std::function& @@ -66,16 +65,14 @@ Acts::GaussianTrackDensity::globalMaximumWithWidth( std::sqrt(-(maxDensity / maxSecondDerivative))); } -inline -double Acts::GaussianTrackDensity::globalMaximum( +inline double Acts::GaussianTrackDensity::globalMaximum( State& state, const std::vector& trackList, const std::function& extractParameters) const { return globalMaximumWithWidth(state, trackList, extractParameters).first; } -inline -Result Acts::GaussianTrackDensity::addTracks( +inline Result Acts::GaussianTrackDensity::addTracks( State& state, const std::vector& trackList, const std::function& extractParameters) const { @@ -130,10 +127,9 @@ Result Acts::GaussianTrackDensity::addTracks( return Result::success(); } -inline -std::tuple -Acts::GaussianTrackDensity::trackDensityAndDerivatives( - State& state, double z) const { +inline std::tuple +Acts::GaussianTrackDensity::trackDensityAndDerivatives(State& state, + double z) const { GaussianTrackDensityStore densityResult(z); for (const auto& trackEntry : state.trackEntries) { densityResult.addTrackToDensity(trackEntry); @@ -141,11 +137,11 @@ Acts::GaussianTrackDensity::trackDensityAndDerivatives( return densityResult.densityAndDerivatives(); } -inline -std::tuple -Acts::GaussianTrackDensity::updateMaximum( - double newZ, double newValue, double newSecondDerivative, double maxZ, - double maxValue, double maxSecondDerivative) const { +inline std::tuple +Acts::GaussianTrackDensity::updateMaximum(double newZ, double newValue, + double newSecondDerivative, + double maxZ, double maxValue, + double maxSecondDerivative) const { if (newValue > maxValue) { maxZ = newZ; maxValue = newValue; @@ -154,15 +150,14 @@ Acts::GaussianTrackDensity::updateMaximum( return {maxZ, maxValue, maxSecondDerivative}; } -inline -double Acts::GaussianTrackDensity::stepSize(double y, double dy, - double ddy) const { +inline double Acts::GaussianTrackDensity::stepSize(double y, double dy, + double ddy) const { return (m_cfg.isGaussianShaped ? (y * dy) / (dy * dy - y * ddy) : -dy / ddy); } -inline -void Acts::GaussianTrackDensity::GaussianTrackDensityStore:: - addTrackToDensity(const TrackEntry& entry) { +inline void +Acts::GaussianTrackDensity::GaussianTrackDensityStore::addTrackToDensity( + const TrackEntry& entry) { // Take track only if it's within bounds if (entry.lowerBound < m_z && m_z < entry.upperBound) { double delta = std::exp(entry.c0 + m_z * (entry.c1 + m_z * entry.c2)); diff --git a/Core/include/Acts/Vertexing/ImpactPointEstimator.ipp b/Core/include/Acts/Vertexing/ImpactPointEstimator.ipp index b7ff56c2207..45f09215ccc 100644 --- a/Core/include/Acts/Vertexing/ImpactPointEstimator.ipp +++ b/Core/include/Acts/Vertexing/ImpactPointEstimator.ipp @@ -11,13 +11,11 @@ #include "Acts/Surfaces/PlaneSurface.hpp" #include "Acts/Vertexing/VertexingError.hpp" -template < typename propagator_t, - typename propagator_options_t> -Acts::Result -Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: - calculateDistance(const GeometryContext& gctx, - const BoundTrackParameters& trkParams, - const Vector3& vtxPos, State& state) const { +template +Acts::Result Acts:: + ImpactPointEstimator::calculateDistance( + const GeometryContext& gctx, const BoundTrackParameters& trkParams, + const Vector3& vtxPos, State& state) const { auto res = getDistanceAndMomentum<3>(gctx, trkParams, vtxPos, state); if (!res.ok()) { @@ -28,10 +26,9 @@ Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: return res.value().first.norm(); } -template < typename propagator_t, - typename propagator_options_t> +template Acts::Result -Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: +Acts::ImpactPointEstimator:: estimate3DImpactParameters(const GeometryContext& gctx, const Acts::MagneticFieldContext& mctx, const BoundTrackParameters& trkParams, @@ -106,11 +103,10 @@ Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: } } -template < typename propagator_t, - typename propagator_options_t> +template template Acts::Result -Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: +Acts::ImpactPointEstimator:: getVertexCompatibility(const GeometryContext& gctx, const BoundTrackParameters* trkParams, const ActsVector& vertexPos) const { @@ -176,10 +172,9 @@ Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: return residual.dot(weight * residual); } -template < typename propagator_t, - typename propagator_options_t> +template Acts::Result Acts::ImpactPointEstimator< - propagator_t, + propagator_t, propagator_options_t>::performNewtonOptimization(const Vector3& helixCenter, const Vector3& vtxPos, double phi, double theta, @@ -234,11 +229,10 @@ Acts::Result Acts::ImpactPointEstimator< return phi; } -template < typename propagator_t, - typename propagator_options_t> +template template Acts::Result, Acts::Vector3>> -Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: +Acts::ImpactPointEstimator:: getDistanceAndMomentum(const GeometryContext& gctx, const BoundTrackParameters& trkParams, const ActsVector& vtxPos, State& state) const { @@ -372,12 +366,10 @@ Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: return std::make_pair(deltaR, momDir); } -template < typename propagator_t, - typename propagator_options_t> +template Acts::Result Acts::ImpactPointEstimator:: - getImpactParameters(const BoundTrackParameters& track, - const Vertex& vtx, + getImpactParameters(const BoundTrackParameters& track, const Vertex& vtx, const GeometryContext& gctx, const Acts::MagneticFieldContext& mctx, bool calculateTimeIP) const { @@ -459,12 +451,10 @@ Acts::ImpactPointEstimator:: return ipAndSigma; } -template < typename propagator_t, - typename propagator_options_t> +template Acts::Result> Acts::ImpactPointEstimator:: - getLifetimeSignOfTrack(const BoundTrackParameters& track, - const Vertex& vtx, + getLifetimeSignOfTrack(const BoundTrackParameters& track, const Vertex& vtx, const Acts::Vector3& direction, const GeometryContext& gctx, const MagneticFieldContext& mctx) const { @@ -503,10 +493,9 @@ Acts::ImpactPointEstimator:: return vszs; } -template +template Acts::Result -Acts::ImpactPointEstimator< propagator_t, propagator_options_t>:: +Acts::ImpactPointEstimator:: get3DLifetimeSignOfTrack(const BoundTrackParameters& track, const Vertex& vtx, const Acts::Vector3& direction, const GeometryContext& gctx, diff --git a/Core/include/Acts/Vertexing/KalmanVertexUpdater.ipp b/Core/include/Acts/Vertexing/KalmanVertexUpdater.ipp index 37bb9d7fd46..18854240bcb 100644 --- a/Core/include/Acts/Vertexing/KalmanVertexUpdater.ipp +++ b/Core/include/Acts/Vertexing/KalmanVertexUpdater.ipp @@ -9,8 +9,8 @@ #include template -void Acts::KalmanVertexUpdater::updateVertexWithTrack( - Vertex& vtx, TrackAtVertex& trk) { +void Acts::KalmanVertexUpdater::updateVertexWithTrack(Vertex& vtx, + TrackAtVertex& trk) { std::pair fitQuality = vtx.fitQuality(); detail::updateVertexWithTrack(vtx.fullPosition(), vtx.fullCovariance(), fitQuality, trk, 1, nDimVertex);