From d9e37cfa1e89551e519dd56f62d71747255bcec7 Mon Sep 17 00:00:00 2001
From: Vickie Lynch <lynchve@ornl.gov>
Date: Sun, 6 Mar 2011 14:54:14 +0000
Subject: [PATCH] Refs #2320 Add masking to MultipleScattering and SaveGSS. 
 Test of dataset without instrument OK now.

---
 .../Algorithms/src/MultipleScatteringAbsorption.cpp   |  1 +
 Code/Mantid/Framework/DataHandling/src/SaveGSS.cpp    | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/Code/Mantid/Framework/Algorithms/src/MultipleScatteringAbsorption.cpp b/Code/Mantid/Framework/Algorithms/src/MultipleScatteringAbsorption.cpp
index e4570e7cc99..78a3d25cb1f 100644
--- a/Code/Mantid/Framework/Algorithms/src/MultipleScatteringAbsorption.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/MultipleScatteringAbsorption.cpp
@@ -104,6 +104,7 @@ void MultipleScatteringAbsorption::exec()
     Geometry::IDetector_sptr det = in_WS->getDetector(index);
     if (det == NULL)
       throw std::runtime_error("Failed to find detector");
+    if ( det->isMasked() ) continue;
     double l2 = det->getDistance(*sample);
     double tth_rad = in_WS->detectorTwoTheta(det);
     double total_path = l1 + l2;
diff --git a/Code/Mantid/Framework/DataHandling/src/SaveGSS.cpp b/Code/Mantid/Framework/DataHandling/src/SaveGSS.cpp
index 106060da21e..34977da2dc2 100644
--- a/Code/Mantid/Framework/DataHandling/src/SaveGSS.cpp
+++ b/Code/Mantid/Framework/DataHandling/src/SaveGSS.cpp
@@ -125,6 +125,17 @@ void SaveGSS::exec()
   double l1, l2, tth;
   for (int i=0;i<nHist;i++)
   {
+    Geometry::IInstrument_const_sptr instrument = inputWS->getInstrument();
+    if (instrument != NULL) 
+    {
+      Geometry::IObjComponent_const_sptr source = instrument->getSource();
+      Geometry::IObjComponent_const_sptr sample = instrument->getSample();
+      if ( source != NULL && sample != NULL ) 
+      {
+        Geometry::IDetector_const_sptr det = inputWS->getDetector(static_cast<size_t>(i));
+        if ( det->isMasked() ) continue;
+      }
+    }
     getFocusedPos(inputWS, i, l1, l2, tth);
     if (!split && i==0) // Assign only one file
     {
-- 
GitLab