CalDet<TPCPadFlags>: Protect against invalid reads #14855
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A continuation of the CalDet saga, possibly related to https://its.cern.ch/jira/browse/O2-4671
Tests on ARM, even after deployment of the custom streamer in #14830, still showed segfaults in TPC digitization.
With the relevant code isolated into a unit test in #14850, it was possible to do a valgrind study. This showed Invalid reads to the mData of CalArray.
Thereafter, putting assert statements showed that we often access CalArray data slightly out of bounds - irrespective of custom streamer or not. This then either indicates a problem in the code logic or a problem with the calibration CCDB objects. This should clearly be fixed.
In the meantime, this commit adds a protection against invalid accesses and returns a trivial answer as well as an error message. This is in any case better than undefined behaviour.
In addition, this commit introduces possibility to switch off the custom streamer for further studies.