Bug #19935
Use of std::nearbyint in Utils.cxx
Start date:
05/13/2018
Due date:
% Done:
0%
Estimated time:
Description
There are several places in Utils.cxx that use std::nearbyint. Here is one example around line 3410:
// next make TPs on the wires that don't have real TPs TrajPoint ltp; // put ltp at the vertex position with direction towards the end point MakeBareTrajPoint(vx2.Pos, tj.Pts[tj.EndPt[end]].Pos, ltp); if(ltp.Dir[0] == 0) continue; unsigned int wire = std::nearbyint(ltp.Pos[0]); ltp.Chg = 0; unsigned short indx = wire - loWire; // Break if we found a real TP if(tjpt[indx].Chg == 0) tjpt[indx] = ltp;
In one event,
ltp.Pos[0]
is negative (-0.642913) and wire
was assigned the maximal unsigned integer value 4294967295.
We need to review the code and protect against the case where Pos
is negative.
History
#1 Updated by Tingjun Yang almost 3 years ago
Hi Bruce,
I saw you pushed lots of changes today. Did you fix this problem?
Do you need an example to test it?
Thanks,
Tingjun
#2 Updated by Tingjun Yang almost 3 years ago
- Status changed from New to Resolved
- Assignee set to Bruce Baller
I confirm this problem is fixed. Thanks, Bruce.