38 template <
ACTS_CONCEPT(TrackContainerBackend) track_container_t,
40 template <typename> class holder_t = detail::RefHolder>
43 static constexpr
bool ReadOnly =
45 static constexpr
bool TrackStateReadOnly =
48 static_assert(ReadOnly == TrackStateReadOnly,
49 "Either both track container and track state container need to "
50 "be readonly or both have to be readwrite");
78 template <
template <
typename>
class H = holder_t,
79 typename = std::enable_if_t<
82 : m_container{&container}, m_traj{&traj} {}
91 template <
typename>
class H = holder_t,
94 typename = std::enable_if_t<
97 : m_container{&container}, m_traj{&traj} {}
103 return {*
this, itrack};
109 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
111 return {*
this, itrack};
117 return m_container->size_impl();
123 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
125 auto track =
getTrack(m_container->addTrack_impl());
127 return track.index();
133 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
135 m_container->removeTrack_impl(itrack);
140 template <
typename T,
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
142 m_container->template addColumn_impl<T>(key);
147 constexpr
bool hasColumn(
const std::string& key)
const {
148 return m_container->hasColumn_impl(
hashString(key));
154 return m_container->hasColumn_impl(key);
159 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
172 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
173 auto& trackStateContainer() {
179 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
180 auto& trackStateContainerHolder() {
186 const auto& trackStateContainer()
const {
192 const auto& trackStateContainerHolder()
const {
198 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
200 return detail_tc::TrackProxyIterator<std::decay_t<decltype(*this)>,
201 TrackProxy,
false>{*
this, 0};
206 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
208 return detail_tc::TrackProxyIterator<std::decay_t<decltype(*this)>,
209 TrackProxy,
false>{*
this,
size()};
215 return detail_tc::TrackProxyIterator<std::decay_t<decltype(*this)>,
216 ConstTrackProxy,
true>{*
this, 0};
222 return detail_tc::TrackProxyIterator<std::decay_t<decltype(*this)>,
223 ConstTrackProxy,
true>{*
this,
size()};
232 template <
typename other_track_container_t,
bool RO = ReadOnly,
233 typename = std::enable_if_t<!RO>>
234 void ensureDynamicColumns(
const other_track_container_t& other) {
235 container().ensureDynamicColumns_impl(other.container());
239 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
241 m_container->clear();
247 typename = std::enable_if_t<!RO>>
249 return *std::any_cast<
T*>(
container().component_impl(key, itrack));
252 template <
typename T,
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
254 return *std::any_cast<
T*>(
container().component_impl(key, itrack));
257 template <
typename T, HashedString key>
258 constexpr
const T& component(
IndexType itrack)
const {
259 return *std::any_cast<
const T*>(
container().component_impl(key, itrack));
262 template <
typename T>
264 return *std::any_cast<
const T*>(
container().component_impl(key, itrack));
267 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
272 constexpr
typename ConstTrackProxy::ConstParameters
parameters(
277 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
282 constexpr
typename ConstTrackProxy::ConstCovariance
covariance(
287 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
288 auto reverseTrackStateRange(
IndexType itrack) {
290 return m_traj->reverseTrackStateRange(tip);
293 auto reverseTrackStateRange(IndexType itrack)
const {
295 return m_traj->reverseTrackStateRange(tip);
298 template <
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
299 auto forwardTrackStateRange(IndexType itrack) {
301 if (stem == kInvalid) {
302 throw std::invalid_argument{
"Track has no stem index"};
304 return m_traj->forwardTrackStateRange(stem);
307 auto forwardTrackStateRange(IndexType itrack)
const {
309 if (stem == kInvalid) {
310 throw std::invalid_argument{
"Track has no stem index"};
312 return m_traj->forwardTrackStateRange(stem);
316 template <
typename T,
bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
317 void copyDynamicFrom(IndexType dstIdx,
const T& src, IndexType srcIdx) {
318 container().copyDynamicFrom_impl(dstIdx, src, srcIdx);
321 detail_tc::ConstIf<holder_t<track_container_t>, ReadOnly> m_container;
325 template <
ACTS_CONCEPT(TrackContainerBackend) track_container_t,
327 TrackContainer(track_container_t& container, traj_t& traj)
328 -> TrackContainer<track_container_t, traj_t, detail::
RefHolder>;
330 template <
ACTS_CONCEPT(TrackContainerBackend) track_container_t,
332 TrackContainer(const track_container_t& container, const traj_t& traj)
333 -> TrackContainer<track_container_t, traj_t, detail::
ConstRefHolder>;
335 template <
ACTS_CONCEPT(TrackContainerBackend) track_container_t,
337 TrackContainer(track_container_t&& container, traj_t&& traj)
338 -> TrackContainer<track_container_t, traj_t, detail::
ValueHolder>;
343 template <typename
T,
bool ReadOnly>
358 template <
typename track_proxy_t,
bool RO = ReadOnly,
359 typename = std::enable_if_t<!RO>>
360 T& operator()(track_proxy_t track)
const {
361 static_assert(!track_proxy_t::ReadOnly,
362 "Cannot get mutable ref for const track proxy");
363 return track.template component<T>(key);
370 template <
typename track_proxy_t,
bool RO = ReadOnly,
371 typename = std::enable_if_t<RO>>
372 const T& operator()(track_proxy_t track)
const {
373 if constexpr (track_proxy_t::ReadOnly) {
374 return track.template component<T>(key);
376 typename track_proxy_t::ConstTrackProxy ctrack{track};
377 return ctrack.template component<T>(key);
382 template <
typename T>
384 template <
typename T>