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

fix: protect TrackSelector against eta=nan #3785

Merged
merged 6 commits into from
Oct 30, 2024
Merged

Conversation

timadye
Copy link
Contributor

@timadye timadye commented Oct 25, 2024

Protect against η=nan in Acts::TrackSelector::isValidTrack(), which would throw std::invalid_argument{"Eta is outside the abs eta bin edges"} exception. This can come about if somehow the track θ<0 or θ>π. We should try to prevent these out-of-range values, but having them shouldn't raise an exception.

@github-actions github-actions bot added Component - Core Affects the Core module Track Finding labels Oct 25, 2024
Copy link

github-actions bot commented Oct 25, 2024

📊: Physics performance monitoring for 42b5486

Full contents

physmon summary

@andiwand
Copy link
Contributor

I wonder if the nan is bound to an earlier FPE and we should rather fix the root cause. Something like that might help https://github.com/acts-project/acts/pull/3756/files#diff-c0c115f048fe0bf709beaf5d8268193cb06dcadcda1819c7722696393e4e2df2R49

I have this helper

/// Calculate the pseudorapidity from the polar angle theta.
///
/// @param theta is the polar angle in radian towards the z-axis.
///
/// @return the pseudorapidity towards the z-axis.
template <typename Scalar>
Scalar etaFromTheta(Scalar theta) {
return -std::log(std::tan(0.5 * theta));
}
and would like to make it FPE safe. In that case it could also fix the problem you see at its root.

@timadye
Copy link
Contributor Author

timadye commented Oct 25, 2024

I wonder if the nan is bound to an earlier FPE and we should rather fix the root cause.

I don't know if FPEs come from std::log(-ve) giving nan. In the Athena job, I am seeing ~1 FPE (WARNING FPE INVALID in [Execute] of [ActsToTrkConvertorAlg] on event ...) an event, but not for the event that throwed the exception.

#3756 sounds like an excellent idea. I will take a look in detail. Even so, I think we should be protected against nans in this code, as users can pass what they like.

@andiwand
Copy link
Contributor

I think nan inputs we see as a user responsibility but let's also pull in @paulgessinger for this. I would hope that an FPE pops up if a nan is produced in some way

andiwand
andiwand previously approved these changes Oct 29, 2024
@AJPfleger AJPfleger added this to the next milestone Oct 30, 2024
@timadye timadye dismissed andiwand’s stale review October 30, 2024 09:12

The merge-base changed after approval.

Copy link

@kodiakhq kodiakhq bot merged commit 6797a56 into acts-project:main Oct 30, 2024
42 checks passed
@acts-project-service
Copy link
Collaborator

acts-project-service commented Oct 30, 2024

✅ Athena integration test results

✅ All tests successful

status job report
🟢 report_pull_request
🟢 run_art_test: test_run4_acts_vertex_PU200
🟢 run_art_test: test_run4_ttbar_PU200
🟢 run_art_test: test_data18_13TeV_1000evt
🟢 run_art_test: test_ttbarPU40_reco

@paulgessinger
Copy link
Member

Somehow this PR failed physmon on GitLab after having been merged. But is was green here, so it might be a fluke?

@timadye
Copy link
Contributor Author

timadye commented Nov 1, 2024

Somehow #3794's changes were included here and removed from that PR. No harm done.

@paulgessinger paulgessinger modified the milestones: next, v37.4.0, v37.3.0 Nov 8, 2024
Rosie-Hasan pushed a commit to Rosie-Hasan/acts that referenced this pull request Nov 13, 2024
Protect against η=`nan` in `Acts::TrackSelector::isValidTrack()`, which would `throw std::invalid_argument{"Eta is outside the abs eta bin edges"}` exception. This can come about if somehow the track θ<0 or θ>π. We should try to prevent these out-of-range values, but having them shouldn't raise an exception.

Co-authored-by: Paul Gessinger <1058585+paulgessinger@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Core Affects the Core module Track Finding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants