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