10#include "MantidCrystal/DllConfig.h"
11#include "MantidHistogramData/HistogramX.h"
12#include "MantidHistogramData/HistogramY.h"
17#include <boost/optional.hpp>
29namespace FindSXPeaksHelper {
40 SXPeak(
double t,
double phi,
double intensity,
const std::vector<int> &spectral,
const size_t wsIndex,
49 bool compare(
const SXPeak &
rhs,
const double xTolerance,
const double phiTolerance,
const double thetaTolerance,
50 const XAxisUnit tofUnits = XAxisUnit::TOF)
const;
62 os <<
rhs.m_tof <<
"," <<
rhs.m_twoTheta <<
"," <<
rhs.m_phi <<
"," <<
rhs.m_intensity <<
"\n";
64 std::copy(
rhs.m_spectra.begin(),
rhs.m_spectra.end(), std::ostream_iterator<int>(os,
","));
68 const double &getIntensity()
const;
99using yIt = Mantid::HistogramData::HistogramY::const_iterator;
100using Bound = HistogramData::HistogramX::const_iterator;
102using PeakList = boost::optional<std::vector<SXPeak>>;
114 const HistogramData::HistogramY &
m_y;
127 virtual bool isBelowBackground(
const double intensity,
const HistogramData::HistogramY &y)
const = 0;
132 bool isBelowBackground(
const double intensity,
const HistogramData::HistogramY &)
const override;
135 double m_background = 0.;
140 bool isBelowBackground(
const double intensity,
const HistogramData::HistogramY &
y)
const override;
143 double m_backgroundMultiplier = 1.;
156 PeakList findSXPeaks(
const HistogramData::HistogramX &x,
const HistogramData::HistogramY &y,
157 const int workspaceIndex)
const;
160 BoundsIterator getBounds(
const HistogramData::HistogramX &x)
const;
161 double calculatePhi(
size_t workspaceIndex)
const;
162 double getXValue(
const HistogramData::HistogramX &x,
const size_t peakLocation)
const;
163 double convertToTOF(
const double xValue,
const size_t workspaceIndex)
const;
165 Bound high,
const int workspaceIndex)
const = 0;
179 PeakList dofindSXPeaks(
const HistogramData::HistogramX &
x,
const HistogramData::HistogramY &
y,
Bound low,
Bound high,
180 const int workspaceIndex)
const override;
188 PeakList dofindSXPeaks(
const HistogramData::HistogramX &
x,
const HistogramData::HistogramY &
y,
Bound low,
Bound high,
189 const int workspaceIndex)
const override;
192 std::vector<std::unique_ptr<PeakContainer>>
193 getAllPeaks(
const HistogramData::HistogramX &
x,
const HistogramData::HistogramY &
y,
Bound low,
Bound high,
195 PeakList convertToSXPeaks(
const HistogramData::HistogramX &
x,
const HistogramData::HistogramY &
y,
196 const std::vector<std::unique_ptr<PeakContainer>> &peaks,
const int workspaceIndex)
const;
220 AbsoluteCompareStrategy(
const double tofResolution,
const double phiResolution,
const double twoThetaResolution,
239 virtual std::vector<SXPeak>
reduce(
const std::vector<SXPeak> &peaks,
258 std::vector<std::vector<SXPeak *>> getPeakGroups(
const std::vector<SXPeak> &peakList,
260 std::vector<SXPeak> getFinalPeaks(
const std::vector<std::vector<SXPeak *>> &peakGroups)
const;
const std::vector< double > & rhs
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
double m_twoThetaResolution
const double m_xUnitResolution
virtual bool compare(const SXPeak &lhs, const SXPeak &rhs) const =0
virtual ~CompareStrategy()=default
void startRecord(yIt item)
yIt getMaxIterator() const
const HistogramData::HistogramY & m_y
void stopRecord(yIt item)
size_t getNumberOfPointsInPeak() const
const BackgroundStrategy * m_backgroundStrategy
virtual ~PeakFindingStrategy()=default
virtual PeakList dofindSXPeaks(const HistogramData::HistogramX &x, const HistogramData::HistogramY &y, Bound low, Bound high, const int workspaceIndex) const =0
const API::SpectrumInfo & m_spectrumInfo
const CompareStrategy * m_compareStrategy
virtual ~ReducePeakListStrategy()=default
virtual std::vector< SXPeak > reduce(const std::vector< SXPeak > &peaks, Mantid::Kernel::ProgressBase &progress) const =0
const double m_resolution
MatrixWorkspace_sptr MANTID_API_DLL operator+=(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Adds two workspaces.
Mantid::HistogramData::HistogramY::const_iterator yIt
boost::optional< std::vector< SXPeak > > PeakList
HistogramData::HistogramX::const_iterator Bound
XAxisUnit
enum to determine the units of the workspaces X axis we are searching in
std::pair< Bound, Bound > BoundsIterator
bool compare(const mypair &left, const mypair &right)
Helper class which provides the Collimation Length for SANS instruments.
int32_t detid_t
Typedef for a detector ID.
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
virtual bool isBelowBackground(const double intensity, const HistogramData::HistogramY &y) const =0
virtual ~BackgroundStrategy()=default
friend std::ostream & operator<<(std::ostream &os, const SXPeak &rhs)
int m_nPixels
Number of contributing pixels.
double m_phi
Phi angle for the centre detector of the peak.
double m_tof
TOF for the peak centre.
std::vector< int > m_spectra
Contributing spectra to this peak.
Kernel::V3D m_unitWaveVector
Unit vector in the direction of the wavevector.
detid_t m_detId
Detector ID.
double m_LTotal
Detector-sample distance.
double m_intensity
Measured intensity of centre of the peak.
double m_dSpacing
d-spacing at the peak centre
std::string m_qConvention
Q Convention.
double m_twoTheta
2 * theta angle for then centre detector of the peak
size_t m_wsIndex
Detector workspace index.