Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:04

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2023-2026 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 //
0008 // Local include(s).
0009 #include "traccc/alpaka/seeding/seed_parameter_estimation_algorithm.hpp"
0010 
0011 #include "../utils/get_queue.hpp"
0012 #include "../utils/magnetic_field_types.hpp"
0013 #include "../utils/utils.hpp"
0014 
0015 // Project include(s).
0016 #include "traccc/seeding/device/estimate_track_params.hpp"
0017 
0018 namespace traccc::alpaka {
0019 namespace kernels {
0020 
0021 /// Alpaka kernel for running @c traccc::device::estimate_track_params
0022 template <typename bfield_t>
0023 struct estimate_track_params {
0024   template <typename TAcc>
0025   ALPAKA_FN_ACC void operator()(
0026       TAcc const& acc, const track_params_estimation_config config,
0027       typename edm::measurement_collection::const_view measurements,
0028       edm::spacepoint_collection::const_view spacepoints,
0029       edm::seed_collection::const_view seeds, const bfield_t bfield,
0030       bound_track_parameters_collection_types::view params) const {
0031     auto const globalThreadIdx =
0032         ::alpaka::getIdx<::alpaka::Grid, ::alpaka::Threads>(acc)[0u];
0033 
0034     device::estimate_track_params(globalThreadIdx, config, measurements,
0035                                   spacepoints, seeds, bfield, params);
0036   }
0037 };  // struct estimate_track_params
0038 
0039 }  // namespace kernels
0040 
0041 seed_parameter_estimation_algorithm::seed_parameter_estimation_algorithm(
0042     const track_params_estimation_config& config,
0043     const traccc::memory_resource& mr, const vecmem::copy& copy,
0044     alpaka::queue& q, std::unique_ptr<const Logger> logger)
0045     : device::seed_parameter_estimation_algorithm(config, mr, copy,
0046                                                   std::move(logger)),
0047       alpaka::algorithm_base(q) {}
0048 
0049 void seed_parameter_estimation_algorithm::estimate_seed_params_kernel(
0050     const struct estimate_seed_params_kernel_payload& payload) const {
0051   const unsigned int n_threads = warp_size() * 4;
0052   const unsigned int n_blocks = (payload.n_seeds + n_threads - 1) / n_threads;
0053   magnetic_field_visitor<bfield_type_list<scalar>>(
0054       payload.bfield, [&]<typename bfield_view_t>(const bfield_view_t& bfield) {
0055         ::alpaka::exec<Acc>(
0056             details::get_queue(queue()), makeWorkDiv<Acc>(n_blocks, n_threads),
0057             kernels::estimate_track_params<bfield_view_t>{}, payload.config,
0058             payload.measurements, payload.spacepoints, payload.seeds, bfield,
0059             payload.params);
0060       });
0061 }
0062 
0063 }  // namespace traccc::alpaka