diff --git a/Framework/API/inc/MantidAPI/MatrixWorkspace.h b/Framework/API/inc/MantidAPI/MatrixWorkspace.h index 86797a44b8448ab10d99855999cc1f07d4f07aad..b343553b021140b7823673f2b5fbb383d74c3b55 100644 --- a/Framework/API/inc/MantidAPI/MatrixWorkspace.h +++ b/Framework/API/inc/MantidAPI/MatrixWorkspace.h @@ -514,20 +514,19 @@ public: // Check if this class has an oriented lattice on a sample object virtual bool hasOrientedLattice() const override; - virtual std::pair<size_t, size_t> find(double value) - : + virtual std::pair<int64_t, int64_t> find(double value) const; - //===================================================================================== - // End IMDWorkspace methods - //===================================================================================== + //===================================================================================== + // End IMDWorkspace methods + //===================================================================================== - //===================================================================================== - // Image methods - //===================================================================================== + //===================================================================================== + // Image methods + //===================================================================================== - /// Get start and end x indices for images - std::pair<size_t, size_t> getImageStartEndXIndices( - size_t i, double startX, double endX) const; + /// Get start and end x indices for images + std::pair<size_t, size_t> getImageStartEndXIndices(size_t i, double startX, + double endX) const; /// Create an image of Ys. MantidImage_sptr getImageY(size_t start = 0, size_t stop = 0, size_t width = 0, double startX = EMPTY_DBL(), diff --git a/Framework/API/src/MatrixWorkspace.cpp b/Framework/API/src/MatrixWorkspace.cpp index db16ee2f87d14fc9d0a511a2ba8f360b9b01394f..8e6306c4eb03f544a1046cbbb297594293383108 100644 --- a/Framework/API/src/MatrixWorkspace.cpp +++ b/Framework/API/src/MatrixWorkspace.cpp @@ -1931,14 +1931,13 @@ MantidImage_sptr MatrixWorkspace::getImage( return image; } -std::pair<size_t, size_t> MatrixWorkspace::find(double value) { - std::pair<size_t, size_t> out(-1, -1); - const int64_t numHists = - static_cast<int64_t>(inputWorkspace->getNumberHistograms()); +std::pair<int64_t, int64_t> MatrixWorkspace::find(double value) const { + std::pair<int64_t, int64_t> out(-1, -1); + const int64_t numHists = static_cast<int64_t>(this->getNumberHistograms()); for (int64_t i = 0; i < numHists; ++i) { - const auto &Y = inputEventWorkspace->y(i); - if (auto it = std::find(Y.begin(), Y.end(), 0.), it != Y.end()) { - out = {i, std::distance(Y.begin().it)}; + const auto &Y = this->y(i); + if (auto it = std::find(Y.begin(), Y.end(), value); it != Y.end()) { + out = {i, std::distance(Y.begin(), it)}; break; } } diff --git a/Framework/Algorithms/src/SetUncertainties.cpp b/Framework/Algorithms/src/SetUncertainties.cpp index 8719ed72067118f56605a8c70276e64fe60d1830..71e36b28e9bf01829dc40944e07ccb0de734c024 100644 --- a/Framework/Algorithms/src/SetUncertainties.cpp +++ b/Framework/Algorithms/src/SetUncertainties.cpp @@ -7,6 +7,7 @@ #include "MantidAlgorithms/SetUncertainties.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/SpectrumInfo.h" +#include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidGeometry/IDetector.h" #include "MantidGeometry/Instrument.h" @@ -124,7 +125,7 @@ void SetUncertainties::exec() { double valueToSet = resetOne ? 1.0 : getProperty("SetErrorTo"); double valueToCompare = resetOne ? 0.0 : getProperty("IfEqualTo"); int precision = getProperty("Precision"); - double tolerance = resetOne ? 1E-10 : std::pow(10.0, std : negate(precision)); + double tolerance = resetOne ? 1E-10 : std::pow(10.0, -1. * precision); // Create the output workspace. This will copy many aspects from the input // one.