Commit d81c16c9 authored by Jose Borreguero's avatar Jose Borreguero
Browse files

Refs #30857 remove findDetector from the Peak interface

parent 7e4dfc72
......@@ -35,6 +35,10 @@ using namespace Mantid::Kernel;
namespace Crystal {
// handy shortcuts
using Mantid::Geometry::IPeak_uptr;
using Mantid::DataObjects::Peak_uptr;
DECLARE_ALGORITHM(PredictSatellitePeaks)
/** Constructor
......@@ -358,7 +362,8 @@ void PredictSatellitePeaks::predictOffsets(
if (Qs.Z() * m_qConventionFactor <= 0)
continue;
auto peak(Peaks->createPeak(Qs, 1));
IPeak_uptr iPeak = Peaks->createPeak(Qs, 1);
Peak_uptr peak(static_cast<DataObjects::Peak*>(iPeak.release()));
peak->setGoniometerMatrix(goniometer);
......@@ -430,7 +435,8 @@ void PredictSatellitePeaks::predictOffsetsWithCrossTerms(
if (Qs.Z() * m_qConventionFactor <= 0)
continue;
auto peak(Peaks->createPeak(Qs, 1));
IPeak_uptr iPeak(Peaks->createPeak(Qs, 1));
Peak_uptr peak(static_cast<DataObjects::Peak*>(iPeak.release()));
peak->setGoniometerMatrix(goniometer);
......
......@@ -69,8 +69,10 @@ public:
std::shared_ptr<const Geometry::ReferenceFrame>
getReferenceFrame() const override;
/*
bool findDetector() override;
bool findDetector(const Geometry::InstrumentRayTracer &) override;
*/
void setSamplePos(double, double, double) override;
void setSamplePos(const Mantid::Kernel::V3D &) override;
......
......@@ -88,8 +88,12 @@ public:
std::shared_ptr<const Geometry::ReferenceFrame>
getReferenceFrame() const override;
/*
bool findDetector() override;
bool findDetector(const Geometry::InstrumentRayTracer &tracer) override;
*/
bool findDetector();
bool findDetector(const Geometry::InstrumentRayTracer &tracer);
void setSamplePos(double samX, double samY, double samZ) override;
void setSamplePos(const Mantid::Kernel::V3D &XYZ) override;
......@@ -163,5 +167,7 @@ private:
static Mantid::Kernel::Logger g_log;
};
using Peak_uptr = std::unique_ptr<Peak>;
} // namespace DataObjects
} // namespace Mantid
......@@ -345,10 +345,12 @@ LeanElasticPeak &LeanElasticPeak::operator=(const LeanElasticPeak &other) {
*
* @return true if the detector ID was found.
*/
/*
bool LeanElasticPeak::findDetector() {
throw Exception::NotImplementedError(
"LeanElasticPeak has no detector information");
}
*/
/**
* Performs the same algorithm as findDetector() but uses a pre-existing
......@@ -357,10 +359,12 @@ bool LeanElasticPeak::findDetector() {
* over the same instrument.
* @return true if the detector ID was found.
*/
/*
bool LeanElasticPeak::findDetector(const InstrumentRayTracer &) {
throw Exception::NotImplementedError(
"LeanElasticPeak has no detector information");
}
*/
/**
Forwarding function. Exposes the detector position directly.
......
......@@ -390,7 +390,9 @@ PeaksWorkspace::peakInfo(const Kernel::V3D &qFrame, bool labCoords) const {
}
try {
auto peak = createPeak(Qlab);
IPeak_uptr iPeak = createPeak(Qlab);
Peak_uptr peak(static_cast<DataObjects::Peak*>(iPeak.release()));
if (sample().hasOrientedLattice()) {
peak->setGoniometerMatrix(Gon);
......
......@@ -41,7 +41,9 @@ public:
TS_ASSERT_EQUALS(p.getDetectorID(), -1)
TS_ASSERT_THROWS(p.getDetector(), const Exception::NotImplementedError &)
TS_ASSERT_THROWS(p.getInstrument(), const Exception::NotImplementedError &)
/*
TS_ASSERT_THROWS(p.findDetector(), const Exception::NotImplementedError &)
*/
TS_ASSERT_THROWS(p.getDetectorPosition(),
const Exception::NotImplementedError &)
TS_ASSERT_THROWS(p.getDetectorPositionNoCheck(),
......
......@@ -62,9 +62,10 @@ public:
virtual Mantid::Kernel::V3D getQLabFrame() const = 0;
virtual Mantid::Kernel::V3D getQSampleFrame() const = 0;
/*
virtual bool findDetector() = 0;
virtual bool findDetector(const InstrumentRayTracer &tracer) = 0;
*/
virtual void setQSampleFrame(const Mantid::Kernel::V3D &QSampleFrame,
boost::optional<double> detectorDistance) = 0;
virtual void setQLabFrame(const Mantid::Kernel::V3D &QLabFrame,
......@@ -116,5 +117,7 @@ public:
virtual double getAbsorptionWeightedPathLength() const = 0;
};
using IPeak_uptr = std::unique_ptr<IPeak>;
} // namespace Geometry
} // namespace Mantid
......@@ -97,9 +97,11 @@ public:
MOCK_METHOD1(setSamplePos, void(const Mantid::Kernel::V3D &XYZ));
MOCK_CONST_METHOD0(getQLabFrame, Mantid::Kernel::V3D());
MOCK_CONST_METHOD0(getQSampleFrame, Mantid::Kernel::V3D());
/*
MOCK_METHOD0(findDetector, bool());
MOCK_METHOD1(findDetector,
bool(const Mantid::Geometry::InstrumentRayTracer &tracer));
*/
MOCK_METHOD2(setQSampleFrame, void(const Mantid::Kernel::V3D &QSampleFrame,
boost::optional<double> detectorDistance));
MOCK_METHOD2(setQLabFrame, void(const Mantid::Kernel::V3D &QLabFrame,
......
......@@ -99,8 +99,7 @@ void CentroidPeaksMD::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) {
// cppcheck-suppress syntaxError
PRAGMA_OMP(parallel for schedule(dynamic, 10) )
for (int i = 0; i < int(peakWS->getNumberPeaks()); ++i) {
// Get a direct ref to that peak.
IPeak &p = peakWS->getPeak(i);
Peak &p = peakWS->getPeak(i);
double detectorDistance = p.getL2();
// Get the peak center as a position in the dimensions of the workspace
......
......@@ -83,7 +83,7 @@ void CentroidPeaksMD2::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) {
PRAGMA_OMP(parallel for schedule(dynamic, 10) )
for (int i = 0; i < int(peakWS->getNumberPeaks()); ++i) {
// Get a direct ref to that peak.
IPeak &p = peakWS->getPeak(i);
Peak &p = peakWS->getPeak(i);
double detectorDistance = p.getL2();
// Get the peak center as a position in the dimensions of the workspace
......
......@@ -123,11 +123,13 @@ void export_IPeak() {
":class:`~mantid.geometry.Goniometer` rotation was NOT taken "
"out.\n"
"Note: There is no 2*pi factor used, so \\|Q| = 1/wavelength.")
/*
.def("findDetector", (bool (IPeak::*)()) & IPeak::findDetector,
arg("self"),
"Using the :class:`~mantid.geometry.Instrument` set in the peak, "
"perform ray tracing to find "
"the exact :class:`~mantid.geometry.Detector`.")
*/
.def("getQSampleFrame", &IPeak::getQSampleFrame, arg("self"),
"Return the Q change (of the lattice, k_i - k_f) for this peak."
"The Q is in the Sample frame: the "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment