From be361025454b1d3b65cecdf72973cbcb13d33368 Mon Sep 17 00:00:00 2001
From: Raquel Alvarez <raquel.alvarez-banos@stfc.ac.uk>
Date: Tue, 4 Oct 2016 12:32:42 +0100
Subject: [PATCH] Re #17673 SofQWCentre

---
 Framework/Algorithms/src/SofQWCentre.cpp    | 16 ++++++-------
 Framework/Algorithms/test/SofQWCentreTest.h | 25 ++++++++++-----------
 2 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/Framework/Algorithms/src/SofQWCentre.cpp b/Framework/Algorithms/src/SofQWCentre.cpp
index 666673b68da..1d91327a29b 100644
--- a/Framework/Algorithms/src/SofQWCentre.cpp
+++ b/Framework/Algorithms/src/SofQWCentre.cpp
@@ -168,9 +168,9 @@ void SofQWCentre::exec() {
       const size_t numDets = detectors.size();
       const double numDets_d = static_cast<double>(
           numDets); // cache to reduce number of static casts
-      const MantidVec &Y = inputWorkspace->readY(i);
-      const MantidVec &E = inputWorkspace->readE(i);
-      const MantidVec &X = inputWorkspace->readX(i);
+      const auto &Y = inputWorkspace->y(i);
+      const auto &E = inputWorkspace->e(i);
+      const auto &X = inputWorkspace->x(i);
 
       // Loop over the detectors and for each bin calculate Q
       for (size_t idet = 0; idet < numDets; ++idet) {
@@ -233,10 +233,10 @@ void SofQWCentre::exec() {
 
           // And add the data and it's error to that bin, taking into account
           // the number of detectors contributing to this bin
-          outputWorkspace->dataY(qIndex)[j] += Y[j] / numDets_d;
+          outputWorkspace->mutableY(qIndex)[j] += Y[j] / numDets_d;
           // Standard error on the average
-          outputWorkspace->dataE(qIndex)[j] =
-              sqrt((pow(outputWorkspace->readE(qIndex)[j], 2) + pow(E[j], 2)) /
+          outputWorkspace->mutableE(qIndex)[j] =
+              sqrt((pow(outputWorkspace->e(qIndex)[j], 2) + pow(E[j], 2)) /
                    numDets_d);
         }
       }
@@ -327,8 +327,8 @@ void SofQWCentre::makeDistribution(API::MatrixWorkspace_sptr outputWS,
 
   const size_t numQBins = outputWS->getNumberHistograms();
   for (size_t i = 0; i < numQBins; ++i) {
-    MantidVec &Y = outputWS->dataY(i);
-    MantidVec &E = outputWS->dataE(i);
+    auto &Y = outputWS->mutableY(i);
+    auto &E = outputWS->mutableE(i);
     std::transform(Y.begin(), Y.end(), Y.begin(),
                    std::bind2nd(std::divides<double>(), widths[i + 1]));
     std::transform(E.begin(), E.end(), E.begin(),
diff --git a/Framework/Algorithms/test/SofQWCentreTest.h b/Framework/Algorithms/test/SofQWCentreTest.h
index c28b797b9fa..716be282fb7 100644
--- a/Framework/Algorithms/test/SofQWCentreTest.h
+++ b/Framework/Algorithms/test/SofQWCentreTest.h
@@ -4,7 +4,6 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidAlgorithms/SofQWCentre.h"
 #include "MantidAPI/Axis.h"
-#include "MantidDataHandling/LoadNexusProcessed.h"
 
 #include "SofQWTest.h"
 
@@ -44,18 +43,18 @@ public:
     TS_ASSERT_EQUALS((*(result->getAxis(1)))(6), 2.0);
 
     const double delta(1e-08);
-    TS_ASSERT_DELTA(result->readY(0)[1160], 54.85624399, delta);
-    TS_ASSERT_DELTA(result->readE(0)[1160], 0.34252858, delta);
-    TS_ASSERT_DELTA(result->readY(1)[1145], 22.72491806, delta);
-    TS_ASSERT_DELTA(result->readE(1)[1145], 0.19867742, delta);
-    TS_ASSERT_DELTA(result->readY(2)[1200], 6.76047436, delta);
-    TS_ASSERT_DELTA(result->readE(2)[1200], 0.10863549, delta);
-    TS_ASSERT_DELTA(result->readY(3)[99], 0.16439574, delta);
-    TS_ASSERT_DELTA(result->readE(3)[99], 0.03414360, delta);
-    TS_ASSERT_DELTA(result->readY(4)[1654], 0.069311442, delta);
-    TS_ASSERT_DELTA(result->readE(4)[1654], 0.007573484, delta);
-    TS_ASSERT_DELTA(result->readY(5)[1025], 0.226287179, delta);
-    TS_ASSERT_DELTA(result->readE(5)[1025], 0.02148236, delta);
+    TS_ASSERT_DELTA(result->y(0)[1160], 54.85624399, delta);
+    TS_ASSERT_DELTA(result->e(0)[1160], 0.34252858, delta);
+    TS_ASSERT_DELTA(result->y(1)[1145], 22.72491806, delta);
+    TS_ASSERT_DELTA(result->e(1)[1145], 0.19867742, delta);
+    TS_ASSERT_DELTA(result->y(2)[1200], 6.76047436, delta);
+    TS_ASSERT_DELTA(result->e(2)[1200], 0.10863549, delta);
+    TS_ASSERT_DELTA(result->y(3)[99], 0.16439574, delta);
+    TS_ASSERT_DELTA(result->e(3)[99], 0.03414360, delta);
+    TS_ASSERT_DELTA(result->y(4)[1654], 0.069311442, delta);
+    TS_ASSERT_DELTA(result->e(4)[1654], 0.007573484, delta);
+    TS_ASSERT_DELTA(result->y(5)[1025], 0.226287179, delta);
+    TS_ASSERT_DELTA(result->e(5)[1025], 0.02148236, delta);
   }
 };
 
-- 
GitLab