From 051b744c1b05c08c75864c8e61ea2640b157a587 Mon Sep 17 00:00:00 2001
From: Elliot Oram <Elliot.Oram@stfc.ac.uk>
Date: Tue, 20 Oct 2015 11:09:11 +0100
Subject: [PATCH] Relocation RebinToWorkspace algorithm

Refs #13993
---
 .../ApplyPaalmanPingsCorrection.py              |  2 +-
 .../src/Indirect/ContainerSubtraction.cpp       | 17 +++++++++--------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py
index 1c896ac246a..be6133556b7 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py
@@ -248,7 +248,7 @@ class ApplyPaalmanPingsCorrection(PythonAlgorithm):
         """
 
 
-        logger.information('Rebining can to ensure Minus')
+        logger.information('Rebining container to ensure Minus')
         RebinToWorkspace(WorkspaceToRebin=self._can_ws_name,
                          WorkspaceToMatch=self._sample_ws_name,
                          OutputWorkspace=self._can_ws_name)
diff --git a/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp b/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp
index 232b30f2e68..8112945a949 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp
@@ -59,13 +59,6 @@ void ContainerSubtraction::run() {
     scaleX->setProperty("Factor", m_uiForm.spShift->value());
     scaleX->setProperty("Operation", "Add");
     scaleX->execute();
-    IAlgorithm_sptr rebinAlg =
-        AlgorithmManager::Instance().create("RebinToWorkspace");
-    rebinAlg->initialize();
-    rebinAlg->setProperty("WorkspaceToRebin", canWs);
-    rebinAlg->setProperty("WorkspaceToMatch", sampleWs);
-    rebinAlg->setProperty("OutputWorkspace", canWsName.toStdString());
-    rebinAlg->execute();
   }
 
   // If not in wavelength then do conversion
@@ -93,7 +86,15 @@ void ContainerSubtraction::run() {
                                        QMessageBox::Yes, QMessageBox::No,
                                        QMessageBox::NoButton);
 
-    if (result != QMessageBox::Yes) {
+    if (result == QMessageBox::Yes) {
+      IAlgorithm_sptr rebinAlg =
+          AlgorithmManager::Instance().create("RebinToWorkspace");
+      rebinAlg->initialize();
+      rebinAlg->setProperty("WorkspaceToRebin", canWs);
+      rebinAlg->setProperty("WorkspaceToMatch", sampleWs);
+      rebinAlg->setProperty("OutputWorkspace", canWsName.toStdString());
+      rebinAlg->execute();
+    } else {
       m_batchAlgoRunner->clearQueue();
       g_log.error("Cannot apply absorption corrections using a sample and "
                   "container with different binning.");
-- 
GitLab