Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:21:58

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/definitions/primitives.hpp"
0012 #include "traccc/definitions/qualifiers.hpp"
0013 
0014 // VecMem include(s).
0015 #include <vecmem/edm/container.hpp>
0016 
0017 // System include(s)
0018 #include <ostream>
0019 
0020 namespace traccc::edm {
0021 
0022 /// Interface for the @c traccc::edm::seed_collection class.
0023 ///
0024 /// It provides the API that users would interact with, while using the
0025 /// columns/arrays of the SoA containers, or the variables of the AoS proxies
0026 /// created on top of the SoA containers.
0027 ///
0028 template <typename BASE>
0029 class seed : public BASE {
0030  public:
0031   /// @name Functions inherited from the base class
0032   /// @{
0033 
0034   /// Inherit the base class's constructor(s)
0035   using BASE::BASE;
0036   /// Inherit the base class's assignment operator(s).
0037   using BASE::operator=;
0038 
0039   /// @}
0040 
0041   /// @name Seed Information
0042   /// @{
0043 
0044   /// Index of the bottom spacepoint (non-const)
0045   ///
0046   /// @return A (non-const) vector of <tt>unsigned int</tt> values
0047   ///
0048   TRACCC_HOST_DEVICE
0049   auto& bottom_index() { return BASE::template get<0>(); }
0050   /// Index of the bottom spacepoint (const)
0051   ///
0052   /// @return A (const) vector of <tt>unsigned int</tt> values
0053   ///
0054   TRACCC_HOST_DEVICE
0055   const auto& bottom_index() const { return BASE::template get<0>(); }
0056 
0057   /// Index of the middle spacepoint (non-const)
0058   ///
0059   /// @return A (non-const) vector of <tt>unsigned int</tt> values
0060   ///
0061   TRACCC_HOST_DEVICE
0062   auto& middle_index() { return BASE::template get<1>(); }
0063   /// Index of the middle spacepoint (const)
0064   ///
0065   /// @return A (const) vector of <tt>unsigned int</tt> values
0066   ///
0067   TRACCC_HOST_DEVICE
0068   const auto& middle_index() const { return BASE::template get<1>(); }
0069 
0070   /// Index of the top spacepoint (non-const)
0071   ///
0072   /// @return A (non-const) vector of <tt>unsigned int</tt> values
0073   ///
0074   TRACCC_HOST_DEVICE
0075   auto& top_index() { return BASE::template get<2>(); }
0076   /// Index of the top spacepoint (const)
0077   ///
0078   /// @return A (const) vector of <tt>unsigned int</tt> values
0079   ///
0080   TRACCC_HOST_DEVICE
0081   const auto& top_index() const { return BASE::template get<2>(); }
0082   /// Quality of the seed (const)
0083   ///
0084   /// @return A (const) vector of <tt>float</tt> values
0085   ///
0086   TRACCC_HOST_DEVICE
0087   const auto& quality() const { return BASE::template get<3>(); }
0088   /// Quality of the seed (non-const)
0089   ///
0090   /// @return A (non-const) vector of <tt>float</tt> values
0091   ///
0092   TRACCC_HOST_DEVICE
0093   auto& quality() { return BASE::template get<3>(); }
0094 
0095   /// @}
0096 
0097   /// @name Utility functions
0098   /// @{
0099 
0100   /// Equality operator
0101   ///
0102   /// @note This function must only be used on proxy objects, not on
0103   ///       containers!
0104   ///
0105   /// @param[in] other The object to compare with
0106   /// @return @c true if the objects are equal, @c false otherwise
0107   ///
0108   template <typename T>
0109   TRACCC_HOST_DEVICE bool operator==(const seed<T>& other) const;
0110 
0111   /// Comparison operator
0112   ///
0113   /// @note This function must only be used on proxy objects, not on
0114   ///       containers!
0115   ///
0116   /// @param[in] other The object to compare with
0117   /// @return A strong ordering object, describing the relation between the
0118   ///         two objects
0119   ///
0120   template <typename T>
0121   TRACCC_HOST_DEVICE std::strong_ordering operator<=>(
0122       const seed<T>& other) const;
0123 
0124   /// @}
0125 
0126  private:
0127   /// @returns a string stream that prints the seed details
0128   TRACCC_HOST
0129   friend std::ostream& operator<<(std::ostream& os, const seed& s) {
0130     os << "quality: " << s.quality() << std::endl;
0131     os << "measurements: [bottom = " << s.bottom_index()
0132        << ", middle = " << s.middle_index() << ", top = " << s.top_index()
0133        << "]" << std::endl;
0134 
0135     return os;
0136   }
0137 
0138 };  // class seed
0139 
0140 /// SoA container describing reconstructed track seeds
0141 using seed_collection =
0142     vecmem::edm::container<seed, vecmem::edm::type::vector<unsigned int>,
0143                            vecmem::edm::type::vector<unsigned int>,
0144                            vecmem::edm::type::vector<unsigned int>,
0145                            vecmem::edm::type::vector<float> >;
0146 
0147 }  // namespace traccc::edm
0148 
0149 // Include the implementation.
0150 #include "traccc/edm/impl/seed_collection.ipp"