From 9aa23e4d55bc9000db50d1975f9134b903fb7b0f Mon Sep 17 00:00:00 2001
From: Elliot Oram <Elliot.Oram@stfc.ac.uk>
Date: Fri, 9 Oct 2015 13:55:41 +0100
Subject: [PATCH] Added container run number in Indirect corrections

Refs #13915
---
 .../src/Indirect/ApplyPaalmanPings.cpp                | 11 ++++++++++-
 .../src/Indirect/CalculatePaalmanPings.cpp            | 11 ++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp b/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp
index 42270faab77..31673e95536 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp
@@ -175,9 +175,18 @@ void ApplyPaalmanPings::run() {
     correctionType = "cyl";
     break;
   }
-  const QString outputWsName =
+  QString outputWsName =
       sampleWsName.left(nameCutIndex) + +"_" + correctionType + "_Corrected";
 
+  if (useCan) {
+    auto containerWsName = m_uiForm.dsContainer->getCurrentDataName();
+    int cutIndex = containerWsName.indexOf("_");
+    if (cutIndex == -1) {
+      cutIndex = containerWsName.length();
+    }
+	outputWsName += "_Subtract_" + containerWsName.left(cutIndex);
+  }
+
   applyCorrAlg->setProperty("OutputWorkspace", outputWsName.toStdString());
 
   // Add corrections algorithm to queue
diff --git a/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp b/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp
index 81277fad6d9..49584757883 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/CalculatePaalmanPings.cpp
@@ -122,8 +122,17 @@ void CalculatePaalmanPings::run() {
     break;
   }
 
-  const QString outputWsName =
+  QString outputWsName =
       sampleWsName.left(nameCutIndex) + "_" + correctionType + "_abs";
+  if (useCan) {
+    auto containerWsName = m_uiForm.dsContainer->getCurrentDataName();
+    int cutIndex = containerWsName.indexOf("_");
+    if (cutIndex == -1) {
+      cutIndex = containerWsName.length();
+    }
+    outputWsName += "_Subtract_" + containerWsName.left(cutIndex);
+  }
+
   absCorAlgo->setProperty("OutputWorkspace", outputWsName.toStdString());
 
   // Add corrections algorithm to queue
-- 
GitLab