From 1de6b847e88446ca55007da3581a6ffb82553b05 Mon Sep 17 00:00:00 2001
From: Simon Heybrock <simon.heybrock@esss.se>
Date: Tue, 1 Nov 2016 16:26:33 +0100
Subject: [PATCH] Re #17918. Removed Goniometer include from Run.h.

---
 Framework/API/inc/MantidAPI/Run.h             | 17 +++++--
 Framework/API/src/Run.cpp                     | 47 ++++++++++++-------
 Framework/Algorithms/src/AddPeak.cpp          |  1 +
 .../Algorithms/src/ConvertSpectrumAxis2.cpp   |  2 +
 .../Algorithms/src/CorelliCrossCorrelate.cpp  |  1 +
 .../Algorithms/src/CorrectFlightPaths.cpp     |  1 +
 .../Algorithms/src/CreatePeaksWorkspace.cpp   |  1 +
 .../Algorithms/src/ModeratorTzeroLinear.cpp   |  1 +
 Framework/Algorithms/src/Q1DWeighted.cpp      |  2 +
 Framework/Algorithms/test/FilterEventsTest.h  |  1 +
 .../Algorithms/test/RemoveExpDecayTest.h      |  1 +
 Framework/Crystal/src/LoadIsawPeaks.cpp       |  1 +
 .../Crystal/src/OptimizeCrystalPlacement.cpp  |  1 +
 Framework/Crystal/src/SaveIsawPeaks.cpp       |  1 +
 Framework/Crystal/src/SetGoniometer.cpp       |  1 +
 Framework/Crystal/test/AddPeakHKLTest.h       |  1 +
 Framework/Crystal/test/LoadIsawPeaksTest.h    |  1 +
 Framework/Crystal/test/PredictPeaksTest.h     |  1 +
 .../inc/MantidDataHandling/LoadAscii.h        |  5 +-
 Framework/DataHandling/src/LoadEventNexus.cpp |  1 +
 Framework/DataHandling/src/LoadHelper.cpp     |  1 +
 .../MDAlgorithms/src/CalculateCoverageDGS.cpp |  1 +
 .../src/ConvertCWSDExpToMomentum.cpp          |  1 +
 Framework/MDAlgorithms/src/LoadSQW.cpp        |  1 +
 Framework/MDAlgorithms/src/MDNormDirectSC.cpp |  1 +
 .../MDAlgorithms/src/MDWSDescription.cpp      |  1 +
 .../Resolution/ModeratorChopperResolution.cpp |  2 +-
 .../test/ConvertToMDComponentsTest.h          |  1 +
 Framework/MDAlgorithms/test/ConvertToMDTest.h |  1 +
 .../MDAlgorithms/test/ConvertToQ3DdETest.h    |  1 +
 .../MDAlgorithms/test/MDTransfModQTest.h      |  1 +
 Framework/MDAlgorithms/test/MDTransfQ3DTest.h |  1 +
 .../MDAlgorithms/test/MDWSDescriptionTest.h   |  1 +
 Framework/MDAlgorithms/test/MDWSTransfTest.h  |  1 +
 .../test/PreprocessDetectorsToMDTest.h        |  3 +-
 Framework/MDAlgorithms/test/SaveMD2Test.h     |  1 +
 Framework/MDAlgorithms/test/SaveMDTest.h      |  1 +
 .../src/WorkspaceCreationHelper.cpp           |  1 +
 .../SpectrumViewer/src/MatrixWSDataSource.cpp |  1 +
 39 files changed, 84 insertions(+), 26 deletions(-)

diff --git a/Framework/API/inc/MantidAPI/Run.h b/Framework/API/inc/MantidAPI/Run.h
index fa919615acc..e7112752fe7 100644
--- a/Framework/API/inc/MantidAPI/Run.h
+++ b/Framework/API/inc/MantidAPI/Run.h
@@ -3,8 +3,8 @@
 
 #include "MantidAPI/DllConfig.h"
 #include "MantidAPI/LogManager.h"
+#include "MantidKernel/Matrix.h"
 #include "MantidKernel/TimeSplitter.h"
-#include "MantidGeometry/Instrument/Goniometer.h"
 
 #include <vector>
 
@@ -14,6 +14,10 @@ class File;
 
 namespace Mantid {
 
+namespace Geometry {
+class Goniometer;
+}
+
 namespace API {
 
 /**
@@ -46,6 +50,11 @@ namespace API {
 */
 class MANTID_API_DLL Run : public LogManager {
 public:
+  Run();
+  Run(const Run &other);
+  ~Run();
+  Run &operator=(const Run &other);
+
   /// Clone
   boost::shared_ptr<Run> clone();
 
@@ -83,10 +92,10 @@ public:
                      const bool useLogValues);
   /** @return A reference to the const Goniometer object for this run */
   inline const Geometry::Goniometer &getGoniometer() const {
-    return m_goniometer;
+    return *m_goniometer;
   }
   /** @return A reference to the non-const Goniometer object for this run */
-  inline Geometry::Goniometer &mutableGoniometer() { return m_goniometer; }
+  inline Geometry::Goniometer &mutableGoniometer() { return *m_goniometer; }
 
   // Retrieve the goniometer rotation matrix
   const Kernel::DblMatrix &getGoniometerMatrix() const;
@@ -103,7 +112,7 @@ private:
   void calculateGoniometerMatrix();
 
   /// Goniometer for this run
-  Mantid::Geometry::Goniometer m_goniometer;
+  std::unique_ptr<Geometry::Goniometer> m_goniometer;
   /// A set of histograms that can be stored here for future reference
   std::vector<double> m_histoBins;
 
diff --git a/Framework/API/src/Run.cpp b/Framework/API/src/Run.cpp
index 0e256285d94..edf9dedfd7a 100644
--- a/Framework/API/src/Run.cpp
+++ b/Framework/API/src/Run.cpp
@@ -1,10 +1,9 @@
-//----------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------
 #include "MantidAPI/Run.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidKernel/DateAndTime.h"
 #include "MantidKernel/TimeSeriesProperty.h"
 #include "MantidKernel/VectorHelper.h"
+#include "MantidKernel/make_unique.h"
 
 #include <nexus/NeXusFile.hpp>
 
@@ -38,16 +37,30 @@ const char *OUTER_BKG_RADIUS_GROUP = "outer_bkg_radius";
 Kernel::Logger g_log("Run");
 }
 
-//----------------------------------------------------------------------
-// Public member functions
-//----------------------------------------------------------------------
+Run::Run() : m_goniometer(Kernel::make_unique<Geometry::Goniometer>()) {}
+
+Run::Run(const Run &other)
+    : LogManager(other), m_goniometer(Kernel::make_unique<Geometry::Goniometer>(
+                             *other.m_goniometer)),
+      m_histoBins(other.m_histoBins) {}
+
+// Defined as default in source for forward declaration with std::unique_ptr.
+Run::~Run() = default;
+
+Run &Run::operator=(const Run &other) {
+  LogManager::operator=(other);
+  m_goniometer = Kernel::make_unique<Geometry::Goniometer>(*other.m_goniometer);
+  m_histoBins = other.m_histoBins;
+  return *this;
+}
 
 boost::shared_ptr<Run> Run::clone() {
   auto clone = boost::make_shared<Run>();
   for (auto property : this->m_manager.getProperties()) {
     clone->addProperty(property->clone());
   }
-  clone->m_goniometer = this->m_goniometer;
+  clone->m_goniometer =
+      Kernel::make_unique<Geometry::Goniometer>(*this->m_goniometer);
   clone->m_histoBins = this->m_histoBins;
   return clone;
 }
@@ -280,7 +293,7 @@ std::vector<double> Run::getBinBoundaries() const {
  */
 size_t Run::getMemorySize() const {
   size_t total = LogManager::getMemorySize();
-  total += sizeof(m_goniometer);
+  total += sizeof(*m_goniometer);
   total += m_histoBins.size() * sizeof(double);
   return total;
 }
@@ -294,13 +307,13 @@ size_t Run::getMemorySize() const {
  */
 void Run::setGoniometer(const Geometry::Goniometer &goniometer,
                         const bool useLogValues) {
-  Geometry::Goniometer old = m_goniometer;
+  auto old = std::move(m_goniometer);
   try {
-    m_goniometer = goniometer; // copy it in
+    m_goniometer = Kernel::make_unique<Geometry::Goniometer>(goniometer);
     if (useLogValues)
       calculateGoniometerMatrix();
   } catch (std::runtime_error &) {
-    m_goniometer = old;
+    m_goniometer = std::move(old);
     throw;
   }
 }
@@ -314,7 +327,7 @@ void Run::setGoniometer(const Geometry::Goniometer &goniometer,
  * @return 3x3 double rotation matrix
  */
 const Mantid::Kernel::DblMatrix &Run::getGoniometerMatrix() const {
-  return m_goniometer.getR();
+  return m_goniometer->getR();
 }
 
 //--------------------------------------------------------------------------------------------
@@ -328,7 +341,7 @@ void Run::saveNexus(::NeXus::File *file, const std::string &group,
   LogManager::saveNexus(file, group, true);
 
   // write the goniometer
-  m_goniometer.saveNexus(file, GONIOMETER_LOG_NAME);
+  m_goniometer->saveNexus(file, GONIOMETER_LOG_NAME);
 
   // write the histogram bins, if there are any
   if (!m_histoBins.empty()) {
@@ -381,7 +394,7 @@ void Run::loadNexus(::NeXus::File *file, const std::string &group,
   for (const auto &name_class : entries) {
     if (name_class.second == "NXpositioner") {
       // Goniometer class
-      m_goniometer.loadNexus(file, name_class.first);
+      m_goniometer->loadNexus(file, name_class.first);
     } else if (name_class.first == HISTO_BINS_LOG_NAME) {
       file->openGroup(name_class.first, "NXdata");
       file->readData("value", m_histoBins);
@@ -435,8 +448,8 @@ void Run::loadNexus(::NeXus::File *file, const std::string &group,
  * Calculate the goniometer matrix
  */
 void Run::calculateGoniometerMatrix() {
-  for (size_t i = 0; i < m_goniometer.getNumberAxes(); ++i) {
-    const std::string axisName = m_goniometer.getAxis(i).name;
+  for (size_t i = 0; i < m_goniometer->getNumberAxes(); ++i) {
+    const std::string axisName = m_goniometer->getAxis(i).name;
     const double minAngle =
         getLogAsSingleValue(axisName, Kernel::Math::Minimum);
     const double maxAngle =
@@ -471,7 +484,7 @@ void Run::calculateGoniometerMatrix() {
                       "1\',Axis1='chi,0,0,1,1',Axis2='phi,0,1,0,1')");
       }
     }
-    m_goniometer.setRotationAngle(i, angle);
+    m_goniometer->setRotationAngle(i, angle);
   }
 }
 
diff --git a/Framework/Algorithms/src/AddPeak.cpp b/Framework/Algorithms/src/AddPeak.cpp
index 5bfac64cc3a..39201982676 100644
--- a/Framework/Algorithms/src/AddPeak.cpp
+++ b/Framework/Algorithms/src/AddPeak.cpp
@@ -5,6 +5,7 @@
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/Run.h"
 #include "MantidGeometry/Crystal/IPeak.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidKernel/Unit.h"
 #include "MantidKernel/System.h"
 
diff --git a/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp b/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp
index 68cc24b51c7..14da4766f16 100644
--- a/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp
+++ b/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp
@@ -16,6 +16,8 @@
 
 #include <cfloat>
 
+constexpr double rad2deg = 180.0 / M_PI;
+
 namespace Mantid {
 namespace Algorithms {
 // Register the algorithm into the AlgorithmFactory
diff --git a/Framework/Algorithms/src/CorelliCrossCorrelate.cpp b/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
index 47b33fdd876..25b1e157925 100644
--- a/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
+++ b/Framework/Algorithms/src/CorelliCrossCorrelate.cpp
@@ -10,6 +10,7 @@
 #include "MantidGeometry/muParser_Silent.h"
 #include "MantidKernel/CompositeValidator.h"
 #include "MantidKernel/MandatoryValidator.h"
+#include "MantidKernel/PhysicalConstants.h"
 #include "MantidKernel/TimeSeriesProperty.h"
 
 #include <boost/algorithm/string/classification.hpp>
diff --git a/Framework/Algorithms/src/CorrectFlightPaths.cpp b/Framework/Algorithms/src/CorrectFlightPaths.cpp
index 821f912eccd..b66d548218f 100644
--- a/Framework/Algorithms/src/CorrectFlightPaths.cpp
+++ b/Framework/Algorithms/src/CorrectFlightPaths.cpp
@@ -9,6 +9,7 @@
 #include "MantidGeometry/Instrument/ComponentHelper.h"
 #include "MantidGeometry/Instrument/ParameterMap.h"
 #include "MantidKernel/CompositeValidator.h"
+#include "MantidKernel/PhysicalConstants.h"
 #include "MantidKernel/Strings.h"
 #include "MantidKernel/UnitFactory.h"
 
diff --git a/Framework/Algorithms/src/CreatePeaksWorkspace.cpp b/Framework/Algorithms/src/CreatePeaksWorkspace.cpp
index 3907b4f7e01..5798838d5e6 100644
--- a/Framework/Algorithms/src/CreatePeaksWorkspace.cpp
+++ b/Framework/Algorithms/src/CreatePeaksWorkspace.cpp
@@ -1,6 +1,7 @@
 #include "MantidAlgorithms/CreatePeaksWorkspace.h"
 #include "MantidKernel/System.h"
 #include "MantidDataObjects/PeaksWorkspace.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/Run.h"
 
diff --git a/Framework/Algorithms/src/ModeratorTzeroLinear.cpp b/Framework/Algorithms/src/ModeratorTzeroLinear.cpp
index d13fb6f89e6..cbcf742bbd7 100644
--- a/Framework/Algorithms/src/ModeratorTzeroLinear.cpp
+++ b/Framework/Algorithms/src/ModeratorTzeroLinear.cpp
@@ -5,6 +5,7 @@
 #include "MantidAPI/WorkspaceUnitValidator.h"
 #include "MantidDataObjects/EventWorkspace.h"
 #include "MantidDataObjects/Workspace2D.h"
+#include "MantidKernel/PhysicalConstants.h"
 #include "MantidKernel/UnitFactory.h"
 
 #include <boost/lexical_cast.hpp>
diff --git a/Framework/Algorithms/src/Q1DWeighted.cpp b/Framework/Algorithms/src/Q1DWeighted.cpp
index 7f9c8cc9332..64ec41eb576 100644
--- a/Framework/Algorithms/src/Q1DWeighted.cpp
+++ b/Framework/Algorithms/src/Q1DWeighted.cpp
@@ -17,6 +17,8 @@
 #include "MantidKernel/UnitFactory.h"
 #include "MantidKernel/VectorHelper.h"
 
+constexpr double deg2rad = M_PI / 180.0;
+
 namespace Mantid {
 namespace Algorithms {
 
diff --git a/Framework/Algorithms/test/FilterEventsTest.h b/Framework/Algorithms/test/FilterEventsTest.h
index ccf0402a3e8..9d018584963 100644
--- a/Framework/Algorithms/test/FilterEventsTest.h
+++ b/Framework/Algorithms/test/FilterEventsTest.h
@@ -13,6 +13,7 @@
 #include "MantidDataObjects/SplittersWorkspace.h"
 #include "MantidDataObjects/TableWorkspace.h"
 #include "MantidGeometry/Instrument.h"
+#include "MantidKernel/PhysicalConstants.h"
 #include "MantidKernel/TimeSeriesProperty.h"
 #include "MantidKernel/TimeSplitter.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
diff --git a/Framework/Algorithms/test/RemoveExpDecayTest.h b/Framework/Algorithms/test/RemoveExpDecayTest.h
index dfcdf1a8ad8..76a136302b9 100644
--- a/Framework/Algorithms/test/RemoveExpDecayTest.h
+++ b/Framework/Algorithms/test/RemoveExpDecayTest.h
@@ -3,6 +3,7 @@
 
 #include <cxxtest/TestSuite.h>
 #include "MantidAlgorithms/RemoveExpDecay.h"
+#include "MantidKernel/PhysicalConstants.h"
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidHistogramData/LinearGenerator.h"
diff --git a/Framework/Crystal/src/LoadIsawPeaks.cpp b/Framework/Crystal/src/LoadIsawPeaks.cpp
index 974a0ede458..aac2069ec48 100644
--- a/Framework/Crystal/src/LoadIsawPeaks.cpp
+++ b/Framework/Crystal/src/LoadIsawPeaks.cpp
@@ -5,6 +5,7 @@
 #include "MantidAPI/Run.h"
 #include "MantidAPI/WorkspaceFactory.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidGeometry/Instrument/RectangularDetector.h"
 #include "MantidKernel/OptionalBool.h"
 #include "MantidKernel/Strings.h"
diff --git a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp
index c05e0e9aa40..c87b6512965 100644
--- a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp
+++ b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp
@@ -14,6 +14,7 @@
 #include "MantidKernel/EnabledWhenProperty.h"
 #include "MantidGeometry/Crystal/IPeak.h"
 #include "MantidGeometry/Crystal/IndexingUtils.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidCrystal/PeakHKLErrors.h"
 #include "MantidCrystal/SCDCalibratePanels.h"
 
diff --git a/Framework/Crystal/src/SaveIsawPeaks.cpp b/Framework/Crystal/src/SaveIsawPeaks.cpp
index c55d7435dc9..7ba77820ef5 100644
--- a/Framework/Crystal/src/SaveIsawPeaks.cpp
+++ b/Framework/Crystal/src/SaveIsawPeaks.cpp
@@ -4,6 +4,7 @@
 #include "MantidCrystal/SaveIsawPeaks.h"
 #include "MantidDataObjects/Peak.h"
 #include "MantidDataObjects/PeaksWorkspace.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidGeometry/Instrument/RectangularDetector.h"
 #include "MantidKernel/Strings.h"
 #include "MantidKernel/Utils.h"
diff --git a/Framework/Crystal/src/SetGoniometer.cpp b/Framework/Crystal/src/SetGoniometer.cpp
index 1e57ef0a385..104b3192fd1 100644
--- a/Framework/Crystal/src/SetGoniometer.cpp
+++ b/Framework/Crystal/src/SetGoniometer.cpp
@@ -1,6 +1,7 @@
 #include "MantidCrystal/SetGoniometer.h"
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/Run.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidKernel/ListValidator.h"
 #include "MantidKernel/Strings.h"
 #include "MantidKernel/TimeSeriesProperty.h"
diff --git a/Framework/Crystal/test/AddPeakHKLTest.h b/Framework/Crystal/test/AddPeakHKLTest.h
index 2f9da672e41..fdc21c4c07d 100644
--- a/Framework/Crystal/test/AddPeakHKLTest.h
+++ b/Framework/Crystal/test/AddPeakHKLTest.h
@@ -9,6 +9,7 @@
 #include "MantidAPI/Sample.h"
 #include "MantidDataObjects/PeaksWorkspace.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
 
 using Mantid::Crystal::AddPeakHKL;
diff --git a/Framework/Crystal/test/LoadIsawPeaksTest.h b/Framework/Crystal/test/LoadIsawPeaksTest.h
index c39a8b2bfb4..c2b48afdea4 100644
--- a/Framework/Crystal/test/LoadIsawPeaksTest.h
+++ b/Framework/Crystal/test/LoadIsawPeaksTest.h
@@ -5,6 +5,7 @@
 #include "MantidCrystal/LoadIsawPeaks.h"
 #include "MantidDataObjects/Peak.h"
 #include "MantidDataObjects/PeaksWorkspace.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidKernel/Matrix.h"
 #include "MantidKernel/System.h"
 #include "MantidKernel/Timer.h"
diff --git a/Framework/Crystal/test/PredictPeaksTest.h b/Framework/Crystal/test/PredictPeaksTest.h
index 7ad049ace70..97f4ac7ec5b 100644
--- a/Framework/Crystal/test/PredictPeaksTest.h
+++ b/Framework/Crystal/test/PredictPeaksTest.h
@@ -11,6 +11,7 @@
 #include <cxxtest/TestSuite.h>
 #include "MantidKernel/V3D.h"
 #include "MantidGeometry/IDTypes.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidKernel/ConfigService.h"
 #include "MantidAPI/Sample.h"
 
diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h b/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h
index 8a8729c7f29..495855b384d 100644
--- a/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h
+++ b/Framework/DataHandling/inc/MantidDataHandling/LoadAscii.h
@@ -1,12 +1,11 @@
 #ifndef MANTID_DATAHANDLING_LOADASCII_H_
 #define MANTID_DATAHANDLING_LOADASCII_H_
 
-//----------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------
 #include "MantidAPI/IFileLoader.h"
 #include "MantidAPI/DeprecatedAlgorithm.h"
 
+#include <list>
+
 namespace Mantid {
 namespace DataHandling {
 /**
diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp
index eb8d8b5b874..c174216a327 100644
--- a/Framework/DataHandling/src/LoadEventNexus.cpp
+++ b/Framework/DataHandling/src/LoadEventNexus.cpp
@@ -9,6 +9,7 @@
 #include "MantidAPI/Sample.h"
 #include "MantidAPI/SpectrumDetectorMapping.h"
 #include "MantidGeometry/Instrument.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidGeometry/Instrument/RectangularDetector.h"
 #include "MantidKernel/ArrayProperty.h"
 #include "MantidKernel/BoundedValidator.h"
diff --git a/Framework/DataHandling/src/LoadHelper.cpp b/Framework/DataHandling/src/LoadHelper.cpp
index fc456db0ed4..2b7a2dfe2fd 100644
--- a/Framework/DataHandling/src/LoadHelper.cpp
+++ b/Framework/DataHandling/src/LoadHelper.cpp
@@ -6,6 +6,7 @@
 
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidGeometry/Instrument/ComponentHelper.h"
+#include "MantidKernel/PhysicalConstants.h"
 
 #include <nexus/napi.h>
 
diff --git a/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp b/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp
index a310c5a2ccb..f8bf2bfc8eb 100644
--- a/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp
+++ b/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp
@@ -3,6 +3,7 @@
 #include "MantidAPI/Run.h"
 #include "MantidAPI/Sample.h"
 #include "MantidDataObjects/MDHistoWorkspace.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidKernel/ArrayProperty.h"
 #include "MantidKernel/ArrayLengthValidator.h"
 #include "MantidKernel/BoundedValidator.h"
diff --git a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp
index a6e05402bd0..91ae1324ef8 100644
--- a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp
+++ b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp
@@ -7,6 +7,7 @@
 #include "MantidDataObjects/MDEventFactory.h"
 #include "MantidAPI/ExperimentInfo.h"
 #include "MantidGeometry/Instrument/ComponentHelper.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidMDAlgorithms/MDWSDescription.h"
 #include "MantidMDAlgorithms/MDWSTransform.h"
 #include "MantidAPI/FileProperty.h"
diff --git a/Framework/MDAlgorithms/src/LoadSQW.cpp b/Framework/MDAlgorithms/src/LoadSQW.cpp
index 1c4b76220cd..fcb163e5a83 100644
--- a/Framework/MDAlgorithms/src/LoadSQW.cpp
+++ b/Framework/MDAlgorithms/src/LoadSQW.cpp
@@ -4,6 +4,7 @@
 #include "MantidAPI/Run.h"
 #include "MantidAPI/Sample.h"
 #include "MantidAPI/WorkspaceProperty.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidGeometry/MDGeometry/MDHistoDimensionBuilder.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
 #include "MantidKernel/CPUTimer.h"
diff --git a/Framework/MDAlgorithms/src/MDNormDirectSC.cpp b/Framework/MDAlgorithms/src/MDNormDirectSC.cpp
index 38ad009aae4..c94731a2489 100644
--- a/Framework/MDAlgorithms/src/MDNormDirectSC.cpp
+++ b/Framework/MDAlgorithms/src/MDNormDirectSC.cpp
@@ -13,6 +13,7 @@
 #include "MantidKernel/TimeSeriesProperty.h"
 #include "MantidKernel/VectorHelper.h"
 #include "MantidKernel/ConfigService.h"
+#include "MantidKernel/PhysicalConstants.h"
 
 namespace Mantid {
 namespace MDAlgorithms {
diff --git a/Framework/MDAlgorithms/src/MDWSDescription.cpp b/Framework/MDAlgorithms/src/MDWSDescription.cpp
index 442c5a2070a..0852bcb43b7 100644
--- a/Framework/MDAlgorithms/src/MDWSDescription.cpp
+++ b/Framework/MDAlgorithms/src/MDWSDescription.cpp
@@ -11,6 +11,7 @@
 
 #include "MantidMDAlgorithms/MDTransfFactory.h"
 #include "MantidGeometry/MDGeometry/MDFrameFactory.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 
 #include <boost/lexical_cast.hpp>
 
diff --git a/Framework/MDAlgorithms/src/Quantification/Resolution/ModeratorChopperResolution.cpp b/Framework/MDAlgorithms/src/Quantification/Resolution/ModeratorChopperResolution.cpp
index e2d8d70fd70..58f2358db5f 100644
--- a/Framework/MDAlgorithms/src/Quantification/Resolution/ModeratorChopperResolution.cpp
+++ b/Framework/MDAlgorithms/src/Quantification/Resolution/ModeratorChopperResolution.cpp
@@ -1,4 +1,3 @@
-// Includes
 #include "MantidMDAlgorithms/Quantification/Resolution/ModeratorChopperResolution.h"
 #include "MantidMDAlgorithms/Quantification/CachedExperimentInfo.h"
 
@@ -6,6 +5,7 @@
 #include "MantidAPI/ChopperModel.h"
 #include "MantidAPI/ModeratorModel.h"
 #include "MantidGeometry/Instrument.h"
+#include "MantidKernel/PhysicalConstants.h"
 
 namespace Mantid {
 namespace MDAlgorithms {
diff --git a/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h b/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h
index 3ef04716e31..e18e52ac16e 100644
--- a/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h
+++ b/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h
@@ -3,6 +3,7 @@
 // tests for different parts of ConvertToMD exec functions
 
 #include "MantidAPI/FrameworkManager.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidMDAlgorithms/ConvertToMD.h"
 #include "MantidMDAlgorithms/MDWSTransform.h"
 #include "MantidTestHelpers/ComponentCreationHelper.h"
diff --git a/Framework/MDAlgorithms/test/ConvertToMDTest.h b/Framework/MDAlgorithms/test/ConvertToMDTest.h
index 7adc9502125..abbc29c01b3 100644
--- a/Framework/MDAlgorithms/test/ConvertToMDTest.h
+++ b/Framework/MDAlgorithms/test/ConvertToMDTest.h
@@ -2,6 +2,7 @@
 #define MANTID_MD_CONVERT2_Q_NDANY_TEST_H_
 
 #include "MantidAPI/BoxController.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidMDAlgorithms/ConvertToMD.h"
 #include "MantidMDAlgorithms/ConvToMDSelector.h"
 #include "MantidMDAlgorithms/PreprocessDetectorsToMD.h"
diff --git a/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h b/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h
index d87f587291b..ca15c53ee7d 100644
--- a/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h
+++ b/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h
@@ -5,6 +5,7 @@
 #include "MantidAPI/Sample.h"
 #include "MantidDataObjects/EventWorkspace.h"
 #include "MantidGeometry/Crystal/OrientedLattice.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidKernel/make_unique.h"
 #include "MantidMDAlgorithms/ConvertToMD.h"
 #include "MantidMDAlgorithms/MDWSDescription.h"
diff --git a/Framework/MDAlgorithms/test/MDTransfModQTest.h b/Framework/MDAlgorithms/test/MDTransfModQTest.h
index ebf41740f5d..8d4abe7cf82 100644
--- a/Framework/MDAlgorithms/test/MDTransfModQTest.h
+++ b/Framework/MDAlgorithms/test/MDTransfModQTest.h
@@ -3,6 +3,7 @@
 
 #include "MantidMDAlgorithms/MDTransfQ3D.h"
 #include "MantidKernel/DeltaEMode.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 #include "MantidTestHelpers/MDEventsTestHelper.h"
 
diff --git a/Framework/MDAlgorithms/test/MDTransfQ3DTest.h b/Framework/MDAlgorithms/test/MDTransfQ3DTest.h
index af94840ef93..cfe87617ea4 100644
--- a/Framework/MDAlgorithms/test/MDTransfQ3DTest.h
+++ b/Framework/MDAlgorithms/test/MDTransfQ3DTest.h
@@ -2,6 +2,7 @@
 #define MANTID_MDALGORITHMS_MDTRANSFQ3D_H_
 
 #include "MantidKernel/DeltaEMode.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidMDAlgorithms/MDTransfQ3D.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 
diff --git a/Framework/MDAlgorithms/test/MDWSDescriptionTest.h b/Framework/MDAlgorithms/test/MDWSDescriptionTest.h
index 9fb059d6e73..2d7551bb66f 100644
--- a/Framework/MDAlgorithms/test/MDWSDescriptionTest.h
+++ b/Framework/MDAlgorithms/test/MDWSDescriptionTest.h
@@ -3,6 +3,7 @@
 
 #include "MantidKernel/SpecialCoordinateSystem.h"
 #include "MantidKernel/Exception.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidMDAlgorithms/MDWSDescription.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 
diff --git a/Framework/MDAlgorithms/test/MDWSTransfTest.h b/Framework/MDAlgorithms/test/MDWSTransfTest.h
index 3a2a7fb0a82..9d854a87bcf 100644
--- a/Framework/MDAlgorithms/test/MDWSTransfTest.h
+++ b/Framework/MDAlgorithms/test/MDWSTransfTest.h
@@ -2,6 +2,7 @@
 #define MANTID_MDWS_SLICE_H_
 
 #include "MantidGeometry/Crystal/OrientedLattice.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidMDAlgorithms/MDTransfAxisNames.h"
 #include "MantidMDAlgorithms/MDWSDescription.h"
 #include "MantidMDAlgorithms/MDWSTransform.h"
diff --git a/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h b/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h
index d7342eb59ea..29d9d88be4c 100644
--- a/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h
+++ b/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h
@@ -2,6 +2,7 @@
 #define MDALGORITHMS_PREPROCESS_DETECTORS2MD_TEST_H_
 
 #include <cxxtest/TestSuite.h>
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidMDAlgorithms/PreprocessDetectorsToMD.h"
 #include "MantidTestHelpers/WorkspaceCreationHelper.h"
 
@@ -334,4 +335,4 @@ public:
   }
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/Framework/MDAlgorithms/test/SaveMD2Test.h b/Framework/MDAlgorithms/test/SaveMD2Test.h
index 6a036d06ad8..85c4b9e2704 100644
--- a/Framework/MDAlgorithms/test/SaveMD2Test.h
+++ b/Framework/MDAlgorithms/test/SaveMD2Test.h
@@ -4,6 +4,7 @@
 #include "MantidAPI/IMDEventWorkspace.h"
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/Run.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidDataObjects/MDEventFactory.h"
 #include "MantidMDAlgorithms/BinMD.h"
 #include "MantidMDAlgorithms/SaveMD2.h"
diff --git a/Framework/MDAlgorithms/test/SaveMDTest.h b/Framework/MDAlgorithms/test/SaveMDTest.h
index 3c4612a404b..a53feb583d2 100644
--- a/Framework/MDAlgorithms/test/SaveMDTest.h
+++ b/Framework/MDAlgorithms/test/SaveMDTest.h
@@ -5,6 +5,7 @@
 #include "MantidAPI/FrameworkManager.h"
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidAPI/Run.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidDataObjects/MDEventFactory.h"
 #include "MantidMDAlgorithms/BinMD.h"
 #include "MantidMDAlgorithms/SaveMD.h"
diff --git a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
index b1f22b7b74f..d5ce5faabfe 100644
--- a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
+++ b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
@@ -22,6 +22,7 @@
 #include "MantidAPI/WorkspaceGroup.h"
 #include "MantidDataObjects/PeaksWorkspace.h"
 #include "MantidGeometry/Instrument/Detector.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidGeometry/Instrument/ParameterMap.h"
 #include "MantidGeometry/Instrument/ReferenceFrame.h"
 #include "MantidGeometry/Instrument/Component.h"
diff --git a/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp b/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp
index 998a2b34757..7adf2e811d1 100644
--- a/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp
+++ b/MantidQt/SpectrumViewer/src/MatrixWSDataSource.cpp
@@ -15,6 +15,7 @@
 #include "MantidAPI/MatrixWorkspace.h"
 #include "MantidAPI/ISpectrum.h"
 #include "MantidGeometry/Instrument/Detector.h"
+#include "MantidGeometry/Instrument/Goniometer.h"
 #include "MantidGeometry/Instrument.h"
 #include "MantidKernel/Logger.h"
 #include "MantidKernel/Unit.h"
-- 
GitLab