Mantid
Loading...
Searching...
No Matches
IPeaksWorkspace.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidAPI/DllConfig.h"
19#include <optional>
20
21namespace Mantid {
22namespace Geometry {
23class IPeak;
24}
25namespace API {
26
27//==========================================================================================
35class MANTID_API_DLL IPeaksWorkspace : public ITableWorkspace, public Mantid::API::ExperimentInfo {
36public:
39 : ITableWorkspace(), ExperimentInfo(), m_convention(Kernel::ConfigService::Instance().getString("Q.convention")) {
40 }
41
43 IPeaksWorkspace_uptr clone() const { return IPeaksWorkspace_uptr(doClone()); }
44 IPeaksWorkspace &operator=(const IPeaksWorkspace &other) = delete;
45 //---------------------------------------------------------------------------------------------
48 virtual int getNumberPeaks() const = 0;
49
50 //---------------------------------------------------------------------------------------------
53 virtual std::string getConvention() const = 0;
54
55 //---------------------------------------------------------------------------------------------
59 virtual void removePeak(int peakNum) = 0;
60
61 virtual void removePeaks(std::vector<int> badPeaks) = 0;
62
63 //---------------------------------------------------------------------------------------------
67 virtual void addPeak(const Mantid::Geometry::IPeak &ipeak) = 0;
68
69 //---------------------------------------------------------------------------------------------
74 virtual void addPeak(const Kernel::V3D &position, const Kernel::SpecialCoordinateSystem &frame) = 0;
75
76 //---------------------------------------------------------------------------------------------
81 virtual Mantid::Geometry::IPeak &getPeak(size_t const peakNum) = 0;
82
83 //---------------------------------------------------------------------------------------------
88 virtual const Mantid::Geometry::IPeak &getPeak(size_t const peakNum) const = 0;
89
90 //---------------------------------------------------------------------------------------------
95 Mantid::Geometry::IPeak *getPeakPtr(size_t const peakNum) { return &this->getPeak(peakNum); }
96
97 //---------------------------------------------------------------------------------------------
105 virtual std::unique_ptr<Geometry::IPeak> createPeak(const Mantid::Kernel::V3D &QLabFrame,
106 std::optional<double> detectorDistance = std::nullopt) const = 0;
107
108 //---------------------------------------------------------------------------------------------
114 virtual std::unique_ptr<Mantid::Geometry::IPeak>
116
117 //---------------------------------------------------------------------------------------------
122 virtual std::unique_ptr<Mantid::Geometry::IPeak> createPeakQSample(const Mantid::Kernel::V3D &position) const = 0;
123
129 virtual std::unique_ptr<Geometry::IPeak> createPeakHKL(const Mantid::Kernel::V3D &HKL) const = 0;
130
135 virtual std::unique_ptr<Geometry::IPeak> createPeak() const = 0;
136
137 //---------------------------------------------------------------------------------------------
142 virtual bool hasIntegratedPeaks() const = 0;
143
144 //---------------------------------------------------------------------------------------------
152
153 //---------------------------------------------------------------------------------------------
158 virtual void setCoordinateSystem(const Kernel::SpecialCoordinateSystem coordinateSystem) = 0;
159 //---------------------------------------------------------------------------------------------
166
167 virtual std::vector<std::pair<std::string, std::string>> peakInfo(const Kernel::V3D &QFrame,
168 bool labCoords) const = 0;
169 virtual int peakInfoNumber(const Kernel::V3D &qLabFrame, bool labCoords) const = 0;
170
171 //---------------------------------------------------------------------------------------------
172 virtual void saveNexus(Nexus::File *file) const = 0;
173
174 std::string m_convention;
175
176protected:
179
180 const std::string toString() const override;
181
182private:
183 IPeaksWorkspace *doClone() const override = 0;
184};
185} // namespace API
186} // namespace Mantid
187
188// Instantiated and exported by API/src/PropertyWithValue.cpp
189MANTID_API_EXTERN_TEMPLATE(Mantid::Kernel::PropertyWithValue<std::shared_ptr<Mantid::API::IPeaksWorkspace>>);
double position
Definition GetAllEi.cpp:154
MANTID_API_EXTERN_TEMPLATE(Mantid::Kernel::PropertyWithValue< std::shared_ptr< Mantid::API::IPeaksWorkspace > >)
This class is shared by a few Workspace types and holds information related to a particular experimen...
Interface to the class Mantid::DataObjects::PeaksWorkspace.
virtual void addPeak(const Kernel::V3D &position, const Kernel::SpecialCoordinateSystem &frame)=0
Add a peak to the list.
virtual Kernel::SpecialCoordinateSystem getSpecialCoordinateSystem() const =0
Get the special coordinate system.
virtual bool hasIntegratedPeaks() const =0
Determine if the workspace has been integrated using a peaks integration algorithm.
virtual API::ITableWorkspace_sptr createDetectorTable() const =0
Creates a new TableWorkspace giving the IDs of the detectors that contribute to the peak.
virtual void removePeak(int peakNum)=0
Removes the indicated peak.
virtual void removePeaks(std::vector< int > badPeaks)=0
virtual void addPeak(const Mantid::Geometry::IPeak &ipeak)=0
Add a peak to the list.
virtual int peakInfoNumber(const Kernel::V3D &qLabFrame, bool labCoords) const =0
virtual std::unique_ptr< Geometry::IPeak > createPeak() const =0
Create an instance of a peak using default constructor.
virtual std::vector< std::pair< std::string, std::string > > peakInfo(const Kernel::V3D &QFrame, bool labCoords) const =0
virtual std::string getConvention() const =0
virtual void saveNexus(Nexus::File *file) const =0
IPeaksWorkspace(const IPeaksWorkspace &)=default
Protected copy constructor. May be used by childs for cloning.
virtual const Mantid::Geometry::IPeak & getPeak(size_t const peakNum) const =0
Return a reference to the Peak (const version)
virtual std::unique_ptr< Mantid::Geometry::IPeak > createPeak(const Mantid::Kernel::V3D &position, const Mantid::Kernel::SpecialCoordinateSystem &frame) const =0
Create an instance of a Peak.
IPeaksWorkspace & operator=(const IPeaksWorkspace &other)=delete
virtual void setCoordinateSystem(const Kernel::SpecialCoordinateSystem coordinateSystem)=0
Set the special coordinate system.
virtual std::unique_ptr< Geometry::IPeak > createPeakHKL(const Mantid::Kernel::V3D &HKL) const =0
Create an instance of a peak using a V3D.
IPeaksWorkspace * doClone() const override=0
Virtual clone method. Not implemented to force implementation in children.
virtual std::unique_ptr< Geometry::IPeak > createPeak(const Mantid::Kernel::V3D &QLabFrame, std::optional< double > detectorDistance=std::nullopt) const =0
Create an instance of a Peak.
Mantid::Geometry::IPeak * getPeakPtr(size_t const peakNum)
Return a pointer to the Peak.
virtual Mantid::Geometry::IPeak & getPeak(size_t const peakNum)=0
Return a reference to the Peak.
virtual int getNumberPeaks() const =0
virtual std::unique_ptr< Mantid::Geometry::IPeak > createPeakQSample(const Mantid::Kernel::V3D &position) const =0
Create an instance of a Peak.
IPeaksWorkspace_uptr clone() const
Returns a clone of the workspace.
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same ...
HKL : HKL MDFrame.
Definition HKL.h:20
Structure describing a single-crystal peak.
Definition IPeak.h:26
The concrete, templated class for properties.
Class for 3D vectors.
Definition V3D.h:35
std::unique_ptr< IPeaksWorkspace > IPeaksWorkspace_uptr
unique pointer to Mantid::API::IPeaksWorkspace
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
Mantid::Kernel::SingletonHolder< ConfigServiceImpl > ConfigService
std::string toString(const T &value)
Convert values to strings.
SpecialCoordinateSystem
Special coordinate systems for Q3D.
Helper class which provides the Collimation Length for SANS instruments.