diff --git a/Framework/Crystal/src/PeaksIntersection.cpp b/Framework/Crystal/src/PeaksIntersection.cpp index a713553ed21c36bcad1f8f7085185792743fa6cd..3ce65e3a241e934a7244905d27ee016cbc0946f2 100644 --- a/Framework/Crystal/src/PeaksIntersection.cpp +++ b/Framework/Crystal/src/PeaksIntersection.cpp @@ -18,6 +18,7 @@ using namespace Mantid::Geometry; using namespace Mantid::Kernel; using Mantid::DataObjects::PeaksWorkspace; using Mantid::DataObjects::PeaksWorkspace_sptr; +using Mantid::DataObjects::Peak; namespace Mantid { namespace Crystal { @@ -81,7 +82,7 @@ void PeaksIntersection::executePeaksIntersection(const bool checkPeakExtents) { // Find the coordinate frame to use an set up boost function for this. boost::function<V3D(IPeak *)> coordFrameFunc = &IPeak::getHKL; if (coordinateFrame == detectorSpaceFrame()) { - coordFrameFunc = &IPeak::getDetectorPosition; + coordFrameFunc = &Peak::getDetectorPosition; } else if (coordinateFrame == qLabFrame()) { coordFrameFunc = &IPeak::getQLabFrame; } else if (coordinateFrame == qSampleFrame()) { diff --git a/Framework/Crystal/test/AddPeakHKLTest.h b/Framework/Crystal/test/AddPeakHKLTest.h index 1caad2ef787b95faee520aa6592421d87424176c..eeb83986e8aa672e885789a825ba624a6762bdeb 100644 --- a/Framework/Crystal/test/AddPeakHKLTest.h +++ b/Framework/Crystal/test/AddPeakHKLTest.h @@ -96,8 +96,7 @@ public: IPeaksWorkspace_sptr ws_out = alg.getProperty("Workspace"); // Get the peak just added. - const IPeak &peak = ws_out->getPeak(0); - + auto peak = dynamic_cast<const Peak&>(ws_out->getPeak(0)); /* Now we check we have made a self - consistent peak */ @@ -113,7 +112,7 @@ public: TSM_ASSERT_EQUALS("This detector id does not match what we expect from the " "instrument definition", 1, detector->getID()); - TSM_ASSERT_EQUALS("Thie detector position is wrong", detectorPos, + TSM_ASSERT_EQUALS("This detector position is wrong", detectorPos, detector->getPos()); TSM_ASSERT_EQUALS("Goniometer has not been set properly", goniometer.getR(), peak.getGoniometerMatrix()); diff --git a/Framework/DataObjects/inc/MantidDataObjects/LeanElasticPeak.h b/Framework/DataObjects/inc/MantidDataObjects/LeanElasticPeak.h index f05a958380e29cf361501a4bc54dfd76d1e38529..177a1e0b5313ccbf2b182a0c3b1704c08b8a6097 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/LeanElasticPeak.h +++ b/Framework/DataObjects/inc/MantidDataObjects/LeanElasticPeak.h @@ -57,7 +57,6 @@ public: // Construct a peak from a reference to the interface explicit LeanElasticPeak(const Geometry::IPeak &ipeak); - Geometry::IDetector_const_sptr getDetector() const override; std::shared_ptr<const Geometry::ReferenceFrame> getReferenceFrame() const override; @@ -66,8 +65,6 @@ public: Mantid::Kernel::V3D getQLabFrame() const override; Mantid::Kernel::V3D getQSampleFrame() const override; - Mantid::Kernel::V3D getDetectorPosition() const override; - Mantid::Kernel::V3D getDetectorPositionNoCheck() const override; void setQSampleFrame(const Mantid::Kernel::V3D &QSampleFrame, boost::optional<double> = boost::none) override; diff --git a/Framework/DataObjects/inc/MantidDataObjects/Peak.h b/Framework/DataObjects/inc/MantidDataObjects/Peak.h index cf6f0eb65368c7a2b8a1585653cea463159027c9..a9b0b469942a493ba54ec99045511257826dfd24 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/Peak.h +++ b/Framework/DataObjects/inc/MantidDataObjects/Peak.h @@ -85,7 +85,7 @@ public: const std::set<int> &getContributingDetIDs() const; void setInstrument(const Geometry::Instrument_const_sptr &inst); - Geometry::IDetector_const_sptr getDetector() const override; + Geometry::IDetector_const_sptr getDetector() const; Geometry::Instrument_const_sptr getInstrument() const; std::shared_ptr<const Geometry::ReferenceFrame> getReferenceFrame() const override; @@ -98,8 +98,8 @@ public: Mantid::Kernel::V3D getQLabFrame() const override; Mantid::Kernel::V3D getQSampleFrame() const override; - Mantid::Kernel::V3D getDetectorPosition() const override; - Mantid::Kernel::V3D getDetectorPositionNoCheck() const override; + Mantid::Kernel::V3D getDetectorPosition() const; + Mantid::Kernel::V3D getDetectorPositionNoCheck() const; void setQSampleFrame( const Mantid::Kernel::V3D &QSampleFrame, diff --git a/Framework/DataObjects/src/LeanElasticPeak.cpp b/Framework/DataObjects/src/LeanElasticPeak.cpp index 5c100f1b2d2172bee5213f863982fb36610ff03c..78ef70a7c3a53f5e3b173f275a5f76e1f0e89d9a 100644 --- a/Framework/DataObjects/src/LeanElasticPeak.cpp +++ b/Framework/DataObjects/src/LeanElasticPeak.cpp @@ -99,13 +99,6 @@ void LeanElasticPeak::setWavelength(double wavelength) { m_wavelength = wavelength; } -//---------------------------------------------------------------------------------------------- -/** Return a shared ptr to the detector at center of peak. */ -Geometry::IDetector_const_sptr LeanElasticPeak::getDetector() const { - throw Exception::NotImplementedError( - "LeanElasticPeak::getDetector(): Has no detector ID"); -} - /** Return a shared ptr to the reference frame for this peak. */ std::shared_ptr<const Geometry::ReferenceFrame> LeanElasticPeak::getReferenceFrame() const { @@ -305,23 +298,6 @@ LeanElasticPeak &LeanElasticPeak::operator=(const LeanElasticPeak &other) { return *this; } -/** - Forwarding function. Exposes the detector position directly. - */ -Mantid::Kernel::V3D LeanElasticPeak::getDetectorPositionNoCheck() const { - throw Exception::NotImplementedError( - "LeanElasticPeak has no detector information"); -} - -/** - Forwarding function. Exposes the detector position directly, but checks that - the detector is not null before accessing its position. Throws if null. - */ -Mantid::Kernel::V3D LeanElasticPeak::getDetectorPosition() const { - throw Exception::NotImplementedError( - "LeanElasticPeak has no detector information"); -} - Mantid::Kernel::Logger LeanElasticPeak::g_log("PeakLogger"); } // namespace DataObjects diff --git a/Framework/DataObjects/test/LeanElasticPeakTest.h b/Framework/DataObjects/test/LeanElasticPeakTest.h index d1a50ae394c1b22594760ad3bc3828378a898efe..723ad67eafaf2a63c388dbab14966c0188f1ab76 100644 --- a/Framework/DataObjects/test/LeanElasticPeakTest.h +++ b/Framework/DataObjects/test/LeanElasticPeakTest.h @@ -38,11 +38,6 @@ public: TS_ASSERT_EQUALS(p.getQSampleFrame(), V3D(0, 0, 0)) TS_ASSERT_EQUALS(p.getQLabFrame(), V3D()) - TS_ASSERT_THROWS(p.getDetector(), const Exception::NotImplementedError &) - TS_ASSERT_THROWS(p.getDetectorPosition(), - const Exception::NotImplementedError &) - TS_ASSERT_THROWS(p.getDetectorPositionNoCheck(), - const Exception::NotImplementedError &) TS_ASSERT_THROWS(p.getDetPos(), const Exception::NotImplementedError &) TS_ASSERT_THROWS(p.getSamplePos(), const Exception::NotImplementedError &) TS_ASSERT_THROWS(p.getTOF(), const Exception::NotImplementedError &) @@ -330,8 +325,5 @@ public: TS_ASSERT_EQUALS(leanpeak.getBinCount(), peak.getBinCount()); TS_ASSERT_EQUALS(leanpeak.getBinCount(), 90); - - TS_ASSERT_THROWS(leanpeak.getDetector(), - const Exception::NotImplementedError &) } }; diff --git a/Framework/Geometry/inc/MantidGeometry/Crystal/IPeak.h b/Framework/Geometry/inc/MantidGeometry/Crystal/IPeak.h index d1ad3dce179c2594a2b784c8decd90b43639f344..e79b1f40e21f3cd5b9816d67e036821d2c92db14 100644 --- a/Framework/Geometry/inc/MantidGeometry/Crystal/IPeak.h +++ b/Framework/Geometry/inc/MantidGeometry/Crystal/IPeak.h @@ -26,7 +26,6 @@ class InstrumentRayTracer; class MANTID_GEOMETRY_DLL IPeak { public: virtual ~IPeak() = default; - virtual Geometry::IDetector_const_sptr getDetector() const = 0; virtual std::shared_ptr<const Geometry::ReferenceFrame> getReferenceFrame() const = 0; @@ -51,8 +50,6 @@ public: virtual void setSamplePos(double samX, double samY, double samZ) = 0; virtual void setSamplePos(const Mantid::Kernel::V3D &XYZ) = 0; virtual Mantid::Kernel::V3D getSamplePos() const = 0; - virtual Mantid::Kernel::V3D getDetectorPosition() const = 0; - virtual Mantid::Kernel::V3D getDetectorPositionNoCheck() const = 0; virtual Mantid::Kernel::V3D getQLabFrame() const = 0; virtual Mantid::Kernel::V3D getQSampleFrame() const = 0; diff --git a/Framework/Geometry/test/MockObjects.h b/Framework/Geometry/test/MockObjects.h index 16aa90434cf64837203baae19d7c57a92f2378f6..d3eb35d6ff01583cd2657f40d9fe67b7a1eb0fb9 100644 --- a/Framework/Geometry/test/MockObjects.h +++ b/Framework/Geometry/test/MockObjects.h @@ -64,7 +64,6 @@ Mock IPeak ------------------------------------------------------------*/ class MockIPeak : public Mantid::Geometry::IPeak { public: - MOCK_CONST_METHOD0(getDetector, Geometry::IDetector_const_sptr()); MOCK_CONST_METHOD0(getReferenceFrame, std::shared_ptr<const Geometry::ReferenceFrame>()); MOCK_CONST_METHOD0(getRunNumber, int()); @@ -126,8 +125,6 @@ public: MOCK_CONST_METHOD0(getDetPos, Mantid::Kernel::V3D()); MOCK_CONST_METHOD0(getL1, double()); MOCK_CONST_METHOD0(getL2, double()); - MOCK_CONST_METHOD0(getDetectorPosition, Mantid::Kernel::V3D()); - MOCK_CONST_METHOD0(getDetectorPositionNoCheck, Mantid::Kernel::V3D()); MOCK_CONST_METHOD0(getPeakShape, const Mantid::Geometry::PeakShape &()); MOCK_METHOD1(setPeakShape, void(Mantid::Geometry::PeakShape *shape)); MOCK_METHOD1(setPeakShape,