Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2021-2026 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 // Library include(s).
0009 #include "traccc/seeding/track_params_estimation.hpp"
0010 
0011 #include "traccc/seeding/track_params_estimation_helper.hpp"
0012 
0013 // System include(s).
0014 #include <cassert>
0015 
0016 namespace traccc::host {
0017 
0018 track_params_estimation::track_params_estimation(
0019     const track_params_estimation_config& config, vecmem::memory_resource& mr,
0020     std::unique_ptr<const Logger> logger)
0021     : messaging(std::move(logger)), m_config(config), m_mr(mr) {}
0022 
0023 track_params_estimation::output_type track_params_estimation::operator()(
0024     const edm::measurement_collection::const_view& measurements_view,
0025     const edm::spacepoint_collection::const_view& spacepoints_view,
0026     const edm::seed_collection::const_view& seeds_view,
0027     const vector3& bfield) const {
0028   // Set up the input / output objects.
0029   const edm::measurement_collection::const_device measurements(
0030       measurements_view);
0031   const edm::spacepoint_collection::const_device spacepoints(spacepoints_view);
0032   const edm::seed_collection::const_device seeds(seeds_view);
0033   const edm::seed_collection::const_device::size_type num_seeds = seeds.size();
0034   output_type result(num_seeds, &m_mr.get());
0035 
0036   // Create a track parameters for each seed.
0037   for (edm::seed_collection::const_device::size_type i = 0; i < num_seeds;
0038        ++i) {
0039     TRACCC_VERBOSE("Creating track parameters for seed " << i + 1 << " / "
0040                                                          << num_seeds);
0041     TRACCC_VERBOSE("  - bottom spacepoint: "
0042                    << spacepoints.at(seeds.at(i).bottom_index()).global()
0043                    << ", radius: "
0044                    << spacepoints.at(seeds.at(i).bottom_index()).radius());
0045     TRACCC_VERBOSE("  - middle spacepoint: "
0046                    << spacepoints.at(seeds.at(i).middle_index()).global()
0047                    << ", radius: "
0048                    << spacepoints.at(seeds.at(i).middle_index()).radius());
0049     TRACCC_VERBOSE("  - top spacepoint: "
0050                    << spacepoints.at(seeds.at(i).top_index()).global()
0051                    << ", radius: "
0052                    << spacepoints.at(seeds.at(i).top_index()).radius());
0053 
0054     // Calculate the track parameter vector.
0055     bound_track_parameters<>& track_params = result.at(i);
0056     seed_to_bound_param_vector(track_params, measurements, spacepoints,
0057                                seeds.at(i), bfield);
0058 
0059     // Set Covariance
0060     for (std::size_t j = 0u; j < e_bound_size; ++j) {
0061       scalar var = m_config.initial_sigma.at(j) * m_config.initial_sigma.at(j);
0062 
0063       if (j == e_bound_qoverp) {
0064         scalar var_theta = getter::element(track_params.covariance(),
0065                                            e_bound_theta, e_bound_theta);
0066 
0067         var += math::pow(
0068             m_config.initial_sigma_qopt * math::sin(track_params.theta()), 2.f);
0069         var +=
0070             math::pow(m_config.initial_sigma_pt_rel * track_params.qop(), 2.f);
0071         var += var_theta *
0072                math::pow(track_params.qop() / math::tan(track_params.theta()),
0073                          2.f);
0074       }
0075 
0076       var *= m_config.initial_inflation.at(j);
0077 
0078       getter::element(track_params.covariance(), j, j) = var;
0079     }
0080   }
0081 
0082   // Return the result.
0083   return result;
0084 }
0085 
0086 }  // namespace traccc::host