From 662b34fbc7f623c8e55b4729317d25dbf45205c8 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 28 Mar 2024 20:43:48 +0100 Subject: [PATCH] twoWay=true; extrapolate second --- .../TrackFinding/TrackFindingAlgorithm.hpp | 2 +- .../src/TrackFindingAlgorithm.cpp | 28 +++++++++++++++---- .../python/acts/examples/reconstruction.py | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/TrackFindingAlgorithm.hpp b/Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/TrackFindingAlgorithm.hpp index 6091bb9a412..4c6ad13c91a 100644 --- a/Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/TrackFindingAlgorithm.hpp +++ b/Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/TrackFindingAlgorithm.hpp @@ -112,7 +112,7 @@ class TrackFindingAlgorithm final : public IAlgorithm { Acts::TrackExtrapolationStrategy extrapolationStrategy = Acts::TrackExtrapolationStrategy::firstOrLast; /// Run finding in two directions - bool twoWay = false; + bool twoWay = true; }; /// Constructor of the track finding algorithm diff --git a/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithm.cpp b/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithm.cpp index ace9bd94405..ed1396377d5 100644 --- a/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithm.cpp +++ b/Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithm.cpp @@ -246,6 +246,22 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithm::execute( Acts::calculateTrackQuantities(secondTrack); + // TODO this extrapolation should not be necessary as the CKF will + // target this surface anyway and could communicate the parameters + auto secondExtrapolationResult = + Acts::extrapolateTrackToReferenceSurface( + secondTrack, *pSurface, extrapolator, + extrapolationOptions, m_cfg.extrapolationStrategy, + logger()); + if (!secondExtrapolationResult.ok()) { + m_nFailedExtrapolation++; + ACTS_ERROR("Second extrapolation for seed " + << iSeed << " and track " << firstTrack.index() + << " failed with error " + << secondExtrapolationResult.error()); + continue; + } + if (!m_trackSelector.has_value() || m_trackSelector->isValidTrack(secondTrack)) { auto destProxy = tracks.getTrack(tracks.addTrack()); @@ -259,14 +275,16 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithm::execute( } if (nSecond == 0) { - auto extrapolationResult = Acts::extrapolateTrackToReferenceSurface( - firstTrack, *pSurface, extrapolator, extrapolationOptions, - m_cfg.extrapolationStrategy, logger()); - if (!extrapolationResult.ok()) { + auto firstExtrapolationResult = + Acts::extrapolateTrackToReferenceSurface( + firstTrack, *pSurface, extrapolator, extrapolationOptions, + m_cfg.extrapolationStrategy, logger()); + if (!firstExtrapolationResult.ok()) { m_nFailedExtrapolation++; ACTS_ERROR("Extrapolation for seed " << iSeed << " and track " << firstTrack.index() - << " failed with error " << extrapolationResult.error()); + << " failed with error " + << firstExtrapolationResult.error()); continue; } diff --git a/Examples/Python/python/acts/examples/reconstruction.py b/Examples/Python/python/acts/examples/reconstruction.py index 243a8d16f9f..52f8947c246 100644 --- a/Examples/Python/python/acts/examples/reconstruction.py +++ b/Examples/Python/python/acts/examples/reconstruction.py @@ -1164,7 +1164,7 @@ def addCKFTracks( Union[TrackSelectorConfig, List[TrackSelectorConfig]] ] = None, ckfConfig: CkfConfig = CkfConfig(), - twoWay: bool = False, + twoWay: bool = True, outputDirCsv: Optional[Union[Path, str]] = None, outputDirRoot: Optional[Union[Path, str]] = None, writeTrajectories: bool = True,