Commit 7426d777 authored by Owen Arnold's avatar Owen Arnold
Browse files

refs #21334 Use tube tips to calculate bounding box.

parent 9cf4020e
......@@ -2,17 +2,22 @@
#define MANTID_DATAOBJECTS_PEAK_H_
#include "MantidGeometry/Crystal/IPeak.h"
#include "MantidGeometry/Crystal/PeakShape.h"
#include "MantidGeometry/Instrument.h"
#include "MantidKernel/Logger.h"
#include "MantidKernel/Matrix.h"
#include "MantidKernel/V3D.h"
#include "MantidKernel/PhysicalConstants.h"
#include "MantidKernel/System.h"
#include "MantidGeometry/Crystal/PeakShape.h"
#include <boost/shared_ptr.hpp>
#include "MantidKernel/V3D.h"
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
namespace Mantid {
namespace Geometry {
class InstrumentRayTracer;
}
namespace DataObjects {
/** Structure describing a single-crystal peak
......@@ -46,16 +51,16 @@ public:
/// Copy constructor
Peak(const Peak &other);
// MSVC 2015/17 can build with noexcept = default however
// intellisense still incorrectly reports this as an error despite compiling.
// https://connect.microsoft.com/VisualStudio/feedback/details/1795240/visual-c-2015-default-move-constructor-and-noexcept-keyword-bug
// For that reason we still use the supplied default which should be noexcept
// once the above is fixed we can remove this workaround
// MSVC 2015/17 can build with noexcept = default however
// intellisense still incorrectly reports this as an error despite compiling.
// https://connect.microsoft.com/VisualStudio/feedback/details/1795240/visual-c-2015-default-move-constructor-and-noexcept-keyword-bug
// For that reason we still use the supplied default which should be noexcept
// once the above is fixed we can remove this workaround
#if defined(_MSC_VER) && _MSC_VER <= 1910
Peak(Peak &&) = default;
Peak &operator=(Peak &&) = default;
#elif((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8))
#elif ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8))
// The noexcept default declaration was fixed in GCC 4.9.0
// so for versions 4.8.x and below use default only
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53903
......@@ -81,6 +86,7 @@ public:
Geometry::Instrument_const_sptr getInstrument() const override;
bool findDetector() override;
bool findDetector(const Geometry::InstrumentRayTracer &tracer);
int getRunNumber() const override;
void setRunNumber(int m_runNumber) override;
......@@ -164,7 +170,8 @@ public:
Kernel::V3D getVirtualDetectorPosition(const Kernel::V3D &detectorDir) const;
private:
bool findDetector(const Mantid::Kernel::V3D &beam);
bool findDetector(const Mantid::Kernel::V3D &beam,
const Geometry::InstrumentRayTracer &tracer);
/// Shared pointer to the instrument (for calculating some values )
Geometry::Instrument_const_sptr m_inst;
......@@ -246,7 +253,7 @@ private:
std::string convention;
};
} // namespace Mantid
} // namespace DataObjects
} // namespace Mantid
#endif /* MANTID_DATAOBJECTS_PEAK_H_ */
......@@ -13,6 +13,7 @@
#include <algorithm>
#include <cctype>
#include <string>
#include <valgrind/callgrind.h>
using namespace Mantid;
using namespace Mantid::Kernel;
......@@ -587,7 +588,8 @@ void Peak::setQLabFrame(const Mantid::Kernel::V3D &QLabFrame,
// client seems to know better.
} else {
// Find the detector
const bool found = findDetector(detectorDir);
InstrumentRayTracer tracer(m_inst);
const bool found = findDetector(detectorDir, tracer);
if (!found) {
// This is important, so we ought to log when this fails to happen.
g_log.debug("Could not find detector after setting qLab via setQLab with "
......@@ -623,12 +625,18 @@ V3D Peak::getVirtualDetectorPosition(const V3D &detectorDir) const {
* @return true if the detector ID was found.
*/
bool Peak::findDetector() {
InstrumentRayTracer tracer(m_inst);
return findDetector(tracer);
}
bool Peak::findDetector(const InstrumentRayTracer &tracer) {
CALLGRIND_START_INSTRUMENTATION;
// Scattered beam direction
V3D beam = detPos - samplePos;
beam.normalize();
return findDetector(beam);
return findDetector(beam, tracer);
CALLGRIND_STOP_INSTRUMENTATION;
}
/**
......@@ -637,12 +645,12 @@ bool Peak::findDetector() {
* @param beam : detector direction from the sample as V3D
* @return True if a detector has been found
*/
bool Peak::findDetector(const Mantid::Kernel::V3D &beam) {
bool Peak::findDetector(const Mantid::Kernel::V3D &beam,
const InstrumentRayTracer &tracer) {
bool found = false;
// Create a ray tracer
InstrumentRayTracer tracker(m_inst);
tracker.traceFromSample(beam);
IDetector_const_sptr det = tracker.getDetectorResult();
tracer.traceFromSample(beam);
IDetector_const_sptr det = tracer.getDetectorResult();
if (det) {
// Set the detector ID, the row, col, etc.
this->setDetectorID(det->getID());
......@@ -663,11 +671,11 @@ bool Peak::findDetector(const Mantid::Kernel::V3D &beam) {
V3D gapDir = V3D(0., 0., 0.);
gapDir[i] = gap;
V3D beam1 = beam + gapDir;
tracker.traceFromSample(beam1);
IDetector_const_sptr det1 = tracker.getDetectorResult();
tracer.traceFromSample(beam1);
IDetector_const_sptr det1 = tracer.getDetectorResult();
V3D beam2 = beam - gapDir;
tracker.traceFromSample(beam2);
IDetector_const_sptr det2 = tracker.getDetectorResult();
tracer.traceFromSample(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()));
......@@ -843,8 +851,8 @@ std::string Peak::getBankName() const { return m_bankName; }
// -------------------------------------------------------------------------------------
/** For RectangularDetectors only, returns the row (y) of the pixel of the
* detector.
* Returns -1 if it could not find it. */
* detector.
* Returns -1 if it could not find it. */
int Peak::getRow() const { return m_row; }
// -------------------------------------------------------------------------------------
......@@ -1003,5 +1011,5 @@ Mantid::Kernel::V3D Peak::getDetectorPosition() const {
Mantid::Kernel::Logger Peak::g_log("PeakLogger");
} // namespace Mantid
} // namespace DataObjects
} // namespace Mantid
......@@ -45,8 +45,10 @@ public:
registerGenericObjComponent(const IObjComponent &objComponent) = 0;
virtual size_t registerDetector(const IDetector &detector) = 0;
virtual size_t registerStructuredBank(const ICompAssembly &bank) = 0;
virtual size_t registerBankOfTubes(const ICompAssembly &bank) = 0;
virtual size_t registerTube(const ICompAssembly &tube) = 0;
virtual ~ComponentVisitor() {}
};
}
}
} // namespace Geometry
} // namespace Mantid
#endif
......@@ -164,6 +164,11 @@ public:
virtual size_t
registerStructuredBank(const Mantid::Geometry::ICompAssembly &bank) override;
virtual size_t
registerBankOfTubes(const Mantid::Geometry::ICompAssembly &bank) override;
virtual size_t registerTube(const ICompAssembly &tube) override;
virtual size_t
registerDetector(const Mantid::Geometry::IDetector &detector) override;
......
......@@ -7,6 +7,7 @@
#include "MantidGeometry/Instrument/StructuredDetector.h"
#include "MantidGeometry/Objects/BoundingBox.h"
#include <algorithm>
#include <boost/regex.hpp>
#include <ostream>
#include <stdexcept>
......@@ -490,8 +491,12 @@ Quat CompAssembly::getRotation() const {
}
size_t CompAssembly::registerContents(ComponentVisitor &visitor) const {
if (this->getName() == "sixteenpack") {
return visitor.registerStructuredBank(*this);
using boost::regex;
const auto name = this->getName();
if (boost::regex_match(name, regex(".+pack$", regex::icase))) {
return visitor.registerBankOfTubes(*this);
} else if (boost::regex_match(name, regex("^tube.+", regex::icase))) {
return visitor.registerTube(*this);
}
return visitor.registerComponentAssembly(*this);
}
......
......@@ -340,6 +340,36 @@ BoundingBox ComponentInfo::boundingBox(const size_t componentIndex,
// Skip all sub components.
detExclusions.emplace(std::make_pair(bottomLeft, topRight));
compIterator = innerRangeComp.rend();
} else if (componentFlag(index) == Beamline::ComponentType::BankOfTube) {
auto innerRangeComp = m_componentInfo->componentRangeInSubtree(index);
// nSubComponents, subtract off self hence -1. nSubComponents = number of
// horizontal columns.
auto nSubComponents = innerRangeComp.end() - innerRangeComp.begin() - 1;
auto innerRangeDet = m_componentInfo->detectorRangeInSubtree(index);
auto nSubDetectors =
std::distance(innerRangeDet.begin(), innerRangeDet.end());
auto nY = nSubDetectors / nSubComponents;
size_t bottomIndex = *innerRangeDet.begin();
size_t lastIndex = *(innerRangeDet.end() - 1);
while (bottomIndex < lastIndex) {
auto topIndex = bottomIndex + (nY - 1);
absoluteBB.grow(componentBoundingBox(bottomIndex, reference));
absoluteBB.grow(componentBoundingBox(topIndex, reference));
bottomIndex += nY;
}
detExclusions.emplace(
std::make_pair(*innerRangeDet.begin(), *(innerRangeDet.end() - 1)));
compIterator = innerRangeComp.rend();
} else if (componentFlag(index) == Beamline::ComponentType::Tube) {
auto rangeDet = m_componentInfo->detectorRangeInSubtree(componentIndex);
if (!rangeDet.empty()) {
auto startIndex = *rangeDet.begin();
auto endIndex = *(rangeDet.end() - 1);
absoluteBB.grow(componentBoundingBox(startIndex, reference));
absoluteBB.grow(componentBoundingBox(endIndex, reference));
detExclusions.emplace(std::make_pair(startIndex, endIndex));
}
++compIterator;
} else {
absoluteBB.grow(componentBoundingBox(index, reference));
++compIterator;
......
......@@ -216,7 +216,7 @@ size_t InstrumentVisitor::registerGenericObjComponent(
}
/**
* @brief InstrumentVisitor::registerStructuredBank
* Register a structured bank
* @param bank : Rectangular Detector
* @return
*/
......@@ -227,6 +227,30 @@ size_t InstrumentVisitor::registerStructuredBank(const ICompAssembly &bank) {
return index;
}
/**
* Register a bank of tubes
* @param bank : bank of tubes
* @return
*/
size_t InstrumentVisitor::registerBankOfTubes(const ICompAssembly &bank) {
auto index = registerComponentAssembly(bank);
size_t rangesIndex = index - m_orderedDetectorIds->size();
(*m_componentTypeFlag)[rangesIndex] = Beamline::ComponentType::BankOfTube;
return index;
}
/**
* Register a Tube
* @param tube : Individual tube component assembly
* @return
*/
size_t InstrumentVisitor::registerTube(const ICompAssembly &tube) {
auto index = registerComponentAssembly(tube);
size_t rangesIndex = index - m_orderedDetectorIds->size();
(*m_componentTypeFlag)[rangesIndex] = Beamline::ComponentType::Tube;
return index;
}
void InstrumentVisitor::markAsSourceOrSample(ComponentID componentId,
const size_t componentIndex) {
if (componentId == m_sampleId) {
......
......@@ -8,6 +8,7 @@
#include "MantidKernel/Logger.h"
#include "MantidKernel/Matrix.h"
#include <algorithm>
#include <boost/regex.hpp>
#include <iostream>
#include <ostream>
#include <stdexcept>
......@@ -18,9 +19,9 @@ Mantid::Kernel::Logger g_log("ObjCompAssembly");
namespace Mantid {
namespace Geometry {
using Kernel::V3D;
using Kernel::Quat;
using Kernel::DblMatrix;
using Kernel::Quat;
using Kernel::V3D;
/// Void deleter for shared pointers
class NoDeleting {
......@@ -238,12 +239,12 @@ void ObjCompAssembly::getChildren(std::vector<IComponent_const_sptr> &outVector,
}
/**
* Find a component by name.
* @param cname :: The name of the component. If there are multiple matches, the
* first one found is returned.
* @param nlevels :: Optional argument to limit number of levels searched.
* @returns A shared pointer to the component
*/
* Find a component by name.
* @param cname :: The name of the component. If there are multiple matches, the
* first one found is returned.
* @param nlevels :: Optional argument to limit number of levels searched.
* @returns A shared pointer to the component
*/
boost::shared_ptr<const IComponent>
ObjCompAssembly::getComponentByName(const std::string &cname,
int nlevels) const {
......@@ -357,6 +358,11 @@ void ObjCompAssembly::testIntersectionWithChildren(
size_t ObjCompAssembly::registerContents(
Mantid::Geometry::ComponentVisitor &visitor) const {
using boost::regex;
const auto name = this->getName();
if (boost::regex_match(name, regex("^tube.+", regex::icase))) {
return visitor.registerTube(*this);
}
return visitor.registerComponentAssembly(*this);
}
......
......@@ -423,7 +423,7 @@ public:
instrument.markAsSource(source);
// A sample
ObjComponent *sample = new ObjComponent("some-surface-holder");
ObjComponent *sample = new ObjComponent("some-surfbankNameace-holder");
sample->setPos(V3D{0, 0, 0});
sample->setShape(
ComponentCreationHelper::createSphere(0.01 /*1cm*/, V3D(0, 0, 0), "1"));
......@@ -476,6 +476,136 @@ public:
boundingBoxBank2.minPoint().Y(), 1e-9);
}
void test_boundingBox_with_regular_bank_of_tubes() {
size_t nTubes = 4;
size_t nDetectorsPerTube = 10;
std::vector<double> offsets(4, 0); // No offsets in tubes
double width = 10;
double height = 12;
auto pixelHeight = height / static_cast<double>(nDetectorsPerTube);
auto pixelWidth = width / static_cast<double>(nTubes);
double minYCenter = -height / 2;
double maxYCenter =
minYCenter + (static_cast<double>(nDetectorsPerTube) - 1) * pixelHeight;
double minXCenter = -width / 2;
double maxXCenter =
minXCenter + (static_cast<double>(nTubes) - 1) * pixelWidth;
auto instrument = ComponentCreationHelper::
createCylInstrumentWithVerticalOffsetsSpecified(
nTubes, offsets, nDetectorsPerTube, -width / 2, width / 2,
-height / 2, height / 2);
auto wrappers = InstrumentVisitor::makeWrappers(*instrument);
const auto &componentInfo = std::get<0>(wrappers);
size_t bankOfTubesIndex = componentInfo->root() - 3;
TS_ASSERT_EQUALS(componentInfo->componentFlag(bankOfTubesIndex),
Beamline::ComponentType::BankOfTube); // Sanity check
auto boundingBox = componentInfo->boundingBox(bankOfTubesIndex);
TS_ASSERT_DELTA(boundingBox.minPoint().Y(), minYCenter - pixelHeight / 2,
1e-6);
TS_ASSERT_DELTA(boundingBox.maxPoint().Y(), maxYCenter + pixelHeight / 2,
1e-6);
TS_ASSERT_DELTA(boundingBox.minPoint().Z(),
componentInfo->position(0).Z() - pixelWidth / 2, 1e-6);
TS_ASSERT_DELTA(boundingBox.maxPoint().Z(),
componentInfo->position(0).Z() + pixelWidth / 2, 1e-6);
TS_ASSERT_DELTA(boundingBox.minPoint().X(), minXCenter - pixelWidth / 2,
1e-6);
TS_ASSERT_DELTA(boundingBox.maxPoint().X(), maxXCenter + pixelWidth / 2,
1e-6);
}
void test_boundingBox_with_irregular_bank_of_tubes() {
size_t nTubes = 4;
size_t nDetectorsPerTube = 10;
std::vector<double> offsets{
0, 0, 1.2, -0.3}; // one tube offset by +1.2, another by -0.3
double width = 10;
double height = 12;
auto pixelHeight = height / static_cast<double>(nDetectorsPerTube);
auto pixelWidth = width / static_cast<double>(nTubes);
double minYCenter = -height / 2;
double maxYCenter =
minYCenter + (static_cast<double>(nDetectorsPerTube) - 1) * pixelHeight;
double minXCenter = -width / 2;
double maxXCenter =
minXCenter + (static_cast<double>(nTubes) - 1) * pixelWidth;
auto instrument = ComponentCreationHelper::
createCylInstrumentWithVerticalOffsetsSpecified(
nTubes, offsets, nDetectorsPerTube, -width / 2, width / 2,
-height / 2, height / 2);
auto wrappers = InstrumentVisitor::makeWrappers(*instrument);
const auto &componentInfo = std::get<0>(wrappers);
size_t bankOfTubesIndex = componentInfo->root() - 3;
TS_ASSERT_EQUALS(componentInfo->componentFlag(bankOfTubesIndex),
Beamline::ComponentType::BankOfTube); // Sanity check
auto boundingBox = componentInfo->boundingBox(bankOfTubesIndex);
TS_ASSERT_DELTA(boundingBox.minPoint().Y(),
minYCenter - pixelHeight / 2 + offsets[3],
1e-6); // Offset controls max Y
TS_ASSERT_DELTA(boundingBox.maxPoint().Y(),
maxYCenter + pixelHeight / 2 + offsets[2],
1e-6); // Offset controls min Y
TS_ASSERT_DELTA(boundingBox.minPoint().Z(),
componentInfo->position(0).Z() - pixelWidth / 2, 1e-6);
TS_ASSERT_DELTA(boundingBox.maxPoint().Z(),
componentInfo->position(0).Z() + pixelWidth / 2, 1e-6);
TS_ASSERT_DELTA(boundingBox.minPoint().X(), minXCenter - pixelWidth / 2,
1e-6);
TS_ASSERT_DELTA(boundingBox.maxPoint().X(), maxXCenter + pixelWidth / 2,
1e-6);
}
void test_tube_bounding_box() {
size_t nTubes = 2;
size_t nDetectorsPerTube = 5;
std::vector<double> offsets{
0.1, -0.2}; // Just two tubes one offset up the other one down
double width = 2;
double height = 10;
auto pixelHeight = height / static_cast<double>(nDetectorsPerTube);
double minYCenter = -height / 2;
double maxYCenter =
minYCenter + (static_cast<double>(nDetectorsPerTube) - 1) * pixelHeight;
auto instrument = ComponentCreationHelper::
createCylInstrumentWithVerticalOffsetsSpecified(
nTubes, offsets, nDetectorsPerTube, -width / 2, width / 2,
-height / 2, height / 2);
auto wrappers = InstrumentVisitor::makeWrappers(*instrument);
const auto &componentInfo = std::get<0>(wrappers);
size_t tube1Index = componentInfo->root() - 5;
TS_ASSERT_EQUALS(componentInfo->componentFlag(tube1Index),
Beamline::ComponentType::Tube); // Sanity check
size_t tube2Index = componentInfo->root() - 4;
TS_ASSERT_EQUALS(componentInfo->componentFlag(tube2Index),
Beamline::ComponentType::Tube); // Sanity check
auto boundingBox = componentInfo->boundingBox(tube1Index);
TS_ASSERT_DELTA(boundingBox.minPoint().Y(),
minYCenter - pixelHeight / 2 + offsets[0],
1e-6); // Offset controls max Y
TS_ASSERT_DELTA(boundingBox.maxPoint().Y(),
maxYCenter + pixelHeight / 2 + offsets[0],
1e-6); // Offset controls min Y
boundingBox = componentInfo->boundingBox(tube2Index);
TS_ASSERT_DELTA(boundingBox.minPoint().Y(),
minYCenter - pixelHeight / 2 + offsets[1],
1e-6); // Offset controls max Y
TS_ASSERT_DELTA(boundingBox.maxPoint().Y(),
maxYCenter + pixelHeight / 2 + offsets[1],
1e-6); // Offset controls min Y
}
void test_scanning_non_bank_throws() {
const V3D sourcePos(-1, 0, 0);
const V3D samplePos(0, 0, 0);
......
......@@ -13,6 +13,9 @@
#include "MantidKernel/V3D.h"
namespace Mantid {
namespace Geometry {
class InstrumentRayTracer;
}
namespace MDAlgorithms {
/** FindPeaksMD : TODO: DESCRIPTION
......@@ -51,11 +54,13 @@ private:
const Mantid::API::IMDWorkspace_sptr &ws);
/// Adds a peak based on Q, bin count & a set of detector IDs
void addPeak(const Mantid::Kernel::V3D &Q, const double binCount);
void addPeak(const Mantid::Kernel::V3D &Q, const double binCount,
const Geometry::InstrumentRayTracer &tracer);
/// Adds a peak based on Q, bin count
boost::shared_ptr<DataObjects::Peak> createPeak(const Mantid::Kernel::V3D &Q,
const double binCount);
boost::shared_ptr<DataObjects::Peak>
createPeak(const Mantid::Kernel::V3D &Q, const double binCount,
const Geometry::InstrumentRayTracer &tracer);
/// Run find peaks on an MDEventWorkspace
template <typename MDE, size_t nd>
......@@ -110,7 +115,7 @@ private:
static const std::string numberOfEventsNormalization;
};
} // namespace MDAlgorithms
} // namespace Mantid
} // namespace DataObjects
#endif /* MANTID_MDALGORITHMS_FINDPEAKSMD_H_ */
......@@ -4,6 +4,7 @@
#include "MantidDataObjects/MDHistoWorkspace.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidGeometry/Crystal/EdgePixel.h"
#include "MantidGeometry/Objects/InstrumentRayTracer.h"
#include "MantidKernel/BoundedValidator.h"
#include "MantidKernel/EnabledWhenProperty.h"
#include "MantidKernel/ListValidator.h"
......@@ -98,7 +99,7 @@ void addDetectors(DataObjects::Peak &peak, MDBoxBase<MDE, nd> &box) {
// Compile time deduction of the correct function call
addDetectors(peak, box, IsFullEvent<MDE, nd>());
}
}
} // namespace
// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(FindPeaksMD)
......@@ -243,9 +244,10 @@ void FindPeaksMD::readExperimentInfo(const ExperimentInfo_sptr &ei,
* @param Q :: Q_lab or Q_sample, depending on workspace
* @param binCount :: bin count to give to the peak.
*/
void FindPeaksMD::addPeak(const V3D &Q, const double binCount) {
void FindPeaksMD::addPeak(const V3D &Q, const double binCount,
const Geometry::InstrumentRayTracer &tracer) {
try {
auto p = this->createPeak(Q, binCount);
auto p = this->createPeak(Q, binCount, tracer);
if (m_edge > 0) {
if (edgePixel(inst, p->getBankName(), p->getCol(), p->getRow(), m_edge))
return;
......@@ -262,7 +264,8 @@ void FindPeaksMD::addPeak(const V3D &Q, const double binCount) {
* Creates a Peak object from Q & bin count
* */
boost::shared_ptr<DataObjects::Peak>
FindPeaksMD::createPeak(const Mantid::Kernel::V3D &Q, const double binCount) {
FindPeaksMD::createPeak(const Mantid::Kernel::V3D &Q, const double binCount,
const Geometry::InstrumentRayTracer &tracer) {
boost::shared_ptr<DataObjects::Peak> p;
if (dimType == QLAB) {
// Build using the Q-lab-frame constructor
......@@ -278,7 +281,7 @@ FindPeaksMD::createPeak(const Mantid::Kernel::V3D &Q, const double binCount) {
}
try { // Look for a detector
p->findDetector();
p->findDetector(tracer);
} catch (...) { /* Ignore errors in ray-tracer */
}
......@@ -322,6 +325,8 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace<MDE, nd>::sptr ws) {
for (uint16_t iexp = 0; iexp < ws->getNumExperimentInfo(); iexp++) {
ExperimentInfo_sptr ei = ws->getExperimentInfo(iexp);
this->readExperimentInfo(ei, boost::dynamic_pointer_cast<IMDWorkspace>(ws));
Geometry::InstrumentRayTracer tracer(inst);
// Copy the instrument, sample, run to the peaks workspace.
peakWS->copyExperimentInfoFrom(ei.get());
......@@ -447,13 +452,14 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace<MDE, nd>::sptr ws) {
if (nexp > 1) {
MDBox<MDE, nd> *mdbox = dynamic_cast<MDBox<MDE, nd> *>(box);
typename std::vector<MDE> &events = mdbox->getEvents();
if (std::none_of(events.cbegin(), events.cend(), [&iexp, &nexp](
MDE event) {
return event.getRunIndex() == iexp || event.getRunIndex() >= nexp;
}))
if (std::none_of(events.cbegin(), events.cend(),
[&iexp, &nexp](MDE event) {
return event.getRunIndex() == iexp ||
event.getRunIndex() >= nexp;
}))
continue;
}
// The center of the box = Q in the lab frame
// The center of the box = Q in the lab frame
#ifndef MDBOX_TRACK_CENTROID
coord_t boxCenter