diff --git a/Framework/Algorithms/inc/MantidAlgorithms/PolarizationCorrections/PolarizationCorrectionsHelpers.h b/Framework/Algorithms/inc/MantidAlgorithms/PolarizationCorrections/PolarizationCorrectionsHelpers.h index a47698e915fb..90d71115ebcb 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/PolarizationCorrections/PolarizationCorrectionsHelpers.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/PolarizationCorrections/PolarizationCorrectionsHelpers.h @@ -16,8 +16,7 @@ namespace PolarizationCorrectionsHelpers { MANTID_ALGORITHMS_DLL API::MatrixWorkspace_sptr workspaceForSpinState(API::WorkspaceGroup_sptr group, const std::string &spinStateOrder, const std::string &targetSpinState); -MANTID_ALGORITHMS_DLL size_t indexOfWorkspaceForSpinState(API::WorkspaceGroup_sptr group, - const std::string &spinStateOrder, +MANTID_ALGORITHMS_DLL size_t indexOfWorkspaceForSpinState(const std::string &spinStateOrder, const std::string &targetSpinState); MANTID_ALGORITHMS_DLL std::vector splitSpinStateString(const std::string &spinStates); } // namespace PolarizationCorrectionsHelpers diff --git a/Framework/Algorithms/src/PolarizationCorrections/HeliumAnalyserEfficiency.cpp b/Framework/Algorithms/src/PolarizationCorrections/HeliumAnalyserEfficiency.cpp index df8a3235687e..13f9e4f08fcc 100644 --- a/Framework/Algorithms/src/PolarizationCorrections/HeliumAnalyserEfficiency.cpp +++ b/Framework/Algorithms/src/PolarizationCorrections/HeliumAnalyserEfficiency.cpp @@ -54,8 +54,7 @@ void HeliumAnalyserEfficiency::init() { "Helium analyzer efficiency as a function of wavelength"); auto spinValidator = std::make_shared(std::unordered_set{4}); - std::string initialSpinConfig = "11,10,01,00"; - declareProperty(PropertyNames::SPIN_STATES, initialSpinConfig, spinValidator, + declareProperty(PropertyNames::SPIN_STATES, "11,10,01,00", spinValidator, "Order of individual spin states in the input group workspace, e.g. \"01,11,00,10\""); auto mustBePositive = std::make_shared>(); @@ -112,8 +111,9 @@ std::map HeliumAnalyserEfficiency::validateInputs() { */ void HeliumAnalyserEfficiency::validateGroupInput() { const auto results = validateInputs(); - for (const auto &result : results) { - throw std::runtime_error("Issue in " + result.first + " property: " + result.second); + if (results.size() > 0) { + const auto result = results.cbegin(); + throw std::runtime_error("Issue in " + result->first + " property: " + result->second); } } @@ -150,8 +150,8 @@ void HeliumAnalyserEfficiency::calculateAnalyserEfficiency() { // We're going to calculate e from the data, e = T_NSF / (T_NSF + T_SF), // then fit (1 + tanh(mu * phe))/2 to it in order to calculate phe, the // helium atom polarization in the analyser. - MatrixWorkspace_sptr denom = addTwoWorkspaces(tnsfWs, tsfWs); - MatrixWorkspace_sptr e = divideWorkspace(tnsfWs, denom); + MatrixWorkspace_sptr denom = addTwoWorkspaces(tnsfWs, std::move(tsfWs)); + MatrixWorkspace_sptr e = divideWorkspace(std::move(tnsfWs), std::move(denom)); // Now we fit (1 + tanh(mu*pHe*x))/2 to P to give us pHe @@ -161,7 +161,7 @@ void HeliumAnalyserEfficiency::calculateAnalyserEfficiency() { const MantidVec wavelengthValues = e->dataX(0); double pHe, pHeError; MantidVec eCalc; - fitAnalyserEfficiency(mu, e, wavelengthValues, pHe, pHeError, eCalc); + fitAnalyserEfficiency(mu, std::move(e), wavelengthValues, pHe, pHeError, eCalc); auto efficiency = calculateEfficiencyWorkspace(wavelengthValues, eCalc, pHe, pHeError, mu); setProperty(PropertyNames::OUTPUT_WORKSPACE, efficiency); } diff --git a/Framework/Algorithms/src/PolarizationCorrections/PolarizationCorrectionsHelpers.cpp b/Framework/Algorithms/src/PolarizationCorrections/PolarizationCorrectionsHelpers.cpp index 27131b84825d..3c61e1ba6d65 100644 --- a/Framework/Algorithms/src/PolarizationCorrections/PolarizationCorrectionsHelpers.cpp +++ b/Framework/Algorithms/src/PolarizationCorrections/PolarizationCorrectionsHelpers.cpp @@ -19,17 +19,16 @@ state in the spin state order as the index of the workspace in the group. */ API::MatrixWorkspace_sptr workspaceForSpinState(API::WorkspaceGroup_sptr group, const std::string &spinStateOrder, const std::string &targetSpinState) { - const auto wsIndex = indexOfWorkspaceForSpinState(group, spinStateOrder, targetSpinState); + const auto wsIndex = indexOfWorkspaceForSpinState(spinStateOrder, targetSpinState); return std::dynamic_pointer_cast(group->getItem(wsIndex)); } /* For a given workspace group, spin state order, and desired spin state, this method will -return the index of the specified workspace from the group, using the position of the desired spin +return the index of the specified workspace in the group, using the position of the desired spin state in the spin state order. */ -size_t indexOfWorkspaceForSpinState(API::WorkspaceGroup_sptr group, const std::string &spinStateOrder, - const std::string &targetSpinState) { +size_t indexOfWorkspaceForSpinState(const std::string &spinStateOrder, const std::string &targetSpinState) { std::vector spinStateVector = splitSpinStateString(spinStateOrder); auto trimmedTargetSpinState = targetSpinState; boost::trim(trimmedTargetSpinState);