From 2c06675ea0e874efd4bc2c4a3dc49db49bd1fcad Mon Sep 17 00:00:00 2001
From: Gemma Guest <gemma.guest@stfc.ac.uk>
Date: Thu, 6 Feb 2020 17:37:18 +0000
Subject: [PATCH] Update system tests with transmission binning fix

This commit updates the reference files for tests where the transmission
workspace is output from ReflectometryReductionOne. The refactored code
in this PR has introduced a fix in this algorithm to output the
transmission workspace after it has been rebinned to detectors.
Previously it was output before the rebin step, hence the minor
differences in the output. Note however that the final results of the
reduction (IvsQ workspaces) are unchanged.

This commit also moves the code to set the output workspace to the
bottom of the function that does the transmission correction, to help
avoid a similar problem happening again.

Re #27633
---
 .../Algorithms/src/ReflectometryReductionOne2.cpp      | 10 ++++++++--
 .../ISISReflectometryReducedRunsResult.nxs.md5         |  2 +-
 .../ISISReflectometryWorkflowSlicingResult.nxs.md5     |  2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Framework/Algorithms/src/ReflectometryReductionOne2.cpp b/Framework/Algorithms/src/ReflectometryReductionOne2.cpp
index a60e38936d6..dd8ab176330 100644
--- a/Framework/Algorithms/src/ReflectometryReductionOne2.cpp
+++ b/Framework/Algorithms/src/ReflectometryReductionOne2.cpp
@@ -260,6 +260,7 @@ void ReflectometryReductionOne2::exec() {
   // Convert to Q
   auto IvsQ = convertToQ(IvsLam);
 
+  // Set outputs
   if (!isDefault("OutputWorkspaceWavelength") || isChild()) {
     setProperty("OutputWorkspaceWavelength", IvsLam);
   }
@@ -554,8 +555,6 @@ MatrixWorkspace_sptr ReflectometryReductionOne2::transmissionCorrection(
   rebinToWorkspaceAlg->setProperty("WorkspaceToRebin", transmissionWS);
   rebinToWorkspaceAlg->execute();
   transmissionWS = rebinToWorkspaceAlg->getProperty("OutputWorkspace");
-  if (isDefault("OutputWorkspaceTransmission") && !transmissionWSName.empty())
-    setPropertyValue("OutputWorkspaceTransmission", transmissionWSName);
 
   // If the detector workspace has been reduced then the spectrum maps
   // should match AFTER reducing the transmission workspace
@@ -564,6 +563,13 @@ MatrixWorkspace_sptr ReflectometryReductionOne2::transmissionCorrection(
   }
 
   MatrixWorkspace_sptr normalized = divide(detectorWS, transmissionWS);
+
+  // Set output transmission workspace
+  if (isDefault("OutputWorkspaceTransmission") && !transmissionWSName.empty()) {
+    setPropertyValue("OutputWorkspaceTransmission", transmissionWSName);
+  }
+  setProperty("OutputWorkspaceTransmission", transmissionWS);
+
   return normalized;
 }
 
diff --git a/Testing/SystemTests/tests/analysis/reference/ISISReflectometryReducedRunsResult.nxs.md5 b/Testing/SystemTests/tests/analysis/reference/ISISReflectometryReducedRunsResult.nxs.md5
index 224426b6ad5..c149241ceb1 100644
--- a/Testing/SystemTests/tests/analysis/reference/ISISReflectometryReducedRunsResult.nxs.md5
+++ b/Testing/SystemTests/tests/analysis/reference/ISISReflectometryReducedRunsResult.nxs.md5
@@ -1 +1 @@
-050d866089735a3107558c0effcfaae3
+1c6babfa2dce0bede17fa6961a8849f8
diff --git a/Testing/SystemTests/tests/analysis/reference/ISISReflectometryWorkflowSlicingResult.nxs.md5 b/Testing/SystemTests/tests/analysis/reference/ISISReflectometryWorkflowSlicingResult.nxs.md5
index 4d67650e522..949b665da7b 100644
--- a/Testing/SystemTests/tests/analysis/reference/ISISReflectometryWorkflowSlicingResult.nxs.md5
+++ b/Testing/SystemTests/tests/analysis/reference/ISISReflectometryWorkflowSlicingResult.nxs.md5
@@ -1 +1 @@
-6749ec6060b1e697e77ad29c9dc2ce4a
+d0b509de975d822199aff59d8c3f8599
-- 
GitLab