Skip to content

Adding "safe-guards" to avoid segfault in the GaussHitFinderSBN module#659

Draft
mattiasotgia wants to merge 3 commits into
developfrom
feature/msotgia_hit_finder_tuning_fix
Draft

Adding "safe-guards" to avoid segfault in the GaussHitFinderSBN module#659
mattiasotgia wants to merge 3 commits into
developfrom
feature/msotgia_hit_finder_tuning_fix

Conversation

@mattiasotgia

Copy link
Copy Markdown

The issue

The introduction of the NextADCThreshold parameter in LArSoft/larreco#92 highlighted some minor bugs in the GaussHitFinderSBN module that made the code segfault for some edge case.

This PR aims at adding some safeguards to the code preventing the segfault to happen.

Description

The changes happens in three points of the code

  1. After the peakFitterTool returns the peak parameters for each "candidate hit". Here we added a check for all "not finite" bounds, whereas the old version of the code was only checking for the positive side. Since the $\chi^2/\mathrm{ndf}$ is computed from all the fitted hits, $-\infty$ values were possible, and treated as "not pathological". This fixes those cases.
  2. After all candidates have been fitted and failed fits treated accordingly, when computing the boundaries of the hits we added a check (line 501) making sure the start/end points where still withing the ROI range.
  3. Finally after all the safe-guards at the end of the module are applied, we make sure (line 555) that no "boundary flip" has happened (i.e. start > end)

@mattiasotgia mattiasotgia self-assigned this Jul 3, 2026
@mattiasotgia mattiasotgia added bug Something isn't working bugfix Addresses one or more bugs labels Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working bugfix Addresses one or more bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant