Skip to content

Commit

Permalink
fix: Copy whole trackstate did not copy calibrated (#3693)
Browse files Browse the repository at this point in the history
Know your defaults...
  • Loading branch information
benjaminhuth authored Oct 9, 2024
1 parent 464fd46 commit 94698b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Core/include/Acts/EventData/TrackStateProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,9 @@ class TrackStateProxy {
jacobian() = other.jacobian();
}

// NOTE: we should not check hasCalibrated on this, since it
// may be not yet allocated
if (ACTS_CHECK_BIT(mask, PM::Calibrated) &&
has<hashString("calibrated")>() &&
other.template has<hashString("calibrated")>()) {
allocateCalibrated(other.calibratedSize());

Expand Down
20 changes: 20 additions & 0 deletions Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,24 @@ BOOST_AUTO_TEST_CASE(ReverseTrackStates) {
}
}

BOOST_AUTO_TEST_CASE(CopyTrackProxyCalibrated) {
VectorTrackContainer vtc{};
VectorMultiTrajectory mtj{};
TrackContainer tc{vtc, mtj};

constexpr static std::size_t kMeasurementSize = 3;

auto track1 = tc.makeTrack();
auto ts = track1.appendTrackState(TrackStatePropMask::Calibrated);
ts.allocateCalibrated(kMeasurementSize);
ts.calibrated<kMeasurementSize>() = Vector3::Ones();
ts.calibratedCovariance<kMeasurementSize>() = SquareMatrix3::Identity();
ts.setSubspaceIndices(BoundSubspaceIndices{});

auto tsCopy = track1.appendTrackState(TrackStatePropMask::Calibrated);
tsCopy.copyFrom(ts, TrackStatePropMask::Calibrated, false);

BOOST_CHECK_EQUAL(ts.calibratedSize(), tsCopy.calibratedSize());
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 94698b3

Please sign in to comment.