From b8f2b6111f37760776a5667a93b2d06caa9811bf Mon Sep 17 00:00:00 2001 From: Paolo Andreetto Date: Wed, 4 Sep 2024 14:55:05 +0200 Subject: [PATCH] Smoother moved out of the track finder --- src/ACTSSeededCKFTrackingProc.cxx | 22 +++++++++++++--------- src/ACTSTruthCKFTrackingProc.cxx | 23 +++++++++++------------ 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/ACTSSeededCKFTrackingProc.cxx b/src/ACTSSeededCKFTrackingProc.cxx index 686bb3d..361ff40 100644 --- a/src/ACTSSeededCKFTrackingProc.cxx +++ b/src/ACTSSeededCKFTrackingProc.cxx @@ -16,16 +16,14 @@ #include #include #include -// #include -// #include #include #include #include #include #include #include -#include #include +#include using namespace Acts::UnitLiterals; @@ -404,7 +402,6 @@ void ACTSSeededCKFTrackingProc::processEvent(LCEvent *evt) { Acts::Vector3{0., 0., 0.}); Acts::GainMatrixUpdater kfUpdater; - Acts::GainMatrixSmoother kfSmoother; Acts::MeasurementSelector measSel { measurementSelectorCfg }; ACTSTracking::MeasurementCalibrator measCal { measurements }; @@ -416,9 +413,6 @@ void ACTSSeededCKFTrackingProc::processEvent(LCEvent *evt) { extensions.updater.connect< &Acts::GainMatrixUpdater::operator()>( &kfUpdater); - extensions.smoother.connect< - &Acts::GainMatrixSmoother::operator()>( - &kfSmoother); extensions.measurementSelector .connect<&Acts::MeasurementSelector::select>( &measSel); @@ -672,8 +666,17 @@ void ACTSSeededCKFTrackingProc::processEvent(LCEvent *evt) { auto result = trackFinder.findTracks(paramseeds.at(iseed), ckfOptions, tracks); if (result.ok()) { const auto& fitOutput = result.value(); - for (const TrackContainer::TrackProxy& trackTip : fitOutput) + for (const TrackContainer::TrackProxy& trackItem : fitOutput) { + auto trackTip = tracks.makeTrack(); + trackTip.copyFrom(trackItem, true); + auto smoothResult = Acts::smoothTrack(geometryContext(), trackTip); + if (!smoothResult.ok()) + { + streamlog_out(DEBUG) << "Smooth failure: " + << smoothResult.error() << std::endl; + continue; + } // // Helpful debug output streamlog_out(DEBUG) << "Trajectory Summary" << std::endl; @@ -692,7 +695,8 @@ void ACTSSeededCKFTrackingProc::processEvent(LCEvent *evt) { // Make track object EVENT::Track *track = ACTSTracking::ACTS2Marlin_track( - trackTip, magneticField(), magCache, _caloFaceR, _caloFaceZ, geometryContext(), magneticFieldContext(), trackingGeometry()); + trackTip, magneticField(), magCache, _caloFaceR, _caloFaceZ, + geometryContext(), magneticFieldContext(), trackingGeometry()); // Save results trackCollection->addElement(track); diff --git a/src/ACTSTruthCKFTrackingProc.cxx b/src/ACTSTruthCKFTrackingProc.cxx index 894a98c..e1a4fdb 100644 --- a/src/ACTSTruthCKFTrackingProc.cxx +++ b/src/ACTSTruthCKFTrackingProc.cxx @@ -18,8 +18,8 @@ #include #include #include -#include #include +#include #include "Acts/EventData/VectorTrackContainer.hpp" #include "Acts/EventData/VectorMultiTrajectory.hpp" @@ -33,12 +33,7 @@ using namespace Acts::UnitLiterals; using TrackFinderOptions = Acts::CombinatorialKalmanFilterOptions; -/* -using TrackFinderResult = Acts::Result< - Acts::CombinatorialKalmanFilterResult>; -using TrackFinderResultContainer = std::vector; -*/ ACTSTruthCKFTrackingProc aACTSTruthCKFTrackingProc; ACTSTruthCKFTrackingProc::ACTSTruthCKFTrackingProc() @@ -265,7 +260,6 @@ void ACTSTruthCKFTrackingProc::processEvent(LCEvent* evt) { pOptions.maxSteps = 10000; Acts::GainMatrixUpdater kfUpdater; - Acts::GainMatrixSmoother kfSmoother; Acts::MeasurementSelector measSel { measurementSelectorCfg }; ACTSTracking::MeasurementCalibrator measCal { measurements }; @@ -277,9 +271,6 @@ void ACTSTruthCKFTrackingProc::processEvent(LCEvent* evt) { extensions.updater.connect< &Acts::GainMatrixUpdater::operator()>( &kfUpdater); - extensions.smoother.connect< - &Acts::GainMatrixSmoother::operator()>( - &kfSmoother); extensions.measurementSelector .connect<&Acts::MeasurementSelector::select>( &measSel); @@ -322,9 +313,17 @@ void ACTSTruthCKFTrackingProc::processEvent(LCEvent* evt) { auto result = trackFinder.findTracks(seeds.at(iseed), ckfOptions, tracks); if (result.ok()) { const auto& fitOutput = result.value(); - for (const auto& trackTip : fitOutput) + for (const auto& trackItem : fitOutput) { - std::cout << trackTip.chi2() << std::endl; + auto trackTip = tracks.makeTrack(); + trackTip.copyFrom(trackItem, true); + auto smoothResult = Acts::smoothTrack(geometryContext(), trackTip); + if (!smoothResult.ok()) + { + streamlog_out(DEBUG) << "Smooth failure: " + << smoothResult.error() << std::endl; + continue; + } EVENT::Track* track = ACTSTracking::ACTS2Marlin_track( trackTip, magneticField(), magCache, _caloFaceR, _caloFaceZ, geometryContext(), magneticFieldContext(), trackingGeometry());