Bug #17048
floating point divide by zero in tca:MCSMom
Description
This is spotted in larsoft v06_33_00, but it looks like the code may still be unprotected.
in
larreco/RecoAlg/TCAlg/Utils.cxx
MCSMom can divide by zero if MCSThetaRMS returns zero. MCSThetaRMS can return 0 if this line
if(numPts > 5 && cnt < 0.7 * numPts) return tj.MCSMom;
satisfies the conditions in the if and tj.MCSMom is zero. The divide that fails is this:
double mom = 13.8 * sqrt(tjLen / 14) / MCSThetaRMS(tjs, tj, firstPt, lastPt);
and tjLen is close to zero (1E-315) as well. So it's not a big deal, but if we turn on FP Exceptions,
then 0/0 will cause the program to fault.
Related issues
History
#1 Updated by Gianluca Petrillo over 3 years ago
- Related to Necessary Maintenance #17047: Floating Point Exceptions added
#2 Updated by Bruce Baller over 3 years ago
- % Done changed from 0 to 100
Changed return value from 0 to 1 in MCSThetaRMS if a 0 length trajectory is found.
#3 Updated by Lynn Garren over 3 years ago
- Status changed from New to Resolved
This fix is in the newly built larsoft v06_42_00 release.
#4 Updated by Gianluca Petrillo over 3 years ago
- Related to deleted (Necessary Maintenance #17047: Floating Point Exceptions)
#5 Updated by Gianluca Petrillo over 3 years ago
- Blocked by Necessary Maintenance #17047: Floating Point Exceptions added
#6 Updated by Gianluca Petrillo over 3 years ago
- Blocked by deleted (Necessary Maintenance #17047: Floating Point Exceptions)
#7 Updated by Gianluca Petrillo over 3 years ago
- Blocks Necessary Maintenance #17047: Floating Point Exceptions added
#8 Updated by Thomas Junk over 3 years ago
- Status changed from Resolved to Assigned
I'll change this back to assigned. I reran a dune reconstruction job in
v06_42_00 and got the same FP exception. Putting a tracepoint on line 2036 of larreco/RecoAlg/TCAlg/Utils.cxx shows that just before the FP exception, numPts = 10, cnt = 1, and tj.MCSMom = 0, and the return statement returns zero. Thanks for fixing the other return 0 at the end of that method -- that's probably the source of similar FP divide by zeros.
#9 Updated by Katherine Lato about 3 years ago
- Category set to Reconstruction
- Assignee set to Bruce Baller
- % Done changed from 100 to 50
Bruce,
Can you see if you can find and fix this?
Katherine
#10 Updated by Bruce Baller over 2 years ago
- Status changed from Assigned to Resolved