Commit cfee308a authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Ensure vector is unit in length before resetting Track

It's possible that rounding errors introduce a small
difference that throws the check in Track::reset.
Refs #26690
parent d058dfe8
......@@ -699,15 +699,14 @@ bool Peak::findDetector(const Mantid::Kernel::V3D &beam,
V3D gapDir;
gapDir[i] = gap;
V3D beam1 = beam + gapDir;
tracer.traceFromSample(beam1);
tracer.traceFromSample(normalize(beam1));
IDetector_const_sptr det1 = tracer.getDetectorResult();
V3D beam2 = beam - gapDir;
tracer.traceFromSample(beam2);
tracer.traceFromSample(normalize(beam2));
IDetector_const_sptr det2 = tracer.getDetectorResult();
if (det1 && det2) {
// Set the detector ID to one of the neighboring pixels
this->setDetectorID(static_cast<int>(det1->getID()));
;
detPos = det1->getPos();
found = true;
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment