Skip to content

Commit

Permalink
Merge pull request #397 from eic/acts-20.3.0
Browse files Browse the repository at this point in the history
feat: support Acts-20.2.0 and beyond (within 20.x release series)
  • Loading branch information
wdconinc authored Dec 20, 2022
2 parents 48793c7 + c8cd86a commit e42c3d3
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 25 deletions.
2 changes: 1 addition & 1 deletion cmake/jana_plugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ macro(plugin_add_acts _name)

if(NOT Acts_FOUND)
find_package(Acts REQUIRED COMPONENTS Core PluginIdentification PluginTGeo PluginJson PluginDD4hep)
set(Acts_VERSION_MIN "19.0.0")
set(Acts_VERSION_MIN "20.2.0")
set(Acts_VERSION "${Acts_VERSION_MAJOR}.${Acts_VERSION_MINOR}.${Acts_VERSION_PATCH}")
if(${Acts_VERSION} VERSION_LESS ${Acts_VERSION_MIN}
AND NOT "${Acts_VERSION}" STREQUAL "9.9.9")
Expand Down
17 changes: 12 additions & 5 deletions src/algorithms/tracking/CKFTracking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,18 @@ namespace eicrecon {
Acts::MeasurementSelector measSel{m_sourcelinkSelectorCfg};
//Acts::MeasurementSelector measSel;

Acts::CombinatorialKalmanFilterExtensions extensions;
Acts::CombinatorialKalmanFilterExtensions<Acts::VectorMultiTrajectory>
extensions;
extensions.calibrator.connect<&eicrecon::MeasurementCalibrator::calibrate>(&calibrator);
extensions.updater.connect<&Acts::GainMatrixUpdater::operator()>(&kfUpdater);
extensions.smoother.connect<&Acts::GainMatrixSmoother::operator()>(&kfSmoother);
extensions.measurementSelector.connect<&Acts::MeasurementSelector::select>(&measSel);
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);

eicrecon::IndexSourceLinkAccessor slAccessor;
slAccessor.container = &src_links;
Expand Down Expand Up @@ -133,7 +140,7 @@ namespace eicrecon {

if (result.ok()) {
// Get the track finding output object
const auto &trackFindingOutput = result.value();
auto &trackFindingOutput = result.value();
// Create a SimMultiTrajectory
trajectories.push_back(new eicrecon::TrackingResultTrajectory(std::move(trackFindingOutput.fittedStates),
std::move(trackFindingOutput.lastMeasurementIndices),
Expand Down
7 changes: 5 additions & 2 deletions src/algorithms/tracking/CKFTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ namespace eicrecon {
public:
/// Track finder function that takes input measurements, initial trackstate
/// and track finder options and returns some track-finder-specific result.
using TrackFinderOptions = Acts::CombinatorialKalmanFilterOptions<eicrecon::IndexSourceLinkAccessor::Iterator>;
using TrackFinderResult = std::vector<Acts::Result<Acts::CombinatorialKalmanFilterResult>>;
using TrackFinderOptions =
Acts::CombinatorialKalmanFilterOptions<IndexSourceLinkAccessor::Iterator,
Acts::VectorMultiTrajectory>;
using TrackFinderResult = std::vector<Acts::Result<
Acts::CombinatorialKalmanFilterResult<Acts::VectorMultiTrajectory>>>;

/// Find function that takes the above parameters
/// @note This is separated into a virtual interface to keep compilation units
Expand Down
3 changes: 2 additions & 1 deletion src/algorithms/tracking/CKFTrackingFunction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ namespace eicrecon{
using Stepper = Acts::EigenStepper<>;
using Navigator = Acts::Navigator;
using Propagator = Acts::Propagator<Stepper, Navigator>;
using CKF = Acts::CombinatorialKalmanFilter<Propagator>;
using CKF =
Acts::CombinatorialKalmanFilter<Propagator, Acts::VectorMultiTrajectory>;

/** Finder implementation .
*
Expand Down
7 changes: 5 additions & 2 deletions src/algorithms/tracking/JugTrack/Measurement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "Acts/EventData/Measurement.hpp"
#include "Acts/EventData/MultiTrajectory.hpp"
#include "Acts/EventData/SourceLink.hpp"
#include "Acts/EventData/VectorMultiTrajectory.hpp"
#include "IndexSourceLink.hpp"

#include <cassert>
Expand Down Expand Up @@ -37,8 +38,10 @@ namespace eicrecon {
/// @tparam parameters_t Track parameters type
/// @param gctx The geometry context (unused)
/// @param trackState The track state to calibrate
void calibrate(const Acts::GeometryContext& /*gctx*/,
Acts::MultiTrajectory::TrackStateProxy trackState) const {
void calibrate(
const Acts::GeometryContext& /*gctx*/,
Acts::MultiTrajectory<Acts::VectorMultiTrajectory>::TrackStateProxy
trackState) const {
const auto& sourceLink =
static_cast<const IndexSourceLink&>(trackState.uncalibrated());

Expand Down
29 changes: 17 additions & 12 deletions src/algorithms/tracking/JugTrack/TrackingResultTrajectory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define JugTrack_Trajectories_HH

#include "Acts/EventData/MultiTrajectory.hpp"
#include "Acts/EventData/VectorMultiTrajectory.hpp"
#include "IndexSourceLink.hpp"
#include "Track.hpp"

Expand All @@ -25,9 +26,11 @@ namespace eicrecon {
struct TrackingResultTrajectory final {
public:
/// (Reconstructed) trajectory with multiple states.
using MultiTrajectory = Acts::MultiTrajectory;
using MultiTrajectory = Acts::VectorMultiTrajectory;
/// Fitted parameters identified by indices in the multi trajectory.
using IndexedParameters = std::unordered_map<size_t, TrackParameters>;
using IndexedParameters =
std::unordered_map<Acts::MultiTrajectoryTraits::IndexType,
TrackParameters>;

/// Default construct an empty object. Required for container compatibility
/// and to signal an error.
Expand All @@ -37,10 +40,10 @@ struct TrackingResultTrajectory final {
/// @param multiTraj The multi trajectory
/// @param tTips Tip indices that identify valid trajectories
/// @param parameters Fitted track parameters indexed by trajectory index
TrackingResultTrajectory(MultiTrajectory multiTraj,
const std::vector<size_t>& tTips,
TrackingResultTrajectory(std::shared_ptr<MultiTrajectory> multiTraj,
const std::vector<Acts::MultiTrajectoryTraits::IndexType>& tTips,
const IndexedParameters& parameters)
: m_multiTrajectory(multiTraj),
: m_multiTrajectory(std::move(multiTraj)),
m_trackTips(tTips),
m_trackParameters(parameters) {}

Expand All @@ -51,31 +54,33 @@ struct TrackingResultTrajectory final {
const MultiTrajectory& multiTrajectory() const { return *m_multiTrajectory; }

/// Access the tip indices that identify valid trajectories.
const std::vector<size_t>& tips() const {
return m_trackTips;
const std::vector<Acts::MultiTrajectoryTraits::IndexType>& tips() const {
return m_trackTips;
}

/// Check if a trajectory exists for the given index.
///
/// @param entryIndex The trajectory entry index
/// @return Whether there is trajectory with provided entry index
bool hasTrajectory(size_t entryIndex) const {
bool hasTrajectory(Acts::MultiTrajectoryTraits::IndexType entryIndex) const {
return (0 < std::count(m_trackTips.begin(), m_trackTips.end(), entryIndex));
}

/// Check if fitted track parameters exists for the given index.
///
/// @param entryIndex The trajectory entry index
/// @return Whether having fitted track parameters or not
bool hasTrackParameters(size_t entryIndex) const {
bool hasTrackParameters(
Acts::MultiTrajectoryTraits::IndexType entryIndex) const {
return (0 < m_trackParameters.count(entryIndex));
}

/// Access the fitted track parameters for the given index.
///
/// @param entryIndex The trajectory entry index
/// @return The fitted track parameters of the trajectory
const TrackParameters& trackParameters(size_t entryIndex) const {
const TrackParameters& trackParameters(
Acts::MultiTrajectoryTraits::IndexType entryIndex) const {
auto it = m_trackParameters.find(entryIndex);
if (it == m_trackParameters.end()) {
throw std::runtime_error(
Expand All @@ -87,9 +92,9 @@ struct TrackingResultTrajectory final {

private:
// The multiTrajectory
std::optional<MultiTrajectory> m_multiTrajectory;
std::shared_ptr<MultiTrajectory> m_multiTrajectory;
// The entry indices of trajectories stored in multiTrajectory
std::vector<size_t> m_trackTips = {};
std::vector<Acts::MultiTrajectoryTraits::IndexType> m_trackTips = {};
// The fitted parameters at the provided surface for individual trajectories
IndexedParameters m_trackParameters = {};
};
Expand Down
1 change: 0 additions & 1 deletion src/algorithms/tracking/TrackProjector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/MagneticField/ConstantBField.hpp"
#include "Acts/MagneticField/InterpolatedBFieldMap.hpp"
#include "Acts/MagneticField/SharedBField.hpp"
#include "Acts/Propagator/EigenStepper.hpp"
#include "Acts/Surfaces/PerigeeSurface.hpp"

Expand Down
1 change: 0 additions & 1 deletion src/algorithms/tracking/TrackPropagation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/MagneticField/ConstantBField.hpp"
#include "Acts/MagneticField/InterpolatedBFieldMap.hpp"
#include "Acts/MagneticField/SharedBField.hpp"
#include "Acts/Propagator/EigenStepper.hpp"
#include "Acts/Surfaces/PerigeeSurface.hpp"

Expand Down

0 comments on commit e42c3d3

Please sign in to comment.