floating point divide by zero in tca:MCSMom
This is spotted in larsoft v06_33_00, but it looks like the code may still be unprotected.
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.
#8 Updated by Thomas Junk about 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.