Skip to content

Commit

Permalink
fix: RootTrajectoryStatesWriter checks measurement dimension (#1054)
Browse files Browse the repository at this point in the history
Previously, `RootTrajectoryStatesWriter` would unconditionally try to
access `eBoundLoc1` of any measurement it consumed. This breaks if a
measurement is 1-dimensional. This changes the behaviour to check for
the number of dimensions. Note that `RootTrajectoryStatesWriter` still
hard assumes that a 2D measurement will be `l_0, l_1` which it might not
be, and also doesn't handle higher-dimension measurements.
  • Loading branch information
paulgessinger committed Nov 2, 2021
1 parent 190c4ca commit 94c51b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions Examples/Io/Root/src/RootTrajectoryStatesWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,17 +424,26 @@ ActsExamples::ProcessCode ActsExamples::RootTrajectoryStatesWriter::writeT(
H * covariance * H.transpose();
auto res = state.effectiveCalibrated() - H * parameters;
m_res_x_hit.push_back(res[Acts::eBoundLoc0]);
m_res_y_hit.push_back(res[Acts::eBoundLoc1]);
m_err_x_hit.push_back(
sqrt(resCov(Acts::eBoundLoc0, Acts::eBoundLoc0)));
m_err_y_hit.push_back(
sqrt(resCov(Acts::eBoundLoc1, Acts::eBoundLoc1)));
m_pull_x_hit.push_back(
res[Acts::eBoundLoc0] /
sqrt(resCov(Acts::eBoundLoc0, Acts::eBoundLoc0)));
m_pull_y_hit.push_back(
res[Acts::eBoundLoc1] /
sqrt(resCov(Acts::eBoundLoc1, Acts::eBoundLoc1)));

if (state.calibratedSize() >= 2) {
m_pull_y_hit.push_back(
res[Acts::eBoundLoc1] /
sqrt(resCov(Acts::eBoundLoc1, Acts::eBoundLoc1)));
m_res_y_hit.push_back(res[Acts::eBoundLoc1]);
m_err_y_hit.push_back(
sqrt(resCov(Acts::eBoundLoc1, Acts::eBoundLoc1)));
} else {
float nan = std::numeric_limits<float>::quiet_NaN();
m_pull_y_hit.push_back(nan);
m_res_y_hit.push_back(nan);
m_err_y_hit.push_back(nan);
}

m_dim_hit.push_back(state.calibratedSize());
}

Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/tests/root_file_hashes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test_root_clusters_writer[configKwConstructor]__clusters.root: 7e452af7243d282dd
test_root_clusters_writer[kwargsConstructor]__clusters.root: 7e452af7243d282dd0a8f5aa2844e150ef44364980bf3641718899068a1a1ecb
test_root_material_writer__material.root: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

test_truth_tracking__trackstates_fitter.root: d01b99db16c353bb7224ca51378da4c3a21041054a769ee09a7588d0083bbd50
test_truth_tracking__trackstates_fitter.root: 42dd37b7460f8bdd8927cec16d698bd00aabe73f79b4ef5d6bd12a98a65a9bb8
test_truth_tracking__tracksummary_fitter.root: 662959c1b8dbdcf8efe9d512bf36ac0332f33ba1ff785676a97b700b0b84495f
test_truth_tracking__performance_track_finder.root: 76a990d595b6e097da2bed447783bd63044956e5649a5dd6fd7a6a3434786877

Expand Down

0 comments on commit 94c51b0

Please sign in to comment.