File indexing completed on 2026-07-26 08:22:03
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010
0011 #include "traccc/seeding/detail/doublet.hpp"
0012 #include "traccc/seeding/detail/spacepoint_grid.hpp"
0013 #include "traccc/seeding/detail/spacepoint_type.hpp"
0014 #include "traccc/seeding/doublet_finding_helper.hpp"
0015 #include "traccc/utils/messaging.hpp"
0016
0017
0018 #include <vecmem/memory/memory_resource.hpp>
0019
0020
0021 #include <functional>
0022 #include <utility>
0023
0024 namespace traccc::host::details {
0025
0026
0027
0028 template <traccc::details::spacepoint_type otherSpType>
0029 struct doublet_finding : public messaging {
0030
0031 static_assert(otherSpType == traccc::details::spacepoint_type::bottom ||
0032 otherSpType == traccc::details::spacepoint_type::top);
0033
0034
0035
0036
0037
0038 doublet_finding(
0039 const seedfinder_config& config, vecmem::memory_resource& mr,
0040 std::unique_ptr<const Logger> logger = getDummyLogger().clone())
0041 : messaging(std::move(logger)), m_config{config}, m_mr{mr} {}
0042
0043
0044
0045
0046
0047
0048
0049
0050 std::pair<doublet_collection_types::host, lin_circle_collection_types::host>
0051 operator()(const edm::spacepoint_collection::const_device& spacepoints,
0052 const traccc::details::spacepoint_grid_types::host& sp_grid,
0053 const sp_location& middle_location) const {
0054
0055 auto result =
0056 std::make_pair(doublet_collection_types::host{&(m_mr.get())},
0057 lin_circle_collection_types::host{&(m_mr.get())});
0058
0059
0060 const edm::spacepoint_collection::const_device::const_proxy_type middle_sp =
0061 spacepoints.at(
0062 sp_grid.bin(middle_location.bin_idx)[middle_location.sp_idx]);
0063
0064
0065
0066 const detray::dindex_sequence phi_bins =
0067 sp_grid.axis_p0().zone(middle_sp.phi(), m_config.neighbor_scope);
0068 const detray::dindex_sequence z_bins =
0069 sp_grid.axis_p1().zone(middle_sp.z(), m_config.neighbor_scope);
0070
0071
0072 for (detray::dindex phi_bin : phi_bins) {
0073 for (detray::dindex z_bin : z_bins) {
0074
0075 const detray::dindex bin_idx =
0076 phi_bin + z_bin * sp_grid.axis_p0().bins();
0077
0078
0079 traccc::details::spacepoint_grid_types::host::serialized_storage::
0080 const_reference sp_indices = sp_grid.bin(phi_bin, z_bin);
0081 for (unsigned int i = 0; unsigned int sp_index : sp_indices) {
0082
0083 const edm::spacepoint_collection::const_device::const_proxy_type
0084 other_sp = spacepoints.at(sp_index);
0085
0086
0087 if (doublet_finding_helper::isCompatible<otherSpType>(
0088 middle_sp, other_sp, m_config)) {
0089
0090 result.first.push_back(
0091 {middle_location, {static_cast<unsigned int>(bin_idx), i}});
0092 result.second.push_back(
0093 doublet_finding_helper::transform_coordinates<otherSpType>(
0094 middle_sp, other_sp));
0095 }
0096 ++i;
0097 }
0098 }
0099 }
0100
0101
0102 return result;
0103 }
0104
0105 private:
0106
0107 seedfinder_config m_config;
0108
0109 std::reference_wrapper<vecmem::memory_resource> m_mr;
0110 };
0111
0112 }