Skip to content

Commit

Permalink
Smoother moved out of the track finder
Browse files Browse the repository at this point in the history
  • Loading branch information
pandreetto committed Sep 4, 2024
1 parent 844bacd commit b8f2b61
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
22 changes: 13 additions & 9 deletions src/ACTSSeededCKFTrackingProc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@
#include <Acts/Propagator/EigenStepper.hpp>
#include <Acts/Propagator/Navigator.hpp>
#include <Acts/Propagator/Propagator.hpp>
// #include <Acts/Seeding/BinFinder.hpp>
// #include <Acts/Seeding/BinnedSPGroup.hpp>
#include <Acts/Seeding/EstimateTrackParamsFromSeed.hpp>
#include <Acts/Seeding/SeedFinder.hpp>
#include <Acts/Seeding/SpacePointGrid.hpp>
#include <Acts/Surfaces/PerigeeSurface.hpp>
#include <Acts/TrackFinding/CombinatorialKalmanFilter.hpp>
#include <Acts/TrackFinding/MeasurementSelector.hpp>
#include <Acts/TrackFitting/GainMatrixSmoother.hpp>
#include <Acts/TrackFitting/GainMatrixUpdater.hpp>
#include <Acts/Utilities/TrackHelpers.hpp>

using namespace Acts::UnitLiterals;

Expand Down Expand Up @@ -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 };
Expand All @@ -416,9 +413,6 @@ void ACTSSeededCKFTrackingProc::processEvent(LCEvent *evt) {
extensions.updater.connect<
&Acts::GainMatrixUpdater::operator()<Acts::VectorMultiTrajectory>>(
&kfUpdater);
extensions.smoother.connect<
&Acts::GainMatrixSmoother::operator()<Acts::VectorMultiTrajectory>>(
&kfSmoother);
extensions.measurementSelector
.connect<&Acts::MeasurementSelector::select<Acts::VectorMultiTrajectory>>(
&measSel);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
23 changes: 11 additions & 12 deletions src/ACTSTruthCKFTrackingProc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <Acts/Surfaces/PerigeeSurface.hpp>
#include <Acts/TrackFinding/CombinatorialKalmanFilter.hpp>
#include <Acts/TrackFinding/MeasurementSelector.hpp>
#include <Acts/TrackFitting/GainMatrixSmoother.hpp>
#include <Acts/TrackFitting/GainMatrixUpdater.hpp>
#include <Acts/Utilities/TrackHelpers.hpp>

#include "Acts/EventData/VectorTrackContainer.hpp"
#include "Acts/EventData/VectorMultiTrajectory.hpp"
Expand All @@ -33,12 +33,7 @@ using namespace Acts::UnitLiterals;
using TrackFinderOptions =
Acts::CombinatorialKalmanFilterOptions<ACTSTracking::SourceLinkAccessor::Iterator,
Acts::VectorMultiTrajectory>;
/*
using TrackFinderResult = Acts::Result<
Acts::CombinatorialKalmanFilterResult<ACTSTracking::SourceLink>>;

using TrackFinderResultContainer = std::vector<TrackFinderResult>;
*/
ACTSTruthCKFTrackingProc aACTSTruthCKFTrackingProc;

ACTSTruthCKFTrackingProc::ACTSTruthCKFTrackingProc()
Expand Down Expand Up @@ -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 };
Expand All @@ -277,9 +271,6 @@ void ACTSTruthCKFTrackingProc::processEvent(LCEvent* evt) {
extensions.updater.connect<
&Acts::GainMatrixUpdater::operator()<Acts::VectorMultiTrajectory>>(
&kfUpdater);
extensions.smoother.connect<
&Acts::GainMatrixSmoother::operator()<Acts::VectorMultiTrajectory>>(
&kfSmoother);
extensions.measurementSelector
.connect<&Acts::MeasurementSelector::select<Acts::VectorMultiTrajectory>>(
&measSel);
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit b8f2b61

Please sign in to comment.