Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: unbiased trackstates for fitters that do not smooth #2999

Merged
merged 11 commits into from
Mar 4, 2024
33 changes: 33 additions & 0 deletions Examples/Io/Root/src/RootTrackStatesWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,39 @@ ActsExamples::ProcessCode ActsExamples::RootTrackStatesWriter::writeT(
state.smoothedCovariance() - K * H * state.smoothedCovariance();
return std::make_pair(unbiasedParamsVec, unbiasedParamsCov);
}
if (ipar == eUnbiased && !state.hasSmoothed() && state.hasFiltered() &&
state.hasProjector() && state.hasCalibrated()) {
// Same calculation as above but using the filtered states.
auto m = state.effectiveCalibrated();
auto H = state.effectiveProjector();
auto V = state.effectiveCalibratedCovariance();
auto K =
(state.filteredCovariance() * H.transpose() *
(H * state.filteredCovariance() * H.transpose() - V).inverse())
.eval();
auto unbiasedParamsVec =
state.filtered() + K * (m - H * state.filtered());
auto unbiasedParamsCov =
state.filteredCovariance() - K * H * state.filteredCovariance();
return std::make_pair(unbiasedParamsVec, unbiasedParamsCov);
}
if (ipar == eUnbiased && !state.hasSmoothed() && !state.hasFiltered() &&
state.hasPredicted() && state.hasProjector() &&
state.hasCalibrated()) {
// Same calculation as above but using the predicted states.
auto m = state.effectiveCalibrated();
auto H = state.effectiveProjector();
auto V = state.effectiveCalibratedCovariance();
auto K =
(state.predictedCovariance() * H.transpose() *
(H * state.predictedCovariance() * H.transpose() - V).inverse())
.eval();
auto unbiasedParamsVec =
state.predicted() + K * (m - H * state.predicted());
auto unbiasedParamsCov =
state.predictedCovariance() - K * H * state.predictedCovariance();
return std::make_pair(unbiasedParamsVec, unbiasedParamsCov);
}
return std::nullopt;
};

Expand Down
6 changes: 3 additions & 3 deletions Examples/Python/tests/root_file_hashes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test_truth_tracking_kalman[odd-1000.0]__tracksummary_fitter.root: 3d424dec9b172f
test_truth_tracking_kalman[odd-1000.0]__performance_track_finder.root: 39aec6316cceb90e314e16b02947faa691c18f57c3a851a25e547a8fc05a4593
test_truth_tracking_gsf[generic]__trackstates_gsf.root: e971da3dcc1997bc9f8a74e0f75a46d4b92c9cf6286b0e05dc8a1bd34df75444
test_truth_tracking_gsf[generic]__tracksummary_gsf.root: ec3ef893f7138392bcdce96322e2dd31951737271b72ac9dd3282fc187700d03
test_truth_tracking_gsf[odd]__trackstates_gsf.root: c28b23358cf88fb40eeb3c47db9af62462cc7cdd9d70dec13d0615f136065191
test_truth_tracking_gsf[odd]__trackstates_gsf.root: f4dba7c0d9a43ab2a249e624b3411c550f7462bac30fe9f85745aab742e15dea
test_truth_tracking_gsf[odd]__tracksummary_gsf.root: 3425c0974943e0dac06dfedceaf1e9e3bec3bdc6ff73588d849a234de017e230
test_particle_gun__particles.root: 7eec62018b6944fea565dad75aa41ef87d1f2737b2a814fbab189817ac8180fe
test_material_mapping__material-map_tracks.root: 6e1441c418ff0b17983c2d0483248cc1dee6b77b09d0ca9d03c742c9d1373630
Expand Down Expand Up @@ -95,9 +95,9 @@ test_truth_tracking_kalman[generic-True-1000.0]__trackstates_fitter.root: bdc70d
test_truth_tracking_kalman[generic-True-1000.0]__tracksummary_fitter.root: fc82abfc4e3016cda806e743a270bf78b6d4cc404cd52145ea1eabed85d32feb
test_truth_tracking_kalman[odd-False-0.0]__trackstates_fitter.root: d0a9203c917be9caacd1c6c4244538e2038e2472b4707b61bb5c0bb1c5e2a3ad
test_truth_tracking_kalman[odd-False-0.0]__tracksummary_fitter.root: a5af8190f5981e7fa2556f20027af32b383bc07259927a58116d2676e5971dbe
test_truth_tracking_kalman[odd-False-1000.0]__trackstates_fitter.root: b858d09a75e852a7c23f2f3a512de8c334c593e700319d4f935e844ec00c379f
test_truth_tracking_kalman[odd-False-1000.0]__trackstates_fitter.root: 24aed25ba31599d6d74919667703bc9a1c6f063d955a6e92e0ce51924a2c6a4f
test_truth_tracking_kalman[odd-False-1000.0]__tracksummary_fitter.root: 3d424dec9b172f253c8c4ffbda470f678fd1081a3d36dcfea517ab0f94995ae4
test_truth_tracking_kalman[odd-True-0.0]__trackstates_fitter.root: d0a9203c917be9caacd1c6c4244538e2038e2472b4707b61bb5c0bb1c5e2a3ad
test_truth_tracking_kalman[odd-True-0.0]__tracksummary_fitter.root: a5af8190f5981e7fa2556f20027af32b383bc07259927a58116d2676e5971dbe
test_truth_tracking_kalman[odd-True-1000.0]__trackstates_fitter.root: b858d09a75e852a7c23f2f3a512de8c334c593e700319d4f935e844ec00c379f
test_truth_tracking_kalman[odd-True-1000.0]__trackstates_fitter.root: 24aed25ba31599d6d74919667703bc9a1c6f063d955a6e92e0ce51924a2c6a4f
test_truth_tracking_kalman[odd-True-1000.0]__tracksummary_fitter.root: 3d424dec9b172f253c8c4ffbda470f678fd1081a3d36dcfea517ab0f94995ae4
Loading