Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2021-2025 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 // Local include(s).
0011 #include "traccc/edm/seed_collection.hpp"
0012 #include "traccc/edm/spacepoint_collection.hpp"
0013 #include "traccc/seeding/detail/seeding_config.hpp"
0014 
0015 namespace traccc {
0016 
0017 // helper function used for both cpu and gpu
0018 struct seed_selecting_helper {
0019   /// Update the weights of triplets
0020   ///
0021   /// @param[in] filter_config is seed filtering configuration parameters
0022   /// @param[in] spM is middle (internal) spacepoint
0023   /// @param[in] spB is bottom (internal) spacepoint
0024   /// @param[in] spT is top (internal) spacepoint
0025   /// @param[out] triplet_weight is the weight of triplet to be updated
0026   ///
0027   template <typename T1, typename T2, typename T3>
0028   static TRACCC_HOST_DEVICE void seed_weight(
0029       const seedfilter_config& filter_config, const edm::spacepoint<T1>&,
0030       const edm::spacepoint<T2>& spB, const edm::spacepoint<T3>& spT,
0031       scalar& triplet_weight) {
0032     scalar weight = 0;
0033 
0034     if (spB.radius() > filter_config.good_spB_min_radius) {
0035       weight = filter_config.good_spB_weight_increase;
0036     }
0037     if (spT.radius() < filter_config.good_spT_max_radius) {
0038       weight = filter_config.good_spT_weight_increase;
0039     }
0040 
0041     triplet_weight += weight;
0042     return;
0043   }
0044 
0045   /// Cut triplets with criteria
0046   ///
0047   /// @param filter_config is seed filtering configuration parameters
0048   /// @param spM is middle (internal) spacepoint
0049   /// @param spB is bottom (internal) spacepoint
0050   /// @param spT is top (internal) spacepoint
0051   /// @param triplet_weight is the weight of triplet
0052   ///
0053   /// @return boolean value
0054   template <typename T1, typename T2, typename T3>
0055   static TRACCC_HOST_DEVICE bool single_seed_cut(
0056       const seedfilter_config& filter_config, const edm::spacepoint<T1>&,
0057       const edm::spacepoint<T2>& spB, const edm::spacepoint<T3>&,
0058       scalar triplet_weight) {
0059     return !(spB.radius() > filter_config.good_spB_min_radius &&
0060              triplet_weight < filter_config.good_spB_min_weight);
0061   }
0062 
0063   /// Cut triplets with criteria
0064   ///
0065   /// @param filter_config    seed filtering configuration parameters
0066   /// @param spacepoints      spacepoint collection
0067   /// @param sp_grid          Spacepoint grid
0068   /// @param seed             current seed to possibly cut
0069   ///
0070   /// @return boolean value
0071   template <typename spacepoint_type>
0072   static TRACCC_HOST_DEVICE bool cut_per_middle_sp(
0073       const seedfilter_config& filter_config, const spacepoint_type& spB,
0074       const scalar weight) {
0075     return (weight > filter_config.seed_min_weight ||
0076             spB.radius() > filter_config.spB_min_radius);
0077   }
0078 };
0079 
0080 }  // namespace traccc