// Mantid Repository : https://github.com/mantidproject/mantid // // Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + #pragma once #include "MantidDataObjects/BasePeak.h" #include "MantidGeometry/Crystal/IPeak.h" #include "MantidGeometry/Instrument/ReferenceFrame.h" #include "MantidKernel/Logger.h" #include "MantidKernel/Matrix.h" #include "MantidKernel/PhysicalConstants.h" #include "MantidKernel/System.h" #include "MantidKernel/V3D.h" #include #include namespace Mantid { namespace DataObjects { /** Structure describing a single-crystal peak. This is a version of * Peak that doesn't require the instrument and also assuming elastic * scattering. The peak is described only by the Q-sample * position. Optionally if the wavelength and goniometer is provided * other properties can be calculated. * */ class DLLExport LeanElasticPeak : public BasePeak { public: /// Allow PeakColumn class to directly access members. friend class PeakColumn; LeanElasticPeak(); LeanElasticPeak(const Mantid::Kernel::V3D &QSampleFrame); LeanElasticPeak(const Mantid::Kernel::V3D &QSampleFrame, const Mantid::Kernel::Matrix &goniometer, boost::optional> refFrame = boost::none); LeanElasticPeak(const Mantid::Kernel::V3D &QSampleFrame, double wavelength); /// Copy constructor LeanElasticPeak(const LeanElasticPeak &other); // MSVC 2015/17 can build with noexcept = default however // intellisense still incorrectly reports this as an error despite compiling. // https://connect.microsoft.com/VisualStudio/feedback/details/1795240/visual-c-2015-default-move-constructor-and-noexcept-keyword-bug // For that reason we still use the supplied default which should be noexcept // once the above is fixed we can remove this workaround #if defined(_MSC_VER) && _MSC_VER <= 1910 LeanElasticPeak(LeanElasticPeak &&) = default; LeanElasticPeak &operator=(LeanElasticPeak &&) = default; #else LeanElasticPeak(LeanElasticPeak &&) noexcept = default; LeanElasticPeak &operator=(LeanElasticPeak &&) noexcept = default; #endif // Construct a peak from a reference to the interface explicit LeanElasticPeak(const Geometry::IPeak &ipeak); void setDetectorID(int) override; int getDetectorID() const override; void setInstrument(const Geometry::Instrument_const_sptr &) override; Geometry::IDetector_const_sptr getDetector() const override; Geometry::Instrument_const_sptr getInstrument() const override; std::shared_ptr 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; 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 = boost::none) override; void setQSampleFrame(const Mantid::Kernel::V3D &QSampleFrame, const Mantid::Kernel::Matrix &goniometer); void setQLabFrame(const Mantid::Kernel::V3D &qLab, boost::optional = boost::none) override; void setWavelength(double wavelength) override; double getWavelength() const override; double getScattering() const override; double getAzimuthal() const override; double getDSpacing() const override; double getTOF() const override; double getInitialEnergy() const override; double getFinalEnergy() const override; double getEnergyTransfer() const override; void setInitialEnergy(double m_initialEnergy) override; void setFinalEnergy(double m_finalEnergy) override; virtual Mantid::Kernel::V3D getDetPos() const override; virtual Mantid::Kernel::V3D getSamplePos() const override; double getL1() const override; double getL2() const override; /// Assignment LeanElasticPeak &operator=(const LeanElasticPeak &other); private: void setReferenceFrame(std::shared_ptr frame); /// Q_sample vector Mantid::Kernel::V3D m_Qsample; /// Wavelength of neutrons at the peak double m_wavelength; std::shared_ptr m_refFrame; /// Static logger static Mantid::Kernel::Logger g_log; }; } // namespace DataObjects } // namespace Mantid