Skip to content

Commit

Permalink
Modified range check to improve code speed. Refs #4208.
Browse files Browse the repository at this point in the history
Since the events and x-axis are ordered, don't check for the next event having
a small x-value than the previous.
  • Loading branch information
peterfpeterson committed Dec 1, 2011
1 parent fc391fb commit 9790ab1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Code/Mantid/Framework/DataObjects/src/EventList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1737,8 +1737,9 @@ namespace DataObjects
tof = itev->tof();
while (bin < x_size-1)
{
//Within range?
if ((tof >= X[bin]) && (tof < X[bin+1]))
//Within range? Since both events and X are sorted, they are going to have
// tof >= X[bin] because the previous event was.
if (tof < X[bin+1])
{
//Add up the weight (convert to double before adding, to preserve precision)
Y[bin] += double(itev->m_weight);
Expand Down

0 comments on commit 9790ab1

Please sign in to comment.