Skip to content

Commit 1c6a13e

Browse files
authored
IterativeVertexFinder: drop support for Acts older than 33 (#1755)
### Briefly, what does this PR introduce? Removes remaining support for Acts 31. ### What kind of change does this PR introduce? - [x] Bug fix (issue #1705) - [ ] New feature (issue #__) - [ ] Documentation update - [ ] Other: __ ### Please check if this PR fulfills the following: - [ ] Tests for the changes have been added - [ ] Documentation has been added / updated - [ ] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? No ### Does this PR change default behavior? No
1 parent 50210f6 commit 1c6a13e

7 files changed

+26
-105
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ find_package(DD4hep REQUIRED)
198198

199199
# ACTS cmake-lint: disable=C0103
200200
find_package(Acts REQUIRED COMPONENTS Core PluginDD4hep PluginJson)
201-
set(Acts_VERSION_MIN "19.0.0")
201+
set(Acts_VERSION_MIN "33.0.0")
202202
set(Acts_VERSION
203203
"${Acts_VERSION_MAJOR}.${Acts_VERSION_MINOR}.${Acts_VERSION_PATCH}")
204204
if(${Acts_VERSION} VERSION_LESS ${Acts_VERSION_MIN} AND NOT "${Acts_VERSION}"

cmake/jana_plugin.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ macro(plugin_add_acts _name)
272272

273273
if(NOT Acts_FOUND)
274274
find_package(Acts REQUIRED COMPONENTS Core PluginDD4hep PluginJson)
275-
set(Acts_VERSION_MIN "20.2.0")
275+
set(Acts_VERSION_MIN "33.0.0")
276276
set(Acts_VERSION
277277
"${Acts_VERSION_MAJOR}.${Acts_VERSION_MINOR}.${Acts_VERSION_PATCH}")
278278
if(${Acts_VERSION} VERSION_LESS ${Acts_VERSION_MIN}

src/algorithms/tracking/CKFTracking.cc

+14-14
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,29 @@
44
#include "CKFTracking.h"
55

66
#include <Acts/Definitions/Algebra.hpp>
7+
#include <Acts/Definitions/Direction.hpp>
78
#include <Acts/Definitions/TrackParametrization.hpp>
89
#include <Acts/Definitions/Units.hpp>
910
#include <Acts/EventData/GenericBoundTrackParameters.hpp>
10-
#if Acts_VERSION_MAJOR >= 32
1111
#include <Acts/EventData/TrackStateProxy.hpp>
12-
#endif
1312
#include <Acts/EventData/Types.hpp>
13+
#include <Acts/Geometry/Layer.hpp>
14+
#include <Acts/Propagator/ActionList.hpp>
15+
#include <boost/container/vector.hpp>
16+
#include <boost/move/utility_core.hpp>
1417
#if Acts_VERSION_MAJOR < 36
1518
#include <Acts/EventData/Measurement.hpp>
1619
#endif
1720
#include <Acts/EventData/MultiTrajectory.hpp>
1821
#include <Acts/EventData/ParticleHypothesis.hpp>
19-
#if Acts_VERSION_MAJOR >= 32
20-
#include "Acts/EventData/ProxyAccessor.hpp"
21-
#endif
2222
#include <Acts/EventData/SourceLink.hpp>
2323
#include <Acts/EventData/TrackContainer.hpp>
2424
#include <Acts/EventData/TrackProxy.hpp>
2525
#include <Acts/EventData/VectorMultiTrajectory.hpp>
2626
#include <Acts/EventData/VectorTrackContainer.hpp>
2727
#include <Acts/Geometry/GeometryIdentifier.hpp>
28+
29+
#include "Acts/EventData/ProxyAccessor.hpp"
2830
#if Acts_VERSION_MAJOR >= 34
2931
#include "Acts/Propagator/AbortList.hpp"
3032
#include "Acts/Propagator/EigenStepper.hpp"
@@ -37,7 +39,9 @@
3739
#endif
3840
#include <Acts/Surfaces/PerigeeSurface.hpp>
3941
#include <Acts/Surfaces/Surface.hpp>
42+
#if Acts_VERSION_MAJOR < 34
4043
#include <Acts/TrackFitting/GainMatrixSmoother.hpp>
44+
#endif
4145
#include <Acts/TrackFitting/GainMatrixUpdater.hpp>
4246
#include <Acts/Utilities/Logger.hpp>
4347
#if Acts_VERSION_MAJOR >= 34
@@ -54,13 +58,17 @@
5458
#include <edm4hep/Vector2f.h>
5559
#include <fmt/core.h>
5660
#include <Eigen/Core>
61+
#include <Eigen/Geometry>
62+
#include <algorithm>
5763
#include <array>
5864
#include <cmath>
5965
#include <cstddef>
6066
#include <functional>
6167
#include <list>
6268
#include <optional>
69+
#include <ostream>
6370
#include <ranges>
71+
#include <system_error>
6472
#include <utility>
6573

6674
#include "ActsGeometryProvider.h"
@@ -260,11 +268,7 @@ namespace eicrecon {
260268

261269
// Add seed number column
262270
acts_tracks.addColumn<unsigned int>("seed");
263-
#if Acts_VERSION_MAJOR >= 32
264271
Acts::ProxyAccessor<unsigned int> seedNumber("seed");
265-
#else
266-
Acts::TrackAccessor<unsigned int> seedNumber("seed");
267-
#endif
268272
std::vector<Acts::TrackIndexType> failed_tracks;
269273

270274
// Loop over seeds
@@ -281,7 +285,7 @@ namespace eicrecon {
281285
auto& tracksForSeed = result.value();
282286
for (auto& track : tracksForSeed) {
283287

284-
#if Acts_VERSION_MAJOR >=34
288+
#if Acts_VERSION_MAJOR >= 34
285289
auto smoothingResult = Acts::smoothTrack(m_geoctx, track, logger());
286290
if (!smoothingResult.ok()) {
287291
ACTS_ERROR("Smoothing for seed "
@@ -340,11 +344,7 @@ namespace eicrecon {
340344
auto& constTracks = *(constTracks_v.front());
341345

342346
// Seed number column accessor
343-
#if Acts_VERSION_MAJOR >= 32
344347
const Acts::ConstProxyAccessor<unsigned int> constSeedNumber("seed");
345-
#else
346-
const Acts::ConstTrackAccessor<unsigned int> constSeedNumber("seed");
347-
#endif
348348

349349
// Prepare the output data with MultiTrajectory, per seed
350350
std::vector<ActsExamples::Trajectories*> acts_trajectories;

src/algorithms/tracking/CKFTracking.h

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#pragma once
55

6+
#include <Acts/EventData/TrackStatePropMask.hpp>
67
#include <Acts/EventData/VectorMultiTrajectory.hpp>
78
#include <Acts/Geometry/GeometryContext.hpp>
89
#include <Acts/Geometry/TrackingGeometry.hpp>

src/algorithms/tracking/DD4hepBField.h

-4
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ namespace eicrecon::BField {
4343

4444
Acts::MagneticFieldProvider::Cache makeCache(const Acts::MagneticFieldContext& mctx) const override
4545
{
46-
#if Acts_VERSION_MAJOR >= 32
4746
return Acts::MagneticFieldProvider::Cache(std::in_place_type<Cache>, mctx);
48-
#else
49-
return Acts::MagneticFieldProvider::Cache::make<Cache>(mctx);
50-
#endif
5147
}
5248

5349
/** construct constant magnetic field from field vector.

src/algorithms/tracking/IterativeVertexFinder.cc

+8-75
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,39 @@
44

55
#include "IterativeVertexFinder.h"
66

7-
#include <Acts/Definitions/Common.hpp>
8-
#include <Acts/Definitions/Direction.hpp>
97
#include <Acts/Definitions/TrackParametrization.hpp>
108
#include <Acts/Definitions/Units.hpp>
119
#include <Acts/EventData/GenericBoundTrackParameters.hpp>
12-
#include <Acts/EventData/GenericParticleHypothesis.hpp>
13-
#include <Acts/EventData/ParticleHypothesis.hpp>
14-
#include <Acts/EventData/TrackParameters.hpp>
10+
#include <Acts/MagneticField/MagneticFieldProvider.hpp>
1511
#include <Acts/Propagator/EigenStepper.hpp>
1612
#include <Acts/Propagator/Propagator.hpp>
17-
#include <ActsExamples/EventData/Track.hpp>
18-
#include <boost/move/utility_core.hpp>
19-
#include <edm4eic/Track.h>
20-
#include <fmt/core.h>
21-
#include <podio/RelationRange.h>
22-
#if Acts_VERSION_MAJOR >= 32
2313
#include <Acts/Propagator/VoidNavigator.hpp>
24-
#else
25-
#include <Acts/Propagator/detail/VoidPropagatorComponents.hpp>
26-
#endif
14+
#include <Acts/Utilities/Delegate.hpp>
2715
#include <Acts/Utilities/Logger.hpp>
2816
#include <Acts/Utilities/Result.hpp>
29-
#include <Acts/Utilities/VectorHelpers.hpp>
3017
#include <Acts/Vertexing/FullBilloirVertexFitter.hpp>
3118
#include <Acts/Vertexing/HelicalTrackLinearizer.hpp>
19+
#include <Acts/Vertexing/IVertexFinder.hpp>
3220
#include <Acts/Vertexing/ImpactPointEstimator.hpp>
3321
#include <Acts/Vertexing/IterativeVertexFinder.hpp>
22+
#include <Acts/Vertexing/LinearizedTrack.hpp>
3423
#include <Acts/Vertexing/TrackAtVertex.hpp>
3524
#include <Acts/Vertexing/Vertex.hpp>
3625
#include <Acts/Vertexing/VertexingOptions.hpp>
3726
#include <Acts/Vertexing/ZScanVertexFinder.hpp>
27+
#include <ActsExamples/EventData/Track.hpp>
3828
#include <ActsExamples/EventData/Trajectories.hpp>
39-
#include <boost/container/vector.hpp>
4029
#include <edm4eic/Cov4f.h>
4130
#include <edm4eic/ReconstructedParticleCollection.h>
31+
#include <edm4eic/Track.h>
4232
#include <edm4eic/TrackParameters.h>
4333
#include <edm4eic/Trajectory.h>
4434
#include <edm4eic/unit_system.h>
4535
#include <edm4hep/Vector2f.h>
36+
#include <fmt/core.h>
37+
#include <podio/RelationRange.h>
4638
#include <Eigen/Core>
47-
#include <Eigen/Geometry>
48-
#include <Eigen/LU>
49-
#include <algorithm>
5039
#include <cmath>
51-
#include <optional>
52-
#include <tuple>
5340
#include <utility>
5441

5542
#include "extensions/spdlog/SpdlogToActs.h"
@@ -73,79 +60,50 @@ std::unique_ptr<edm4eic::VertexCollection> eicrecon::IterativeVertexFinder::prod
7360
auto outputVertices = std::make_unique<edm4eic::VertexCollection>();
7461

7562
using Propagator = Acts::Propagator<Acts::EigenStepper<>>;
76-
#if Acts_VERSION_MAJOR >= 33
7763
using Linearizer = Acts::HelicalTrackLinearizer;
7864
using VertexFitter = Acts::FullBilloirVertexFitter;
7965
using ImpactPointEstimator = Acts::ImpactPointEstimator;
8066
using VertexSeeder = Acts::ZScanVertexFinder;
8167
using VertexFinder = Acts::IterativeVertexFinder;
8268
using VertexFinderOptions = Acts::VertexingOptions;
83-
#else
84-
using Linearizer = Acts::HelicalTrackLinearizer<Propagator>;
85-
using VertexFitter = Acts::FullBilloirVertexFitter<Acts::BoundTrackParameters, Linearizer>;
86-
using ImpactPointEstimator = Acts::ImpactPointEstimator<Acts::BoundTrackParameters, Propagator>;
87-
using VertexSeeder = Acts::ZScanVertexFinder<VertexFitter>;
88-
using VertexFinder = Acts::IterativeVertexFinder<VertexFitter, VertexSeeder>;
89-
using VertexFinderOptions = Acts::VertexingOptions<Acts::BoundTrackParameters>;
90-
#endif
9169

9270
ACTS_LOCAL_LOGGER(eicrecon::getSpdlogLogger("IVF", m_log));
9371

9472
Acts::EigenStepper<> stepper(m_BField);
9573

9674
// Set up propagator with void navigator
97-
#if Acts_VERSION_MAJOR >= 32
9875
auto propagator = std::make_shared<Propagator>(
9976
stepper, Acts::VoidNavigator{}, logger().cloneWithSuffix("Prop"));
100-
#else
101-
auto propagator = std::make_shared<Propagator>(
102-
stepper, Acts::detail::VoidNavigator{}, logger().cloneWithSuffix("Prop"));
103-
#endif
10477

10578
// Setup the track linearizer
106-
#if Acts_VERSION_MAJOR >= 33
10779
Linearizer::Config linearizerCfg;
10880
linearizerCfg.bField = m_BField;
10981
linearizerCfg.propagator = propagator;
110-
#else
111-
Linearizer::Config linearizerCfg(m_BField, propagator);
112-
#endif
11382
Linearizer linearizer(linearizerCfg, logger().cloneWithSuffix("HelLin"));
11483

11584
// Setup the vertex fitter
11685
VertexFitter::Config vertexFitterCfg;
117-
#if Acts_VERSION_MAJOR >= 33
11886
vertexFitterCfg.extractParameters
11987
.connect<&Acts::InputTrack::extractParameters>();
12088
vertexFitterCfg.trackLinearizer.connect<&Linearizer::linearizeTrack>(
12189
&linearizer);
122-
#endif
12390
VertexFitter vertexFitter(vertexFitterCfg);
12491

12592
// Setup the seed finder
12693
ImpactPointEstimator::Config ipEstCfg(m_BField, propagator);
12794
ImpactPointEstimator ipEst(ipEstCfg);
12895
VertexSeeder::Config seederCfg(ipEst);
129-
#if Acts_VERSION_MAJOR >= 33
13096
seederCfg.extractParameters
13197
.connect<&Acts::InputTrack::extractParameters>();
13298
auto seeder = std::make_shared<VertexSeeder>(seederCfg);
133-
#else
134-
VertexSeeder seeder(seederCfg);
135-
#endif
13699

137100
// Set up the actual vertex finder
138101
VertexFinder::Config finderCfg(
139102
std::move(vertexFitter),
140-
#if Acts_VERSION_MAJOR < 33
141-
std::move(linearizer),
142-
#endif
143103
std::move(seeder),
144104
std::move(ipEst));
145105
finderCfg.maxVertices = m_cfg.maxVertices;
146106
finderCfg.reassignTracksAfterFirstFit = m_cfg.reassignTracksAfterFirstFit;
147-
#if Acts_VERSION_MAJOR >= 31
148-
#if Acts_VERSION_MAJOR >= 33
149107
finderCfg.extractParameters.connect<&Acts::InputTrack::extractParameters>();
150108
finderCfg.trackLinearizer.connect<&Linearizer::linearizeTrack>(&linearizer);
151109
#if Acts_VERSION_MAJOR >= 36
@@ -154,26 +112,14 @@ std::unique_ptr<edm4eic::VertexCollection> eicrecon::IterativeVertexFinder::prod
154112
finderCfg.field = std::dynamic_pointer_cast<Acts::MagneticFieldProvider>(
155113
std::const_pointer_cast<eicrecon::BField::DD4hepBField>(m_BField));
156114
#endif
157-
#endif
158115
VertexFinder finder(std::move(finderCfg));
159-
#else
160-
VertexFinder finder(finderCfg);
161-
#endif
162-
#if Acts_VERSION_MAJOR >= 33
163116
Acts::IVertexFinder::State state(
164117
std::in_place_type<VertexFinder::State>,
165118
*m_BField,
166119
m_fieldctx);
167-
#else
168-
VertexFinder::State state(*m_BField, m_fieldctx);
169-
#endif
170120
VertexFinderOptions finderOpts(m_geoctx, m_fieldctx);
171121

172-
#if Acts_VERSION_MAJOR >= 33
173122
std::vector<Acts::InputTrack> inputTracks;
174-
#else
175-
std::vector<const Acts::BoundTrackParameters*> inputTrackPointers;
176-
#endif
177123

178124
for (const auto& trajectory : trajectories) {
179125
auto tips = trajectory->tips();
@@ -184,22 +130,13 @@ std::unique_ptr<edm4eic::VertexCollection> eicrecon::IterativeVertexFinder::prod
184130
for (auto& tip : tips) {
185131
ActsExamples::TrackParameters par = trajectory->trackParameters(tip);
186132

187-
#if Acts_VERSION_MAJOR >= 33
188133
inputTracks.emplace_back(&(trajectory->trackParameters(tip)));
189-
#else
190-
inputTrackPointers.push_back(&(trajectory->trackParameters(tip)));
191-
#endif
192134
m_log->trace("Track local position at input = {} mm, {} mm", par.localPosition().x() / Acts::UnitConstants::mm, par.localPosition().y() / Acts::UnitConstants::mm);
193135
}
194136
}
195137

196-
#if Acts_VERSION_MAJOR >= 33
197138
std::vector<Acts::Vertex> vertices;
198139
auto result = finder.find(inputTracks, finderOpts, state);
199-
#else
200-
std::vector<Acts::Vertex<Acts::BoundTrackParameters>> vertices;
201-
auto result = finder.find(inputTrackPointers, finderOpts, state);
202-
#endif
203140
if (result.ok()) {
204141
vertices = std::move(result.value());
205142
}
@@ -222,11 +159,7 @@ std::unique_ptr<edm4eic::VertexCollection> eicrecon::IterativeVertexFinder::prod
222159
eicvertex.setPositionError(cov); // covariance
223160

224161
for (const auto& t : vtx.tracks()) {
225-
#if Acts_VERSION_MAJOR >= 33
226162
const auto& par = finderCfg.extractParameters(t.originalParams);
227-
#else
228-
const auto& par = *t.originalParams;
229-
#endif
230163
m_log->trace("Track local position from vertex = {} mm, {} mm", par.localPosition().x() / Acts::UnitConstants::mm, par.localPosition().y() / Acts::UnitConstants::mm);
231164
float loc_a = par.localPosition().x();
232165
float loc_b = par.localPosition().y();

src/algorithms/tracking/TrackSeeding.cc

+1-10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <cmath>
2626
#include <functional>
2727
#include <limits>
28+
#include <optional>
2829
#include <tuple>
2930
#include <type_traits>
3031

@@ -122,23 +123,13 @@ std::unique_ptr<edm4eic::TrackParametersCollection> eicrecon::TrackSeeding::prod
122123

123124
Acts::SeedFinderOrthogonal<eicrecon::SpacePoint> finder(m_seedFinderConfig); // FIXME move into class scope
124125

125-
#if Acts_VERSION_MAJOR >= 32
126126
std::function<std::tuple<Acts::Vector3, Acts::Vector2, std::optional<Acts::ActsScalar>>(
127127
const eicrecon::SpacePoint *sp)>
128128
create_coordinates = [](const eicrecon::SpacePoint *sp) {
129129
Acts::Vector3 position(sp->x(), sp->y(), sp->z());
130130
Acts::Vector2 variance(sp->varianceR(), sp->varianceZ());
131131
return std::make_tuple(position, variance, sp->t());
132132
};
133-
#else
134-
std::function<std::pair<Acts::Vector3, Acts::Vector2>(
135-
const eicrecon::SpacePoint *sp)>
136-
create_coordinates = [](const eicrecon::SpacePoint *sp) {
137-
Acts::Vector3 position(sp->x(), sp->y(), sp->z());
138-
Acts::Vector2 variance(sp->varianceR(), sp->varianceZ());
139-
return std::make_pair(position, variance);
140-
};
141-
#endif
142133

143134
eicrecon::SeedContainer seeds = finder.createSeeds(m_seedFinderOptions, spacePoints, create_coordinates);
144135

0 commit comments

Comments
 (0)