File indexing completed on 2025-07-14 08:10:31
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/TrackParametrization.hpp"
0012 #include "Acts/EventData/SourceLink.hpp"
0013 #include "Acts/EventData/SubspaceHelpers.hpp"
0014 #include "Acts/EventData/TrackStatePropMask.hpp"
0015 #include "Acts/EventData/TrackStateProxyConcept.hpp"
0016 #include "Acts/EventData/TrackStateType.hpp"
0017 #include "Acts/EventData/Types.hpp"
0018 #include "Acts/Surfaces/Surface.hpp"
0019 #include "Acts/Utilities/EigenConcepts.hpp"
0020 #include "Acts/Utilities/HashedString.hpp"
0021 #include "Acts/Utilities/Helpers.hpp"
0022
0023 #include <cstddef>
0024 #include <ranges>
0025 #include <span>
0026
0027 #include <Eigen/Core>
0028
0029 namespace Acts {
0030
0031 template <typename derived_t>
0032 class MultiTrajectory;
0033
0034 namespace detail_lt {
0035
0036
0037 template <typename T, bool select>
0038 using ConstIf = std::conditional_t<select, const T, T>;
0039
0040
0041 template <typename T>
0042 class TransitiveConstPointer {
0043 public:
0044 TransitiveConstPointer() = default;
0045 explicit TransitiveConstPointer(T* ptr) : m_ptr{ptr} {}
0046
0047 template <typename U>
0048 explicit TransitiveConstPointer(const TransitiveConstPointer<U>& other)
0049 : m_ptr{other.ptr()} {}
0050
0051 template <typename U>
0052 TransitiveConstPointer& operator=(const TransitiveConstPointer<U>& other) {
0053 m_ptr = other.m_ptr;
0054 return *this;
0055 }
0056
0057 template <typename U>
0058 bool operator==(const TransitiveConstPointer<U>& other) const {
0059 return m_ptr == other.m_ptr;
0060 }
0061
0062 const T* operator->() const { return m_ptr; }
0063
0064 T* operator->() { return m_ptr; }
0065
0066 template <typename U>
0067 friend class TransitiveConstPointer;
0068
0069 const T& operator*() const { return *m_ptr; }
0070
0071 T& operator*() { return *m_ptr; }
0072
0073 private:
0074 T* ptr() const { return m_ptr; }
0075
0076 T* m_ptr;
0077 };
0078
0079
0080
0081 template <std::size_t Size, bool ReadOnlyMaps = true>
0082 struct FixedSizeTypes {
0083 constexpr static auto Flags = Eigen::ColMajor | Eigen::AutoAlign;
0084
0085
0086 using Coefficients = Eigen::Matrix<double, Size, 1, Flags>;
0087 using Covariance = Eigen::Matrix<double, Size, Size, Flags>;
0088 using CoefficientsMap = Eigen::Map<ConstIf<Coefficients, ReadOnlyMaps>>;
0089 using CovarianceMap = Eigen::Map<ConstIf<Covariance, ReadOnlyMaps>>;
0090
0091 using DynamicCoefficients = Eigen::Matrix<double, Eigen::Dynamic, 1, Flags>;
0092 using DynamicCovariance =
0093 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Flags>;
0094 using DynamicCoefficientsMap =
0095 Eigen::Map<ConstIf<DynamicCoefficients, ReadOnlyMaps>>;
0096 using DynamicCovarianceMap =
0097 Eigen::Map<ConstIf<DynamicCovariance, ReadOnlyMaps>>;
0098 };
0099
0100
0101
0102 template <bool ReadOnlyMaps = true>
0103 struct DynamicSizeTypes {
0104 constexpr static auto Flags = Eigen::ColMajor | Eigen::AutoAlign;
0105
0106 using Coefficients = Eigen::Matrix<double, Eigen::Dynamic, 1, Flags>;
0107 using Covariance =
0108 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Flags>;
0109 using CoefficientsMap = Eigen::Map<ConstIf<Coefficients, ReadOnlyMaps>>;
0110 using CovarianceMap = Eigen::Map<ConstIf<Covariance, ReadOnlyMaps>>;
0111 };
0112
0113 }
0114
0115
0116 template <std::size_t M, bool ReadOnly = true>
0117 struct TrackStateTraits {
0118 using Parameters =
0119 typename detail_lt::FixedSizeTypes<eBoundSize, ReadOnly>::CoefficientsMap;
0120 using Covariance =
0121 typename detail_lt::FixedSizeTypes<eBoundSize, ReadOnly>::CovarianceMap;
0122 using Calibrated =
0123 typename detail_lt::FixedSizeTypes<M, ReadOnly>::CoefficientsMap;
0124 using CalibratedCovariance =
0125 typename detail_lt::FixedSizeTypes<M, ReadOnly>::CovarianceMap;
0126 using EffectiveCalibrated =
0127 typename detail_lt::DynamicSizeTypes<ReadOnly>::CoefficientsMap;
0128 using EffectiveCalibratedCovariance =
0129 typename detail_lt::DynamicSizeTypes<ReadOnly>::CovarianceMap;
0130 };
0131
0132
0133
0134
0135
0136
0137 template <typename trajectory_t, std::size_t M, bool read_only = true>
0138 class TrackStateProxy {
0139 public:
0140
0141
0142 static constexpr bool ReadOnly = read_only;
0143
0144
0145 using ConstProxyType = TrackStateProxy<trajectory_t, M, true>;
0146
0147
0148
0149 using Parameters = typename TrackStateTraits<M, ReadOnly>::Parameters;
0150
0151
0152 using ConstParameters = typename TrackStateTraits<M, true>::Parameters;
0153
0154
0155
0156 using Covariance = typename TrackStateTraits<M, ReadOnly>::Covariance;
0157
0158
0159 using ConstCovariance = typename TrackStateTraits<M, true>::Covariance;
0160
0161
0162
0163 template <std::size_t N>
0164 using Calibrated = typename TrackStateTraits<N, ReadOnly>::Calibrated;
0165
0166
0167 template <std::size_t N>
0168 using ConstCalibrated = typename TrackStateTraits<N, true>::Calibrated;
0169
0170
0171
0172 template <std::size_t N>
0173 using CalibratedCovariance =
0174 typename TrackStateTraits<N, ReadOnly>::CalibratedCovariance;
0175
0176
0177 template <std::size_t N>
0178 using ConstCalibratedCovariance =
0179 typename TrackStateTraits<N, true>::CalibratedCovariance;
0180
0181
0182
0183 using EffectiveCalibrated =
0184 typename TrackStateTraits<M, ReadOnly>::EffectiveCalibrated;
0185
0186
0187 using ConstEffectiveCalibrated =
0188 typename TrackStateTraits<M, true>::EffectiveCalibrated;
0189
0190
0191
0192 using EffectiveCalibratedCovariance =
0193 typename TrackStateTraits<M, ReadOnly>::EffectiveCalibratedCovariance;
0194
0195
0196 using ConstEffectiveCalibratedCovariance =
0197 typename TrackStateTraits<M, true>::EffectiveCalibratedCovariance;
0198
0199
0200 using IndexType = TrackIndexType;
0201
0202
0203 static constexpr IndexType kInvalid = kTrackIndexInvalid;
0204
0205
0206 using Trajectory = trajectory_t;
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219 TrackStateProxy(const TrackStateProxy& other) = default;
0220
0221
0222
0223
0224 TrackStateProxy& operator=(const TrackStateProxy& other) = default;
0225
0226
0227
0228
0229 explicit TrackStateProxy(const TrackStateProxy<Trajectory, M, false>& other)
0230 requires ReadOnly
0231 : m_traj{other.m_traj}, m_istate{other.m_istate} {}
0232
0233
0234
0235
0236
0237 TrackStateProxy& operator=(const TrackStateProxy<Trajectory, M, false>& other)
0238 requires ReadOnly
0239 {
0240 m_traj = other.m_traj;
0241 m_istate = other.m_istate;
0242
0243 return *this;
0244 }
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295 IndexType index() const { return m_istate; }
0296
0297
0298
0299 IndexType previous() const {
0300 return component<IndexType, hashString("previous")>();
0301 }
0302
0303
0304
0305
0306
0307 IndexType& previous()
0308 requires(!ReadOnly)
0309 {
0310 return component<IndexType, hashString("previous")>();
0311 }
0312
0313
0314
0315 bool hasPrevious() const {
0316 return component<IndexType, hashString("previous")>() != kInvalid;
0317 }
0318
0319
0320
0321
0322 TrackStatePropMask getMask() const;
0323
0324
0325
0326
0327 void unset(TrackStatePropMask target)
0328 requires(!ReadOnly)
0329 {
0330 m_traj->self().unset(target, m_istate);
0331 }
0332
0333
0334
0335
0336 void addComponents(TrackStatePropMask mask)
0337 requires(!ReadOnly)
0338 {
0339 m_traj->self().addTrackStateComponents_impl(m_istate, mask);
0340 }
0341
0342
0343
0344 const Surface& referenceSurface() const {
0345 assert(hasReferenceSurface() &&
0346 "TrackState does not have reference surface");
0347 return *m_traj->referenceSurface(m_istate);
0348 }
0349
0350
0351
0352 bool hasReferenceSurface() const {
0353 return m_traj->referenceSurface(m_istate) != nullptr;
0354 }
0355
0356
0357
0358
0359
0360
0361
0362 void setReferenceSurface(std::shared_ptr<const Surface> srf)
0363 requires(!ReadOnly)
0364 {
0365 m_traj->setReferenceSurface(m_istate, std::move(srf));
0366 }
0367
0368
0369
0370
0371
0372
0373
0374 float& chi2()
0375 requires(!ReadOnly)
0376 {
0377 return component<float, hashString("chi2")>();
0378 }
0379
0380
0381
0382
0383
0384 float chi2() const { return component<float, hashString("chi2")>(); }
0385
0386
0387
0388
0389
0390 double& pathLength()
0391 requires(!ReadOnly)
0392 {
0393 return component<double, hashString("pathLength")>();
0394 }
0395
0396
0397
0398 double pathLength() const {
0399 return component<double, hashString("pathLength")>();
0400 }
0401
0402
0403
0404
0405
0406 TrackStateType typeFlags()
0407 requires(!ReadOnly)
0408 {
0409 return TrackStateType{
0410 component<TrackStateType::raw_type, hashString("typeFlags")>()};
0411 }
0412
0413
0414
0415 ConstTrackStateType typeFlags() const {
0416 return ConstTrackStateType{
0417 component<TrackStateType::raw_type, hashString("typeFlags")>()};
0418 }
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430 ConstParameters parameters() const;
0431
0432
0433
0434
0435
0436
0437 ConstCovariance covariance() const;
0438
0439
0440
0441 ConstParameters predicted() const {
0442 assert(has<hashString("predicted")>());
0443 return m_traj->self().parameters(
0444 component<IndexType, hashString("predicted")>());
0445 }
0446
0447 Parameters predicted()
0448 requires(!ReadOnly)
0449 {
0450 assert(has<hashString("predicted")>());
0451 return m_traj->self().parameters(
0452 component<IndexType, hashString("predicted")>());
0453 }
0454
0455
0456
0457 ConstCovariance predictedCovariance() const {
0458 assert(has<hashString("predicted")>());
0459 return m_traj->self().covariance(
0460 component<IndexType, hashString("predicted")>());
0461 }
0462
0463 Covariance predictedCovariance()
0464 requires(!ReadOnly)
0465 {
0466 assert(has<hashString("predicted")>());
0467 return m_traj->self().covariance(
0468 component<IndexType, hashString("predicted")>());
0469 }
0470
0471
0472
0473 bool hasPredicted() const { return has<hashString("predicted")>(); }
0474
0475
0476
0477
0478 ConstParameters filtered() const {
0479 assert(has<hashString("filtered")>());
0480 return m_traj->self().parameters(
0481 component<IndexType, hashString("filtered")>());
0482 }
0483
0484
0485
0486
0487 Parameters filtered()
0488 requires(!ReadOnly)
0489 {
0490 assert(has<hashString("filtered")>());
0491 return m_traj->self().parameters(
0492 component<IndexType, hashString("filtered")>());
0493 }
0494
0495
0496
0497
0498 ConstCovariance filteredCovariance() const {
0499 assert(has<hashString("filtered")>());
0500 return m_traj->self().covariance(
0501 component<IndexType, hashString("filtered")>());
0502 }
0503
0504
0505
0506
0507 Covariance filteredCovariance()
0508 requires(!ReadOnly)
0509 {
0510 assert(has<hashString("filtered")>());
0511 return m_traj->self().covariance(
0512 component<IndexType, hashString("filtered")>());
0513 }
0514
0515
0516
0517 bool hasFiltered() const { return has<hashString("filtered")>(); }
0518
0519
0520
0521
0522 ConstParameters smoothed() const {
0523 assert(has<hashString("smoothed")>());
0524 return m_traj->self().parameters(
0525 component<IndexType, hashString("smoothed")>());
0526 }
0527
0528
0529
0530
0531 Parameters smoothed()
0532 requires(!ReadOnly)
0533 {
0534 assert(has<hashString("smoothed")>());
0535 return m_traj->self().parameters(
0536 component<IndexType, hashString("smoothed")>());
0537 }
0538
0539
0540
0541
0542 ConstCovariance smoothedCovariance() const {
0543 assert(has<hashString("smoothed")>());
0544 return m_traj->self().covariance(
0545 component<IndexType, hashString("smoothed")>());
0546 }
0547
0548
0549
0550
0551 Covariance smoothedCovariance()
0552 requires(!ReadOnly)
0553 {
0554 assert(has<hashString("smoothed")>());
0555 return m_traj->self().covariance(
0556 component<IndexType, hashString("smoothed")>());
0557 }
0558
0559
0560
0561 bool hasSmoothed() const { return has<hashString("smoothed")>(); }
0562
0563
0564
0565
0566 ConstCovariance jacobian() const {
0567 assert(has<hashString("jacobian")>());
0568 return m_traj->self().jacobian(m_istate);
0569 }
0570
0571
0572
0573
0574 Covariance jacobian()
0575 requires(!ReadOnly)
0576 {
0577 assert(has<hashString("jacobian")>());
0578 return m_traj->self().jacobian(m_istate);
0579 }
0580
0581
0582
0583 bool hasJacobian() const { return has<hashString("jacobian")>(); }
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610
0611
0612
0613
0614
0615
0616 template <std::ranges::sized_range index_range_t>
0617 void setProjectorSubspaceIndices(const index_range_t& subspaceIndices)
0618 requires(!ReadOnly &&
0619 std::convertible_to<std::ranges::range_value_t<index_range_t>,
0620 std::uint8_t>)
0621 {
0622 assert(has<hashString("projector")>());
0623 assert(subspaceIndices.size() <= eBoundSize);
0624 BoundSubspaceIndices boundSubspace{};
0625 std::transform(subspaceIndices.begin(), subspaceIndices.end(),
0626 boundSubspace.begin(),
0627 [](auto i) { return static_cast<std::uint8_t>(i); });
0628 component<SerializedSubspaceIndices, hashString("projector")>() =
0629 serializeSubspaceIndices(boundSubspace);
0630 }
0631
0632
0633
0634 bool hasProjector() const { return has<hashString("projector")>(); }
0635
0636
0637
0638 BoundSubspaceIndices projectorSubspaceIndices() const {
0639 assert(has<hashString("projector")>());
0640 return deserializeSubspaceIndices<eBoundSize>(
0641 component<SerializedSubspaceIndices, hashString("projector")>());
0642 }
0643
0644
0645
0646 template <std::size_t measdim>
0647 SubspaceIndices<measdim> projectorSubspaceIndices() const {
0648 BoundSubspaceIndices boundSubspace = projectorSubspaceIndices();
0649 SubspaceIndices<measdim> subspace;
0650 std::copy(boundSubspace.begin(), boundSubspace.begin() + measdim,
0651 subspace.begin());
0652 return subspace;
0653 }
0654
0655
0656
0657 VariableBoundSubspaceHelper projectorSubspaceHelper() const {
0658 BoundSubspaceIndices boundSubspace = projectorSubspaceIndices();
0659 std::span<std::uint8_t> validSubspaceIndices(
0660 boundSubspace.begin(), boundSubspace.begin() + calibratedSize());
0661 return VariableBoundSubspaceHelper(validSubspaceIndices);
0662 }
0663
0664
0665
0666 template <std::size_t measdim>
0667 FixedBoundSubspaceHelper<measdim> projectorSubspaceHelper() const {
0668 SubspaceIndices<measdim> subspace = projectorSubspaceIndices<measdim>();
0669 return FixedBoundSubspaceHelper<measdim>(subspace);
0670 }
0671
0672
0673
0674 SourceLink getUncalibratedSourceLink() const;
0675
0676
0677
0678 void setUncalibratedSourceLink(SourceLink&& sourceLink)
0679 requires(!ReadOnly)
0680 {
0681 m_traj->setUncalibratedSourceLink(m_istate, std::move(sourceLink));
0682 }
0683
0684
0685
0686 bool hasUncalibratedSourceLink() const {
0687 return has<hashString("uncalibratedSourceLink")>();
0688 }
0689
0690
0691
0692 bool hasCalibrated() const { return has<hashString("calibrated")>(); }
0693
0694
0695
0696
0697
0698 template <std::size_t measdim>
0699 ConstCalibrated<measdim> calibrated() const {
0700 assert(has<hashString("calibrated")>());
0701 return m_traj->self().template calibrated<measdim>(m_istate);
0702 }
0703
0704
0705
0706
0707
0708 template <std::size_t measdim>
0709 Calibrated<measdim> calibrated()
0710 requires(!ReadOnly)
0711 {
0712 assert(has<hashString("calibrated")>());
0713 return m_traj->self().template calibrated<measdim>(m_istate);
0714 }
0715
0716
0717
0718
0719 template <std::size_t measdim>
0720 ConstCalibratedCovariance<measdim> calibratedCovariance() const {
0721 assert(has<hashString("calibratedCov")>());
0722 return m_traj->self().template calibratedCovariance<measdim>(m_istate);
0723 }
0724
0725
0726
0727
0728 template <std::size_t measdim>
0729 CalibratedCovariance<measdim> calibratedCovariance()
0730 requires(!ReadOnly)
0731 {
0732 assert(has<hashString("calibratedCov")>());
0733 return m_traj->self().template calibratedCovariance<measdim>(m_istate);
0734 }
0735
0736
0737
0738
0739 EffectiveCalibrated effectiveCalibrated()
0740 requires(!ReadOnly)
0741 {
0742 assert(has<hashString("calibrated")>());
0743 return m_traj->self().effectiveCalibrated(m_istate);
0744 }
0745
0746
0747
0748
0749 ConstEffectiveCalibrated effectiveCalibrated() const {
0750 assert(has<hashString("calibrated")>());
0751 return m_traj->self().effectiveCalibrated(m_istate);
0752 }
0753
0754
0755
0756
0757
0758 EffectiveCalibratedCovariance effectiveCalibratedCovariance() {
0759 assert(has<hashString("calibratedCov")>());
0760 return m_traj->self().effectiveCalibratedCovariance(m_istate);
0761 }
0762
0763
0764
0765
0766
0767 ConstEffectiveCalibratedCovariance effectiveCalibratedCovariance() const {
0768 assert(has<hashString("calibratedCov")>());
0769 return m_traj->self().effectiveCalibratedCovariance(m_istate);
0770 }
0771
0772
0773
0774
0775
0776 IndexType calibratedSize() const { return m_traj->calibratedSize(m_istate); }
0777
0778
0779
0780
0781
0782
0783 void allocateCalibrated(std::size_t measdim) {
0784 m_traj->allocateCalibrated(m_istate, measdim);
0785 }
0786
0787
0788
0789
0790
0791
0792
0793
0794
0795 template <typename val_t, typename cov_t>
0796 void allocateCalibrated(const Eigen::DenseBase<val_t>& val,
0797 const Eigen::DenseBase<cov_t>& cov)
0798 requires(Concepts::eigen_base_is_fixed_size<val_t> &&
0799 Concepts::eigen_bases_have_same_num_rows<val_t, cov_t> &&
0800 Concepts::eigen_base_is_square<cov_t> &&
0801 Eigen::PlainObjectBase<val_t>::RowsAtCompileTime <=
0802 static_cast<std::underlying_type_t<BoundIndices>>(eBoundSize))
0803 {
0804 m_traj->template allocateCalibrated<
0805 Eigen::PlainObjectBase<val_t>::RowsAtCompileTime>(m_istate, val, cov);
0806 }
0807
0808
0809
0810
0811
0812
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828
0829
0830 void shareFrom(TrackStatePropMask shareSource, TrackStatePropMask shareTarget)
0831 requires(!ReadOnly)
0832 {
0833 shareFrom(*this, shareSource, shareTarget);
0834 }
0835
0836
0837
0838
0839
0840
0841 template <bool ReadOnlyOther>
0842 void shareFrom(const TrackStateProxy<Trajectory, M, ReadOnlyOther>& other,
0843 TrackStatePropMask component)
0844 requires(!ReadOnly)
0845 {
0846 shareFrom(other, component, component);
0847 }
0848
0849
0850
0851
0852
0853
0854
0855
0856 template <bool ReadOnlyOther>
0857 void shareFrom(const TrackStateProxy<Trajectory, M, ReadOnlyOther>& other,
0858 TrackStatePropMask shareSource, TrackStatePropMask shareTarget)
0859 requires(!ReadOnly)
0860 {
0861 assert(m_traj == other.m_traj &&
0862 "Cannot share components across MultiTrajectories");
0863
0864 assert(ACTS_CHECK_BIT(other.getMask(), shareSource) &&
0865 "Source has incompatible allocation");
0866
0867 m_traj->self().shareFrom(m_istate, other.m_istate, shareSource,
0868 shareTarget);
0869 }
0870
0871
0872
0873
0874
0875
0876
0877
0878
0879
0880 template <TrackStateProxyConcept track_state_proxy_t>
0881 void copyFrom(const track_state_proxy_t& other,
0882 TrackStatePropMask mask = TrackStatePropMask::All,
0883 bool onlyAllocated = true)
0884 requires(!ReadOnly)
0885 {
0886 using PM = TrackStatePropMask;
0887
0888 if (onlyAllocated) {
0889 auto dest = getMask();
0890 auto src = other.getMask() &
0891 mask;
0892
0893 if (ACTS_CHECK_BIT(src, PM::Calibrated)) {
0894
0895 dest |= PM::Calibrated;
0896 }
0897
0898 if ((static_cast<std::underlying_type_t<TrackStatePropMask>>(
0899 (src ^ dest) & src) != 0 ||
0900 dest == TrackStatePropMask::None ||
0901 src == TrackStatePropMask::None) &&
0902 mask != TrackStatePropMask::None) {
0903 throw std::runtime_error(
0904 "Attempt track state copy with incompatible allocations");
0905 }
0906
0907
0908 if (ACTS_CHECK_BIT(src, PM::Predicted)) {
0909 predicted() = other.predicted();
0910 predictedCovariance() = other.predictedCovariance();
0911 }
0912
0913 if (ACTS_CHECK_BIT(src, PM::Filtered)) {
0914 filtered() = other.filtered();
0915 filteredCovariance() = other.filteredCovariance();
0916 }
0917
0918 if (ACTS_CHECK_BIT(src, PM::Smoothed)) {
0919 smoothed() = other.smoothed();
0920 smoothedCovariance() = other.smoothedCovariance();
0921 }
0922
0923 if (other.hasUncalibratedSourceLink()) {
0924 setUncalibratedSourceLink(other.getUncalibratedSourceLink());
0925 }
0926
0927 if (ACTS_CHECK_BIT(src, PM::Jacobian)) {
0928 jacobian() = other.jacobian();
0929 }
0930
0931 if (ACTS_CHECK_BIT(src, PM::Calibrated)) {
0932
0933
0934 auto* self = this;
0935 visit_measurement(other.calibratedSize(), [&](auto N) {
0936 constexpr int measdim = decltype(N)::value;
0937 self->allocateCalibrated(
0938 other.template calibrated<measdim>().eval(),
0939 other.template calibratedCovariance<measdim>().eval());
0940 });
0941
0942 setProjectorSubspaceIndices(other.projectorSubspaceIndices());
0943 }
0944 } else {
0945 if (ACTS_CHECK_BIT(mask, PM::Predicted) &&
0946 has<hashString("predicted")>() &&
0947 other.template has<hashString("predicted")>()) {
0948 predicted() = other.predicted();
0949 predictedCovariance() = other.predictedCovariance();
0950 }
0951
0952 if (ACTS_CHECK_BIT(mask, PM::Filtered) && has<hashString("filtered")>() &&
0953 other.template has<hashString("filtered")>()) {
0954 filtered() = other.filtered();
0955 filteredCovariance() = other.filteredCovariance();
0956 }
0957
0958 if (ACTS_CHECK_BIT(mask, PM::Smoothed) && has<hashString("smoothed")>() &&
0959 other.template has<hashString("smoothed")>()) {
0960 smoothed() = other.smoothed();
0961 smoothedCovariance() = other.smoothedCovariance();
0962 }
0963
0964 if (other.hasUncalibratedSourceLink()) {
0965 setUncalibratedSourceLink(other.getUncalibratedSourceLink());
0966 }
0967
0968 if (ACTS_CHECK_BIT(mask, PM::Jacobian) && has<hashString("jacobian")>() &&
0969 other.template has<hashString("jacobian")>()) {
0970 jacobian() = other.jacobian();
0971 }
0972
0973
0974
0975 if (ACTS_CHECK_BIT(mask, PM::Calibrated) &&
0976 other.template has<hashString("calibrated")>()) {
0977
0978
0979 auto* self = this;
0980 visit_measurement(other.calibratedSize(), [&](auto N) {
0981 constexpr int measdim = decltype(N)::value;
0982 self->allocateCalibrated(
0983 other.template calibrated<measdim>().eval(),
0984 other.template calibratedCovariance<measdim>().eval());
0985 });
0986
0987 setProjectorSubspaceIndices(other.projectorSubspaceIndices());
0988 }
0989 }
0990
0991 chi2() = other.chi2();
0992 pathLength() = other.pathLength();
0993 typeFlags() = other.typeFlags();
0994
0995 if (other.hasReferenceSurface()) {
0996 setReferenceSurface(other.referenceSurface().getSharedPtr());
0997 }
0998
0999 m_traj->copyDynamicFrom(m_istate, other.container(), other.index());
1000 }
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011 template <HashedString key>
1012 constexpr bool has() const {
1013 return m_traj->template has<key>(m_istate);
1014 }
1015
1016
1017
1018
1019 constexpr bool has(HashedString key) const {
1020 return m_traj->has(key, m_istate);
1021 }
1022
1023
1024
1025
1026
1027 constexpr bool has(std::string_view key) const {
1028 return has(hashStringDynamic(key));
1029 }
1030
1031
1032
1033
1034
1035 template <typename T, HashedString key>
1036 constexpr T& component()
1037 requires(!ReadOnly)
1038 {
1039 return m_traj->template component<T, key>(m_istate);
1040 }
1041
1042
1043
1044
1045
1046 template <typename T>
1047 constexpr T& component(HashedString key)
1048 requires(!ReadOnly)
1049 {
1050 return m_traj->template component<T>(key, m_istate);
1051 }
1052
1053
1054
1055
1056
1057
1058 template <typename T>
1059 constexpr T& component(std::string_view key)
1060 requires(!ReadOnly)
1061 {
1062 return m_traj->template component<T>(hashStringDynamic(key), m_istate);
1063 }
1064
1065
1066
1067
1068
1069 template <typename T, HashedString key>
1070 constexpr const T& component() const {
1071 return m_traj->template component<T, key>(m_istate);
1072 }
1073
1074
1075
1076
1077
1078 template <typename T>
1079 constexpr const T& component(HashedString key) const {
1080 return m_traj->template component<T>(key, m_istate);
1081 }
1082
1083
1084
1085
1086
1087
1088 template <typename T>
1089 constexpr const T& component(std::string_view key) const {
1090 return m_traj->template component<T>(hashStringDynamic(key), m_istate);
1091 }
1092
1093
1094
1095
1096
1097 MultiTrajectory<Trajectory>& trajectory()
1098 requires(!ReadOnly)
1099 {
1100 return *m_traj;
1101 }
1102
1103
1104
1105 const MultiTrajectory<Trajectory>& trajectory() const { return *m_traj; }
1106
1107
1108
1109 auto& container()
1110 requires(!ReadOnly)
1111 {
1112 return *m_traj;
1113 }
1114
1115
1116
1117 const auto& container() const { return *m_traj; }
1118
1119 private:
1120
1121 TrackStateProxy(
1122 detail_lt::ConstIf<MultiTrajectory<Trajectory>, ReadOnly>& trajectory,
1123 IndexType istate);
1124
1125 detail_lt::TransitiveConstPointer<
1126 detail_lt::ConstIf<MultiTrajectory<Trajectory>, ReadOnly>>
1127 m_traj;
1128 IndexType m_istate;
1129
1130 friend class Acts::MultiTrajectory<Trajectory>;
1131 friend class TrackStateProxy<Trajectory, M, true>;
1132 friend class TrackStateProxy<Trajectory, M, false>;
1133 };
1134 }
1135
1136 #include "Acts/EventData/TrackStateProxy.ipp"