Conversation
…, shadowing, dead code Agent-Logs-Url: https://github.com/Mu2e/Offline/sessions/f9f302df-5ed3-439e-8046-3c5c0c6a940e Co-authored-by: oksuzian <48927306+oksuzian@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Mu2e/Offline/sessions/f9f302df-5ed3-439e-8046-3c5c0c6a940e Co-authored-by: oksuzian <48927306+oksuzian@users.noreply.github.com>
|
Hi @Copilot,
which require these tests: build. @Mu2e/write, @Mu2e/fnalbuild-users have access to CI actions on main. 📝 The author of this pull request is not a member of the Mu2e github organisation. |
brownd1978
left a comment
There was a problem hiding this comment.
These look correct or innocuous.
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for 8fd3bcf: build (Build queue - API unavailable) |
|
☀️ The build tests passed at 8fd3bcf.
N.B. These results were obtained from a build of this Pull Request at 8fd3bcf after being merged into the base branch at e229837. For more information, please check the job page here. |
Summary
Fixes critical and high-severity bugs in TrkReco identified during code review.
Critical Fixes
break→continuein track matching loopsFiles:
SelectReflections_module.cc:98,SelectSameTrack_module.cc:116Both modules had
breakinstead ofcontinuewhen no intersection was found for a track. The comment says "skip testing for a match with this track", butbreakterminates the entire outer loop over all tracks, silently skipping all remaining candidates. Changed tocontinueto correctly advance to the next track.Missing histogram bounds check in
initFZ_2()File:
RobustHelixFit.cc:580The histogram
hist[20]fill loop computedbin = (x-minX)/stepXwithout bounds checking. The physics range[_mindfdz, _maxdfdz]is user-configurable via fcl but the histogram parameters are hardcoded, creating a fragile coupling that could lead to out-of-bounds writes. Addedif(bin >= 0 && bin < int(nbinsX))guard.High-Severity Fixes
Division by zero guards
SimpleKalSeedSelector_tool.cc:32: When both tracks have zero active hits,ntest + ncurrent == 0produces NaN. Added early fallback to fit consistency comparison.SelectSameTrack_module.cc:147: Whenprihitsis empty,nover/prihits.size()divides by zero. Addedif(prihits.empty()) continue;guard before the overlap computation.TrkUtilities.cc:50:overlap(SHIV)divides bymin(size1, size2)which is 0 when either vector is empty. Added early return of 0.0.Medium-Severity Fixes
TrackMatching_module.cc:201: Renamed innerntrkstontrks_handleto avoid shadowing the outerntrksused for validation.SelectReflections_module.cc:133,SelectSameTrack_module.cc:165: Changednumeric_limits<float>::max()tonumeric_limits<double>::max()to match thedoublevariable type.RobustHelixFinderData.cc:66-70: Removed duplicate assignments of_nStrawHits,_nComboHits,_nFiltComboHits,_nFiltStrawHitsinclearTempVariables().Files Changed
TrkReco/src/SelectReflections_module.ccTrkReco/src/SelectSameTrack_module.ccTrkReco/src/SimpleKalSeedSelector_tool.ccTrkReco/src/TrkUtilities.ccTrkReco/src/TrackMatching_module.ccTrkReco/src/RobustHelixFit.ccTrkReco/src/RobustHelixFinderData.cc