Skip to content

Commit

Permalink
feat: Add compatibility method to seedfinder (#1198)
Browse files Browse the repository at this point in the history
In the past, the seedfinder could be called with three spacepoint ranges, one for the lower, one for the middle, and one for the top spacepoints. In recent times, the seedfinder has been optimized impressively, but this has meant making the function call for the seeder quite a bit more complex; it now requires an output iterator, a state, and an extent for radii. For compatibility and ease-of-use reasons, I think it would be nice to have an "old-style" interface. This commit adds that.
  • Loading branch information
stephenswat committed Mar 24, 2022
1 parent 0458a4b commit 7c5a232
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Core/include/Acts/Seeding/Seedfinder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,27 @@ class Seedfinder {
sp_range_t bottomSPs, sp_range_t middleSPs, sp_range_t topSPs,
Extent rRangeSPExtent) const;

/// @brief Compatibility method for the new-style seed finding API.
///
/// This method models the old-style seeding API where we only need a
/// container for the bottom, middle, and top space points. Also, the results
/// are returned by value instead of inserted into an inserter.
///
/// @note This method is a very simply wrapper around the more modern API.
/// @warning The performance of the seeding code is far greater if the new
/// API is used, and this is recommended for all new uses which do not
/// require backwards-compatibility.
///
/// @tparam sp_range_t container type for the seed point collections.
/// @param bottomSPs group of space points to be used as innermost SP in a
/// seed.
/// @param middleSPs group of space points to be used as middle SP in a seed.
/// @param topSPs group of space points to be used as outermost SP in a seed.
/// @returns a vector of seeds.
template <typename sp_range_t>
std::vector<Seed<external_spacepoint_t>> createSeedsForGroup(
sp_range_t bottomSPs, sp_range_t middleSPs, sp_range_t topSPs) const;

private:
Acts::SeedfinderConfig<external_spacepoint_t> m_config;
};
Expand Down
13 changes: 13 additions & 0 deletions Core/include/Acts/Seeding/Seedfinder.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -393,4 +393,17 @@ void Seedfinder<external_spacepoint_t, platform_t>::createSeedsForGroup(
m_config.seedFilter->filterSeeds_1SpFixed(state.seedsPerSpM, outIt);
}
}

template <typename external_spacepoint_t, typename platform_t>
template <typename sp_range_t>
std::vector<Seed<external_spacepoint_t>>
Seedfinder<external_spacepoint_t, platform_t>::createSeedsForGroup(
sp_range_t bottomSPs, sp_range_t middleSPs, sp_range_t topSPs) const {
State state;
Extent extent;
std::vector<Seed<external_spacepoint_t>> ret;

createSeedsForGroup(state, std::back_inserter(ret), bottomSPs, middleSPs,
topSPs, extent);
}
} // namespace Acts

0 comments on commit 7c5a232

Please sign in to comment.