|
| 1 | +/** TRACCC library, part of the ACTS project (R&D line) |
| 2 | + * |
| 3 | + * (c) 2022-2025 CERN for the benefit of the ACTS project |
| 4 | + * |
| 5 | + * Mozilla Public License Version 2.0 |
| 6 | + */ |
| 7 | + |
| 8 | +#pragma once |
| 9 | + |
| 10 | +// Local include(s). |
| 11 | +#include "traccc/definitions/qualifiers.hpp" |
| 12 | +#include "traccc/edm/track_fit_outcome.hpp" |
| 13 | +#include "traccc/edm/track_parameters.hpp" |
| 14 | + |
| 15 | +// Detray include(s). |
| 16 | +#include <detray/definitions/algebra.hpp> |
| 17 | + |
| 18 | +// VecMem include(s). |
| 19 | +#include <vecmem/edm/container.hpp> |
| 20 | + |
| 21 | +namespace traccc::edm { |
| 22 | + |
| 23 | +/// Interface for the @c traccc::edm::track_fit_collection type. |
| 24 | +/// |
| 25 | +/// It provides the API that users would interact with, while using the |
| 26 | +/// columns/arrays of the SoA containers, or the variables of the AoS proxies |
| 27 | +/// created on top of the SoA containers. |
| 28 | +/// |
| 29 | +template <typename BASE> |
| 30 | +class track_fit : public BASE { |
| 31 | + |
| 32 | + public: |
| 33 | + /// @name Functions inherited from the base class |
| 34 | + /// @{ |
| 35 | + |
| 36 | + /// Inherit the base class's constructor(s) |
| 37 | + using BASE::BASE; |
| 38 | + /// Inherit the base class's assignment operator(s). |
| 39 | + using BASE::operator=; |
| 40 | + |
| 41 | + /// @} |
| 42 | + |
| 43 | + /// @name Track Candidate Information |
| 44 | + /// @{ |
| 45 | + |
| 46 | + /// The outcome of the track fit (non-const) |
| 47 | + /// |
| 48 | + /// @return A (non-const) vector of @c traccc::track_fit_outcome |
| 49 | + /// |
| 50 | + TRACCC_HOST_DEVICE |
| 51 | + auto& fit_outcome() { return BASE::template get<0>(); } |
| 52 | + /// The outcome of the track fit (non-const) |
| 53 | + /// |
| 54 | + /// @return A (const) vector of @c traccc::track_fit_outcome |
| 55 | + /// |
| 56 | + TRACCC_HOST_DEVICE |
| 57 | + const auto& fit_outcome() const { return BASE::template get<0>(); } |
| 58 | + |
| 59 | + /// The parameters of the track (non-const) |
| 60 | + /// |
| 61 | + /// @return A (non-const) vector of bound track parameters |
| 62 | + /// |
| 63 | + TRACCC_HOST_DEVICE |
| 64 | + auto& params() { return BASE::template get<1>(); } |
| 65 | + /// The parameters of the track (const) |
| 66 | + /// |
| 67 | + /// @return A (const) vector of bound track parameters |
| 68 | + /// |
| 69 | + TRACCC_HOST_DEVICE |
| 70 | + const auto& params() const { return BASE::template get<1>(); } |
| 71 | + |
| 72 | + /// The number of degrees of freedom of the track fit (non-const) |
| 73 | + /// |
| 74 | + /// @return A (non-const) vector of scalar values |
| 75 | + /// |
| 76 | + TRACCC_HOST_DEVICE |
| 77 | + auto& ndf() { return BASE::template get<2>(); } |
| 78 | + /// The number of degrees of freedom of the track fit (const) |
| 79 | + /// |
| 80 | + /// @return A (const) vector of scalar values |
| 81 | + /// |
| 82 | + TRACCC_HOST_DEVICE |
| 83 | + const auto& ndf() const { return BASE::template get<2>(); } |
| 84 | + |
| 85 | + /// The chi square of the track fit (non-const) |
| 86 | + /// |
| 87 | + /// @return A (non-const) vector of scalar values |
| 88 | + /// |
| 89 | + TRACCC_HOST_DEVICE |
| 90 | + auto& chi2() { return BASE::template get<3>(); } |
| 91 | + /// The chi square of the track fit (const) |
| 92 | + /// |
| 93 | + /// @return A (const) vector of scalar values |
| 94 | + /// |
| 95 | + TRACCC_HOST_DEVICE |
| 96 | + const auto& chi2() const { return BASE::template get<3>(); } |
| 97 | + |
| 98 | + /// The p-value of the track fit (non-const) |
| 99 | + /// |
| 100 | + /// @return A (non-const) vector of scalar values |
| 101 | + /// |
| 102 | + TRACCC_HOST_DEVICE |
| 103 | + auto& pval() { return BASE::template get<4>(); } |
| 104 | + /// The p-value of the track fit (const) |
| 105 | + /// |
| 106 | + /// @return A (const) vector of scalar values |
| 107 | + /// |
| 108 | + TRACCC_HOST_DEVICE |
| 109 | + const auto& pval() const { return BASE::template get<4>(); } |
| 110 | + |
| 111 | + /// The number of holes in the track pattern (non-const) |
| 112 | + /// |
| 113 | + /// @return A (non-const) vector of unsigned integers |
| 114 | + /// |
| 115 | + TRACCC_HOST_DEVICE |
| 116 | + auto& nholes() { return BASE::template get<5>(); } |
| 117 | + /// The number of holes in the track pattern (const) |
| 118 | + /// |
| 119 | + /// @return A (const) vector of unsigned integers |
| 120 | + /// |
| 121 | + TRACCC_HOST_DEVICE |
| 122 | + const auto& nholes() const { return BASE::template get<5>(); } |
| 123 | + |
| 124 | + /// The indices of the track states associated to the track fit (non-const) |
| 125 | + /// |
| 126 | + /// @return A (non-const) jagged vector of unsigned integers |
| 127 | + /// |
| 128 | + TRACCC_HOST_DEVICE |
| 129 | + auto& state_indices() { return BASE::template get<6>(); } |
| 130 | + /// The indices of the track states associated to the track fit (const) |
| 131 | + /// |
| 132 | + /// @return A (const) jagged vector of unsigned integers |
| 133 | + /// |
| 134 | + TRACCC_HOST_DEVICE |
| 135 | + const auto& state_indices() const { return BASE::template get<6>(); } |
| 136 | + |
| 137 | + /// @} |
| 138 | + |
| 139 | + /// @name Utility functions |
| 140 | + /// @{ |
| 141 | + |
| 142 | + /// Reset the fit quality variables |
| 143 | + TRACCC_HOST_DEVICE |
| 144 | + void reset_quality(); |
| 145 | + |
| 146 | + /// @} |
| 147 | + |
| 148 | +}; // class track_fit |
| 149 | + |
| 150 | +/// SoA container describing the fitted tracks |
| 151 | +/// |
| 152 | +/// @tparam ALGEBRA The algebra type used to describe the tracks |
| 153 | +/// |
| 154 | +template <detray::concepts::algebra ALGEBRA> |
| 155 | +using track_fit_collection = vecmem::edm::container< |
| 156 | + track_fit, |
| 157 | + // fit_outcome |
| 158 | + vecmem::edm::type::vector<track_fit_outcome>, |
| 159 | + // params |
| 160 | + vecmem::edm::type::vector<bound_track_parameters<ALGEBRA>>, |
| 161 | + // ndf |
| 162 | + vecmem::edm::type::vector<detray::dscalar<ALGEBRA>>, |
| 163 | + // chi2 |
| 164 | + vecmem::edm::type::vector<detray::dscalar<ALGEBRA>>, |
| 165 | + // pval |
| 166 | + vecmem::edm::type::vector<detray::dscalar<ALGEBRA>>, |
| 167 | + // nholes |
| 168 | + vecmem::edm::type::vector<unsigned int>, |
| 169 | + // state_indices |
| 170 | + vecmem::edm::type::jagged_vector<unsigned int>>; |
| 171 | + |
| 172 | +} // namespace traccc::edm |
| 173 | + |
| 174 | +// Include the implementation. |
| 175 | +#include "traccc/edm/impl/track_fit_collection.ipp" |
0 commit comments