-
Notifications
You must be signed in to change notification settings - Fork 178
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: Remove incomplete initialisation from InterpolatedBFieldMap #1467
Conversation
…s. Remove unneeded/misleading partial initialisation.
Label WiP because it may take some time for deal with the fallout from a unit test failure. The ATLAS B-field mostly works fine because the under/overflow bins all have B=(0,0,0). The unit test expects the error, so can be fixed by expecting I think I can work round these issues and improve the unit test for these cases. But maybe this isn't the right way to go about it. Stepping back for a moment, it seems to me that |
Thanks first of all. I don't think the magnetic field interpolation should fail silently in this way, to be honest. If the particle propagation goes out of bounds of the interpolation domain, that's a serious issue. It either means that your field map is not sufficiently large or there's a navigation error for some reason. I would personally prefer encouraging users to fix either the geometry (if that's the source of the navigation issues), fix a bug in the navigation, or explicitly extent the interpolation domain. Thoughts? |
For me, "if it goes out of the bounds of the detector, that's a serious issue". The magnetic field goes on forever! (even if it is 0). In this case, it may have identified an error, but that's using the field map to cross-check the propagation. Perhaps useful, but a bit ugly. Sorry for the philosophy. For my bug (#1484), I'd be happy with anything that gets rid of the GBytes of logfile messages. |
if the overflow was designed for this case I would agree to drop the error in this case. but we should make sure that we still error if there is no overflow value. the underlying problem #1484 looks like a navigation failure to me so if that would be fixed the magnetic field should be fine right? |
While the InterpolatedBField indeed has under and overflow values, we had issues in the past where it went out of bounds and we didn't notice and only after non-negligible debugging did we figure out that was the case. |
Got it, it's here #784 and then I introduced this error mode in #825. I also had some discussion with @HadrienG2 about this in #821. One technical issue is that for the clamped B field to be correct, you'd have to synthesize grid points out of bounds of the grid itself, since the interpolation uses the lower left corner of the grid bin, and the normal neighbor mechanism doesn't return neighbors beyond the overflow bin I don't think. Overall I don't think this is the way to go: in my opinion this should be an explicit and loud error, and either the navigation or the field map should be fixed. If this requires changing the CKF to behave correctly in this case, I think that's what we'll have to do. If we move ahead with this, I think at the very least this PR should roll back all the changes I made back in #825. |
makes sense @paulgessinger but if we do not intend to extrapolate the B field at all the overflow functionality sounds kind of useless to me? if we want to have a defined B fields in case of overflow the more appropriate point to check for navigation failures would be in the navigator IMO. we could require an end of world bounds in the config and check at each iteration if we stepped into the void and error there which would be more explicit |
We use the overflow functionality of Grid in the SurfaceArray. If we can make it optional, that would be a possibility. To your other point: fully agree that ideally the navigation should catch this. Isn't that what the |
you are right |
Sorry, I didn't know that this had already been widely discussed and the current behavior was (fairly) recently introduced. I might have argued for your options 1 or 2, but not sufficiently strongly to warrant reopening the issue. I notice that #825 introduced the initialisation in InterpolatedBFieldMap.hpp line 197:
I think that's a mistake, which I tried to correct in this PR (not yet quite right there). It only initialises the first element of Anyway, I think it would be faster to remove the initialisation, or perhaps safer to use While we are looking here, I see that there may be an optimisation opportunity to replace the |
Hey @timadye, that sounds fair. I think I didn't realize back then that this only initializes the first value. I guess we can just drop the initialization if it's basically guaranteed to be initialized later on. |
This issue/PR has been automatically marked as stale because it has not had recent activity. The stale label will be removed if any interaction occurs. |
how do we move forward with this @paulgessinger @timadye ? |
Good question. On this PR, we can take just the first changed line, removing the incomplete but unneeded initialisation. Should I also add an Probably that is enough for this PR. There was also a potential optimisation opportunity with The point of this PR was to remove all the error messages. I haven't checked recently if they are still there. I guess we can follow that up in #1484, but that issue is also stale. |
Codecov Report
@@ Coverage Diff @@
## main #1467 +/- ##
==========================================
- Coverage 49.32% 49.31% -0.01%
==========================================
Files 441 441
Lines 25208 25209 +1
Branches 11626 11627 +1
==========================================
Hits 12433 12433
Misses 4513 4513
- Partials 8262 8263 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
📊 Physics performance monitoring for a9a4042Summary VertexingSeedingCKFAmbiguity resolutionTruth tracking (Kalman Filter)Truth tracking (GSF) |
std::array<Vector3, 8> neighbors{Vector3{0.0, 0.0, 0.0}};
only initialises the first element of thestd::array
.assert
ifneighbors
array
not fully filled.Originally "fix: B-field interpolation errors", but this PR no longer provides a fix to the following problem.
InterpolatedBFieldMap
boundary check. Instead, use the under/overflow bins to return the B-field outside the grid.full_chain_itk.py
ttbar+PU200), with each error generating 2 error messages (one quite verbose) and 4 warnings.