-
Notifications
You must be signed in to change notification settings - Fork 157
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
refactor: Remove globalToLocal log and return actual error message #1310
refactor: Remove globalToLocal log and return actual error message #1310
Conversation
an Acts::Result which can be caught
Codecov Report
@@ Coverage Diff @@
## main #1310 +/- ##
=======================================
Coverage 47.42% 47.43%
=======================================
Files 375 375
Lines 19788 19787 -1
Branches 9287 9285 -2
=======================================
Hits 9385 9385
+ Misses 4021 4020 -1
Partials 6382 6382
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
Should the function not return the error in this case? The way I read the code now, it will just try to continue after the |
Ha, good point... this really must be leftover then from when this piece of code just threw a What is particularly interesting about your comment is that, in the instances where we see this fatal log message come up, the code does continue on without any sort of issue. So apparently this is handled appropriately somewhere - just not right here (as it probably should be) |
While we actually do check that /// Local to global transformation
/// Generalized local to global transformation for the surface types. Since
/// some surface types need the global momentum/direction to resolve sign
/// ambiguity this is also provided
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lposition local 2D position in specialized surface frame
/// @param momentum global 3D momentum representation (optionally ignored)
///
/// @return The global position by value
virtual Vector3 localToGlobal(const GeometryContext& gctx,
const Vector2& lposition,
const Vector3& momentum) const = 0;
/// Global to local transformation
/// Generalized global to local transformation for the surface types. Since
/// some surface types need the global momentum/direction to resolve sign
/// ambiguity this is also provided
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param position global 3D position - considered to be on surface but not
/// inside bounds (check is done)
/// @param momentum global 3D momentum representation (optionally ignored)
/// @param tolerance optional tolerance within which a point is considered
/// valid on surface
///
/// @return a Result<Vector2> which can be !ok() if the operation fails
virtual Result<Vector2> globalToLocal(
const GeometryContext& gctx, const Vector3& position,
const Vector3& momentum,
double tolerance = s_onSurfaceTolerance) const = 0; |
I agree that the In fact I am sure that this FATAL log is actually caught because there are instances where it is thrown for us in a propagation application I wrote, and the code does not crash (whereas it used to crash completely following this FATAL log). |
Sounds good. Can you maybe adjust the PR title and descriptions to reflect the updated nature of the changes? Aside from that lgtm. |
Sure, done. |
This is a very simple PR to change this logging message from
FATAL
level toWARNING
. This is leftover from when theglobalToLocal
function did not return anActs::Result
, so if the transformation failed it was actually fatal. This result can now be passed and caught, thus it isn't necessary to flag it asFATAL
.