File indexing completed on 2026-07-26 08:21:58
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010
0011 #include "traccc/definitions/qualifiers.hpp"
0012 #include "traccc/edm/track_parameters.hpp"
0013
0014
0015 #include <detray/definitions/algebra.hpp>
0016
0017
0018 #include <vecmem/edm/container.hpp>
0019
0020
0021 #include <concepts>
0022 #include <cstdint>
0023 #include <ostream>
0024
0025 namespace traccc::edm {
0026
0027
0028
0029
0030
0031
0032
0033 template <typename BASE>
0034 class track_state : public BASE {
0035 public:
0036
0037
0038
0039
0040 using BASE::BASE;
0041
0042 using BASE::operator=;
0043
0044
0045
0046
0047
0048
0049
0050 static constexpr std::uint8_t IS_HOLE_MASK = 0x01;
0051
0052 static constexpr std::uint8_t IS_SMOOTHED_MASK = 0x02;
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 TRACCC_HOST_DEVICE
0064 auto& state() { return BASE::template get<0>(); }
0065
0066
0067
0068
0069 TRACCC_HOST_DEVICE
0070 const auto& state() const { return BASE::template get<0>(); }
0071
0072
0073
0074
0075
0076 TRACCC_HOST_DEVICE
0077 auto& filtered_chi2() { return BASE::template get<1>(); }
0078
0079
0080
0081
0082 TRACCC_HOST_DEVICE
0083 const auto& filtered_chi2() const { return BASE::template get<1>(); }
0084
0085
0086
0087
0088
0089 TRACCC_HOST_DEVICE
0090 auto& smoothed_chi2() { return BASE::template get<2>(); }
0091
0092
0093
0094
0095 TRACCC_HOST_DEVICE
0096 const auto& smoothed_chi2() const { return BASE::template get<2>(); }
0097
0098
0099
0100
0101
0102 TRACCC_HOST_DEVICE
0103 auto& backward_chi2() { return BASE::template get<3>(); }
0104
0105
0106
0107
0108 TRACCC_HOST_DEVICE
0109 const auto& backward_chi2() const { return BASE::template get<3>(); }
0110
0111
0112
0113
0114
0115 TRACCC_HOST_DEVICE
0116 auto& filtered_params() { return BASE::template get<4>(); }
0117
0118
0119
0120
0121 TRACCC_HOST_DEVICE
0122 const auto& filtered_params() const { return BASE::template get<4>(); }
0123
0124
0125
0126
0127
0128 TRACCC_HOST_DEVICE
0129 auto& smoothed_params() { return BASE::template get<5>(); }
0130
0131
0132
0133
0134 TRACCC_HOST_DEVICE
0135 const auto& smoothed_params() const { return BASE::template get<5>(); }
0136
0137
0138
0139
0140
0141 TRACCC_HOST_DEVICE
0142 auto& measurement_index() { return BASE::template get<6>(); }
0143
0144
0145
0146
0147 TRACCC_HOST_DEVICE
0148 const auto& measurement_index() const { return BASE::template get<6>(); }
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162 TRACCC_HOST_DEVICE
0163 bool is_hole() const;
0164
0165
0166
0167
0168
0169
0170
0171 TRACCC_HOST_DEVICE
0172 void set_hole(bool value = true);
0173
0174
0175
0176
0177
0178
0179
0180
0181 TRACCC_HOST_DEVICE
0182 bool is_smoothed() const;
0183
0184
0185
0186
0187
0188
0189
0190 TRACCC_HOST_DEVICE
0191 void set_smoothed(bool value = true);
0192
0193
0194
0195 private:
0196
0197 TRACCC_HOST
0198 friend std::ostream& operator<<(std::ostream& os, const track_state& s) {
0199 os << "hole: " << std::boolalpha << s.is_hole() << std::endl;
0200 os << "smoothed: " << s.is_smoothed() << std::noboolalpha << std::endl;
0201 if (!s.is_hole()) {
0202 os << "measurement index: " << s.measurement_index() << std::endl;
0203 }
0204
0205 os << "filtered: chi2 (fw) = " << s.filtered_chi2()
0206 << ", chi2 (bw) = " << s.backward_chi2() << "\n"
0207 << s.filtered_params() << std::endl;
0208
0209 if (s.is_smoothed()) {
0210 os << "smoothed: chi2 = " << s.smoothed_chi2() << "\n"
0211 << s.smoothed_params() << std::endl;
0212 }
0213
0214 return os;
0215 }
0216
0217 };
0218
0219
0220
0221
0222
0223 template <detray::concepts::algebra ALGEBRA>
0224 using track_state_collection = vecmem::edm::container<
0225 track_state,
0226
0227 vecmem::edm::type::vector<std::uint8_t>,
0228
0229 vecmem::edm::type::vector<detray::dscalar<ALGEBRA>>,
0230
0231 vecmem::edm::type::vector<detray::dscalar<ALGEBRA>>,
0232
0233 vecmem::edm::type::vector<detray::dscalar<ALGEBRA>>,
0234
0235 vecmem::edm::type::vector<bound_track_parameters<ALGEBRA>>,
0236
0237 vecmem::edm::type::vector<bound_track_parameters<ALGEBRA>>,
0238
0239 vecmem::edm::type::vector<unsigned int>>;
0240
0241 }
0242
0243
0244 #include "traccc/edm/impl/track_state_collection.ipp"