File indexing completed on 2026-07-26 08:22:02
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "traccc/clusterization/sparse_ccl_algorithm.hpp"
0010
0011 #include "traccc/clusterization/details/sparse_ccl.hpp"
0012 #include "traccc/sanity/contiguous_on.hpp"
0013 #include "traccc/sanity/ordered_on.hpp"
0014 #include "traccc/utils/projections.hpp"
0015 #include "traccc/utils/relations.hpp"
0016
0017
0018 #include <vecmem/containers/device_vector.hpp>
0019 #include <vecmem/containers/vector.hpp>
0020
0021 namespace traccc::host {
0022
0023 sparse_ccl_algorithm::sparse_ccl_algorithm(vecmem::memory_resource& mr,
0024 std::unique_ptr<const Logger> logger)
0025 : messaging(std::move(logger)), m_mr(mr) {}
0026
0027 sparse_ccl_algorithm::output_type sparse_ccl_algorithm::operator()(
0028 const edm::silicon_cell_collection::const_view& cells_view,
0029 const detector_conditions_description::const_view& det_cond_view) const {
0030
0031 const edm::silicon_cell_collection::const_device cells{cells_view};
0032 const detector_conditions_description::const_device det_cond{det_cond_view};
0033
0034
0035 assert(is_contiguous_on(cell_module_projection(), cells));
0036 assert(is_ordered_on(channel0_major_cell_order_relation(), cells));
0037
0038
0039 vecmem::vector<unsigned int> cluster_indices{cells.size(), &(m_mr.get())};
0040 vecmem::device_vector<unsigned int> cluster_indices_device{
0041 vecmem::get_data(cluster_indices)};
0042 const unsigned int num_clusters =
0043 details::sparse_ccl(cells, cluster_indices_device);
0044
0045
0046 output_type clusters{m_mr.get()};
0047 clusters.resize(num_clusters);
0048
0049
0050 for (unsigned int cell_idx = 0; cell_idx < cluster_indices.size();
0051 ++cell_idx) {
0052 clusters.cell_indices()[cluster_indices[cell_idx]].push_back(cell_idx);
0053 }
0054
0055
0056 return clusters;
0057 }
0058
0059 }