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) 2022-2025 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 // System include(s)
0011 #include <ostream>
0012 
0013 namespace traccc::edm {
0014 
0015 /// A link to a constituent of a track
0016 ///
0017 /// It is a poor man's version of @c Acts::SourceLink. Only providing the
0018 /// functionality needed in the GPU algorithms.
0019 ///
0020 struct track_constituent_link {
0021   /// The type of the constituent
0022   enum constituent_type : unsigned short {
0023     measurement = 0,  ///< The link points at a measurement
0024     track_state = 1   ///< The link points at a track state
0025   };
0026 
0027   unsigned short type;  ///< The type of the constituent
0028   unsigned int index;   ///< The index of the constituent in its collection
0029 
0030   /// Equality operator
0031   ///
0032   /// For some reason Clang fails to generate it automatically for this type.
0033   ///
0034   bool operator==(const track_constituent_link&) const = default;
0035 
0036  private:
0037   /// @returns a string stream that prints the constituent link
0038   TRACCC_HOST
0039   friend std::ostream& operator<<(std::ostream& os,
0040                                   const track_constituent_link& l) {
0041     if (l.type == constituent_type::measurement) {
0042       os << "measurement index: " << l.index;
0043     } else if (l.type == constituent_type::track_state) {
0044       os << "track state index: " << l.index;
0045     } else {
0046       os << "ERROR: Unknown link type!";
0047     }
0048 
0049     return os;
0050   }
0051 
0052 };  // struct track_constituent_link
0053 
0054 }  // namespace traccc::edm