Skip to content

Commit

Permalink
refactor: Accumulated EigenStepper brush-over (#3130)
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand authored Apr 22, 2024
1 parent eadd65d commit e0633f3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Core/include/Acts/Propagator/DefaultExtension.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ struct DefaultExtension {
/// = sqrt(m^2/p^2 + c^{-2}) with the mass m and the momentum p.
auto m = stepper.particleHypothesis(state.stepping).mass();
auto p = stepper.absoluteMomentum(state.stepping);
auto dtds = std::hypot(1, m / p);
auto dtds = std::sqrt(1 + m * m / (p * p));
state.stepping.pars[eFreeTime] += h * dtds;
if (state.stepping.covTransport) {
state.stepping.derivative(3) = dtds;
Expand Down Expand Up @@ -178,7 +178,7 @@ struct DefaultExtension {
auto dir = stepper.direction(state.stepping);
auto qop = stepper.qOverP(state.stepping);
auto p = stepper.absoluteMomentum(state.stepping);
auto dtds = std::hypot(1, m / p);
auto dtds = std::sqrt(1 + m * m / (p * p));

D = FreeMatrix::Identity();

Expand Down
20 changes: 9 additions & 11 deletions Core/include/Acts/Propagator/EigenStepper.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ template <typename E, typename A>
template <typename propagator_state_t, typename navigator_t>
Acts::Result<double> Acts::EigenStepper<E, A>::step(
propagator_state_t& state, const navigator_t& navigator) const {
using namespace UnitLiterals;

// Runge-Kutta integrator state
auto& sd = state.stepping.stepData;
double error_estimate = 0.;
Expand Down Expand Up @@ -242,11 +240,11 @@ Acts::Result<double> Acts::EigenStepper<E, A>::step(
break;
}

// double std::sqrt is 3x faster than std::pow
const double stepSizeScaling =
std::min(std::max(0.25f, std::sqrt(std::sqrt(static_cast<float>(
state.options.stepTolerance /
std::abs(2. * error_estimate))))),
4.0f);
std::clamp(std::sqrt(std::sqrt(state.options.stepTolerance /
std::abs(2. * error_estimate))),
0.25, 4.0);
h *= stepSizeScaling;

// If step size becomes too small the particle remains at the initial
Expand Down Expand Up @@ -323,11 +321,11 @@ Acts::Result<double> Acts::EigenStepper<E, A>::step(
state.stepping.derivative.template segment<3>(4) = sd.k4;
}
state.stepping.pathAccumulated += h;
const double stepSizeScaling = std::min(
std::max(0.25f,
std::sqrt(std::sqrt(static_cast<float>(
state.options.stepTolerance / std::abs(error_estimate))))),
4.0f);
// double std::sqrt is 3x faster than std::pow
const double stepSizeScaling =
std::clamp(std::sqrt(std::sqrt(state.options.stepTolerance /
std::abs(error_estimate))),
0.25, 4.0);
const double nextAccuracy = std::abs(h * stepSizeScaling);
const double previousAccuracy = std::abs(state.stepping.stepSize.accuracy());
const double initialStepLength = std::abs(initialH);
Expand Down
46 changes: 23 additions & 23 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: d4160a87b2f0f21cb19b8e3b0d07f97c343c830a535de4d33a186d5179ab5f06
test_truth_tracking_gsf[generic]__tracksummary_gsf.root: c110627dd7015c20b302273b5cba49f64a51e3450a722b064be1605f85a6bd6b
test_truth_tracking_gsf[odd]__trackstates_gsf.root: 3024647ef4b65859d1b5cf4a838dd8f24c4a6986fb1d34969b7033434a3dfb02
test_truth_tracking_gsf[odd]__trackstates_gsf.root: a3b08c5c0497c85ce2280b4487bbbbb1c4a665d9917c0b1ca040f51524c9d1d4
test_truth_tracking_gsf[odd]__tracksummary_gsf.root: 84310dd790f3f43b5cf9cee0b08c4deed389171f4caaaa00412f62f7e9944e3b
test_particle_gun__particles.root: 5fe7dda2933ee6b9615b064d192322fe07831133cd998e5ed99a3b992b713a10
test_material_mapping__material-map_tracks.root: b1138566d8d51579dce07f80166f05986942cf78c76b36875aea9b4b8b9bb957
Expand All @@ -44,22 +44,22 @@ test_digitization_example_input[smeared]__particles.root: 5fe7dda2933ee6b9615b06
test_digitization_example_input[smeared]__measurements.root: 95ef20bcdc349da5bc025faf41cb76855ac087ae75df4f4bf953db5b23927aa5
test_digitization_example_input[geometric]__particles.root: 5fe7dda2933ee6b9615b064d192322fe07831133cd998e5ed99a3b992b713a10
test_digitization_example_input[geometric]__measurements.root: fa4729e28fdbbc459400dc3b7cc896c7e0cca047ab889c55c2f148d13b361637
test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: 2b6778011c20e77ddd3337a1d23dbe19df7e98733ca6f54fd82d7c4361f9eaae
test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: 6713eeba4bd96216a7385928ad2f634378e95c4dc6fa42e8b575ac626afa1828
test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: 3c711d991ba648269632055aa2db964dde705de7b3a2214f16cf68837ef86808
test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: a81ad32f584ee34cfd4e9d7adad1938e4e3de673f22d2976362c6d475e2bd702
test_ckf_tracks_example[generic-full_seeding]__performance_seeding_trees.root: 0e0676ffafdb27112fbda50d1cf627859fa745760f98073261dcf6db3f2f991e
test_ckf_tracks_example[generic-truth_estimated]__trackstates_ckf.root: c5e3e74aa94795fa991cf6e3c4922604fa0ff946c5a4a51a16a299f53534eda6
test_ckf_tracks_example[generic-truth_estimated]__tracksummary_ckf.root: bd0c382f85a95549fbde5ca977a7311b0405ec669f21131e5d3629e9e24e0bea
test_ckf_tracks_example[generic-truth_estimated]__trackstates_ckf.root: 5242c66d45158840e85f2cdfd08e8533bc392be4872d4a176f2eb7679348fe46
test_ckf_tracks_example[generic-truth_estimated]__tracksummary_ckf.root: a427650fe6b6a4125813e726b4182641685e00cd5eb0575c790d0a2b632df995
test_ckf_tracks_example[generic-truth_estimated]__performance_seeding.root: 1facb05c066221f6361b61f015cdf0918e94d9f3fce2269ec7b6a4dffeb2bc7e
test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: 2a1569f867a155ed0034c6436d5b90550cbc0ae3d3dfa0be17a8a571dd338d7f
test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: f3d8b236e144e139a264964bfa2ba6807cbe977099448e2a7d4159d43d497228
test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: 4d3234a5050dfa02c7b699a376ba6b6052e8929b1edc597de42335074be41472
test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: e4afdc4d0a90adf60101a036d215735d44627dfa1526b675d6bba600d5998e61
test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: 246a791b43e17e2b570863d280597fdfa1a9b0f5fa6aac999bca34c6e33b381a
test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: 060e188fad357736cd07979f7d0e0121ba2f6d83003e429e9adec09103ea6023
test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: b750d138dc4fa3c67e2cf845ecd1a8b4e70834b1a989826f78a933151552ed6b
test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: 77efdf87cf84807f3b70bf5464c0371c945171e5bd0c8295c8cd7ffce873de7d
test_ckf_tracks_example[odd-full_seeding]__performance_seeding_trees.root: 43c58577aafe07645e5660c4f43904efadf91d8cda45c5c04c248bbe0f59814f
test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: 097539b396b5bc7ed43f1e3005354bcbcfba4d24d0244379516dd4d327a1ae95
test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: 9c1c0d99c1211c5505ac822bde7d9a4351a46f15e648a53192a5340630c4779a
test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: 7860d9a4d66dabd5911eb4f90ec15995279c257417516a24595550f4721d7ed4
test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: 8e41c0d85e934ab1a7a5281e79fc0ca126d4bd5bae21c94e9b3fc643c73d608f
test_ckf_tracks_example[odd-truth_estimated]__performance_seeding.root: 1a36b7017e59f1c08602ef3c2cb0483c51df248f112e3780c66594110719c575
test_ckf_tracks_example[odd-truth_smeared]__trackstates_ckf.root: fbcad6efe99cc8bda41c49f1ee81fe48c817cbc01940f0577d0f1b93dbc7af55
test_ckf_tracks_example[odd-truth_smeared]__tracksummary_ckf.root: 3bad4c3191fe62044df6c57dbe2c461943387b1cebba938c8400ef03cff83b72
test_ckf_tracks_example[odd-truth_smeared]__trackstates_ckf.root: 30e666e9675457d11168eb9dd997acaa316776974f42c9609b6827d5bf6e7a6c
test_ckf_tracks_example[odd-truth_smeared]__tracksummary_ckf.root: 1f4692c4855cdd01da97ef73f822c0b64bff8a7409beee02750343cf6224c7b6
test_vertex_fitting_reading[Truth-False-100]__performance_vertexing.root: 76ef6084d758dfdfc0151ddec2170e12d73394424e3dac4ffe46f0f339ec8293
test_vertex_fitting_reading[Iterative-False-100]__performance_vertexing.root: 60372210c830a04f95ceb78c6c68a9b0de217746ff59e8e73053750c837b57eb
test_vertex_fitting_reading[Iterative-True-100]__performance_vertexing.root: e34f217d524a5051dbb04a811d3407df3ebe2cc4bb7f54f6bda0847dbd7b52c3
Expand All @@ -85,19 +85,19 @@ test_exatrkx[cpu-torch]__performance_track_finding.root: 36b3045589c4c17c038dbc8
test_exatrkx[gpu-onnx]__performance_track_finding.root: 9090de10ffb1489d3f1993e2a3081a3038227e3e5c453e98a9a4f33ea3d6d817
test_exatrkx[gpu-torch]__performance_track_finding.root: 36b3045589c4c17c038dbc87943366f4af4440f7eea6887afb763871ac149b05
test_ML_Ambiguity_Solver__performance_ambiML.root: 284ff5c3a08c0b810938e4ac2f8ba8fe2babb17d4c202b624ed69fff731a9006
test_truth_tracking_kalman[generic-False-0.0]__trackstates_fitter.root: 093c0339e848c04e796f1dc9abe1a017a5d7450fae865ad354c71a46bbb34629
test_truth_tracking_kalman[generic-False-0.0]__tracksummary_fitter.root: e3e6199e83a794ecc07a05cf61105c0ca726e1b73c0731663843b66cc22462e1
test_truth_tracking_kalman[generic-False-0.0]__trackstates_fitter.root: 2ccfa7075529e8eef7d10e5ea6a4e83b6151bffbf109006d3e0e12533cdf87be
test_truth_tracking_kalman[generic-False-0.0]__tracksummary_fitter.root: bedccd1c0f3df8a9e037792eead3b9243c0ce671a29838740ad1816054c2cbd0
test_truth_tracking_kalman[generic-False-1000.0]__trackstates_fitter.root: b80ca323b0c3ec87559336ed1e9519f430f804aaf64f1cb7d05ffa9df00ae370
test_truth_tracking_kalman[generic-False-1000.0]__tracksummary_fitter.root: f1ebb0734350ab0857352987a66f6c77db67227a54a73d3524ccdef5e80bf952
test_truth_tracking_kalman[generic-True-0.0]__trackstates_fitter.root: 093c0339e848c04e796f1dc9abe1a017a5d7450fae865ad354c71a46bbb34629
test_truth_tracking_kalman[generic-True-0.0]__tracksummary_fitter.root: e3e6199e83a794ecc07a05cf61105c0ca726e1b73c0731663843b66cc22462e1
test_truth_tracking_kalman[generic-True-0.0]__trackstates_fitter.root: 2ccfa7075529e8eef7d10e5ea6a4e83b6151bffbf109006d3e0e12533cdf87be
test_truth_tracking_kalman[generic-True-0.0]__tracksummary_fitter.root: bedccd1c0f3df8a9e037792eead3b9243c0ce671a29838740ad1816054c2cbd0
test_truth_tracking_kalman[generic-True-1000.0]__trackstates_fitter.root: b80ca323b0c3ec87559336ed1e9519f430f804aaf64f1cb7d05ffa9df00ae370
test_truth_tracking_kalman[generic-True-1000.0]__tracksummary_fitter.root: f1ebb0734350ab0857352987a66f6c77db67227a54a73d3524ccdef5e80bf952
test_truth_tracking_kalman[odd-False-0.0]__trackstates_fitter.root: f6b2e1111798b29c1c1e958a711a17476838f51d601d7346b1f215458d3204ad
test_truth_tracking_kalman[odd-False-0.0]__tracksummary_fitter.root: de3d002f50aafc8b074dbd8f4e7135df7491c0463920710fbe39e29c4f20a200
test_truth_tracking_kalman[odd-False-1000.0]__trackstates_fitter.root: e14a887ea509c0d140881fe88a1d607f0d29e938828d1cd72f4b41a550447aff
test_truth_tracking_kalman[odd-False-0.0]__trackstates_fitter.root: b13941f3b7aaf87fd34638ecc76b86aa5e820ac6d36133cb9e67bd7f57b040fc
test_truth_tracking_kalman[odd-False-0.0]__tracksummary_fitter.root: a7d6e0710b32219afc8879b4976c9bd388c4adb47b513b1cc8d0a3aaeba5c10b
test_truth_tracking_kalman[odd-False-1000.0]__trackstates_fitter.root: 82954b26640b124ae1136fe72d3e15ea92ed75c0e34f9d97327b20fc60a982d2
test_truth_tracking_kalman[odd-False-1000.0]__tracksummary_fitter.root: 3488f9e188faf706b312e0156a5d6c4a871163ed46cd6f35a1dc90f11aa3e93e
test_truth_tracking_kalman[odd-True-0.0]__trackstates_fitter.root: f6b2e1111798b29c1c1e958a711a17476838f51d601d7346b1f215458d3204ad
test_truth_tracking_kalman[odd-True-0.0]__tracksummary_fitter.root: de3d002f50aafc8b074dbd8f4e7135df7491c0463920710fbe39e29c4f20a200
test_truth_tracking_kalman[odd-True-1000.0]__trackstates_fitter.root: e14a887ea509c0d140881fe88a1d607f0d29e938828d1cd72f4b41a550447aff
test_truth_tracking_kalman[odd-True-0.0]__trackstates_fitter.root: b13941f3b7aaf87fd34638ecc76b86aa5e820ac6d36133cb9e67bd7f57b040fc
test_truth_tracking_kalman[odd-True-0.0]__tracksummary_fitter.root: a7d6e0710b32219afc8879b4976c9bd388c4adb47b513b1cc8d0a3aaeba5c10b
test_truth_tracking_kalman[odd-True-1000.0]__trackstates_fitter.root: 82954b26640b124ae1136fe72d3e15ea92ed75c0e34f9d97327b20fc60a982d2
test_truth_tracking_kalman[odd-True-1000.0]__tracksummary_fitter.root: 3488f9e188faf706b312e0156a5d6c4a871163ed46cd6f35a1dc90f11aa3e93e

0 comments on commit e0633f3

Please sign in to comment.