|
|
|||
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-2026 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 <compare> 0019 #include <type_traits> 0020 0021 namespace traccc::edm { 0022 0023 /// Interface for the @c traccc::edm::silicon_cell_collection class. 0024 /// 0025 /// It provides the API that users would interact with, while using the 0026 /// columns/arrays of the SoA containers, or the variables of the AoS proxies 0027 /// created on top of the SoA containers. 0028 /// 0029 template <typename BASE> 0030 class silicon_cell : public BASE { 0031 public: 0032 /// @name Constructors 0033 /// @{ 0034 0035 /// Inherit the base class's constructor(s) 0036 using BASE::BASE; 0037 /// Use a default copy constructor 0038 silicon_cell(const silicon_cell& other) = default; 0039 /// Use a default move constructor 0040 silicon_cell(silicon_cell&& other) noexcept = default; 0041 0042 /// @} 0043 0044 /// @name Cell Information 0045 /// @{ 0046 0047 /// The first channel identifier / index of the cell / strip (non-const) 0048 /// 0049 /// @return A (non-const) vector of @c traccc::channel_id values 0050 /// 0051 TRACCC_HOST_DEVICE 0052 auto& channel0() { return BASE::template get<0>(); } 0053 /// The first channel identifier / index of the cell / strip (const) 0054 /// 0055 /// @return A (const) vector of @c traccc::channel_id values 0056 /// 0057 TRACCC_HOST_DEVICE 0058 const auto& channel0() const { return BASE::template get<0>(); } 0059 0060 /// The second channel identifier / index of the cell / strip (non-const) 0061 /// 0062 /// @return A (non-const) vector of @c traccc::channel_id values 0063 /// 0064 TRACCC_HOST_DEVICE 0065 auto& channel1() { return BASE::template get<1>(); } 0066 /// The second channel identifier / index of the cell / strip (const) 0067 /// 0068 /// @return A (const) vector of @c traccc::channel_id values 0069 /// 0070 TRACCC_HOST_DEVICE 0071 const auto& channel1() const { return BASE::template get<1>(); } 0072 0073 /// The "activation" of the cell / strip (non-const) 0074 /// 0075 /// @return A (non-const) vector of @c float values 0076 /// 0077 TRACCC_HOST_DEVICE 0078 auto& activation() { return BASE::template get<2>(); } 0079 /// The "activation" of the cell / strip (const) 0080 /// 0081 /// @return A (const) vector of @c float values 0082 /// 0083 TRACCC_HOST_DEVICE 0084 const auto& activation() const { return BASE::template get<2>(); } 0085 0086 /// The time associated with the cell / strip (non-const) 0087 /// 0088 /// @return A (non-const) vector of @c float values 0089 /// 0090 TRACCC_HOST_DEVICE 0091 auto& time() { return BASE::template get<3>(); } 0092 /// The time associated with the cell / strip (const) 0093 /// 0094 /// @return A (const) vector of @c float values 0095 /// 0096 TRACCC_HOST_DEVICE 0097 const auto& time() const { return BASE::template get<3>(); } 0098 0099 /// The index of the module that this cell belongs to (non-const) 0100 /// 0101 /// Used to look up the module in @c traccc::silicon_detector_description. 0102 /// 0103 /// @return A (non-const) vector of <tt>unsigned int</tt> values 0104 /// 0105 TRACCC_HOST_DEVICE 0106 auto& module_index() { return BASE::template get<4>(); } 0107 /// The index of the module that this cell belongs to (const) 0108 /// 0109 /// Used to look up the module in @c traccc::silicon_detector_description. 0110 /// 0111 /// @return A (const) vector of <tt>unsigned int</tt> values 0112 /// 0113 TRACCC_HOST_DEVICE 0114 const auto& module_index() const { return BASE::template get<4>(); } 0115 0116 /// @} 0117 0118 /// @name Utility functions 0119 /// @{ 0120 0121 /// Assignment operator 0122 /// 0123 /// @param[in] other The object to assign from 0124 /// @return A reference to this object 0125 /// 0126 TRACCC_HOST_DEVICE silicon_cell& operator=(const silicon_cell& other); 0127 0128 /// Assignment operator 0129 /// 0130 /// @param[in] other The object to assign from 0131 /// @return A reference to this object 0132 /// 0133 template <typename T, 0134 std::enable_if_t<!std::is_same_v<BASE, T>, bool> = false> 0135 TRACCC_HOST_DEVICE silicon_cell& operator=(const silicon_cell<T>& other); 0136 0137 /// Equality operator 0138 /// 0139 /// @note This function must only be used on proxy objects, not on 0140 /// containers! 0141 /// 0142 /// @param[in] other The object to compare with 0143 /// @return @c true if the objects are equal, @c false otherwise 0144 /// 0145 template <typename T> 0146 TRACCC_HOST_DEVICE bool operator==(const silicon_cell<T>& other) const; 0147 0148 /// Comparison operator 0149 /// 0150 /// @note This function must only be used on proxy objects, not on 0151 /// containers! 0152 /// 0153 /// @param[in] other The object to compare with 0154 /// @return A weak ordering object, describing the relation between the 0155 /// two objects 0156 /// 0157 template <typename T> 0158 TRACCC_HOST_DEVICE std::weak_ordering operator<=>( 0159 const silicon_cell<T>& other) const; 0160 0161 /// @} 0162 0163 }; // class silicon_cell_collection_interface 0164 0165 /// SoA container describing silicon detector hits 0166 using silicon_cell_collection = 0167 vecmem::edm::container<silicon_cell, 0168 // channel0 0169 vecmem::edm::type::vector<channel_id>, 0170 // channel1 0171 vecmem::edm::type::vector<channel_id>, 0172 // activation 0173 vecmem::edm::type::vector<float>, 0174 // time 0175 vecmem::edm::type::vector<float>, 0176 // module_index 0177 vecmem::edm::type::vector<unsigned int> >; 0178 0179 } // namespace traccc::edm 0180 0181 // Include the implementation. 0182 #include "traccc/edm/impl/silicon_cell_collection.ipp"
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|