11#include "MantidCrystal/DllConfig.h"
21 const std::string name()
const override;
23 const std::string
summary()
const override {
24 return "Filters the peaks in a peaks workspace based upon the valur of a "
28 int version()
const override;
29 const std::vector<std::string>
seeAlso()
const override {
return {
"CreatePeaksWorkspace"}; }
30 const std::string category()
const override;
43 FilterFunction getFilterVariableFunction(
const std::string &filterVariable)
const;
58 template <
typename Comparator>
61 Comparator operatorFunc;
64 const auto currentValue = filterFunction(currentPeak);
66 if (operatorFunc(currentValue, filterValue))
67 filteredWS.
addPeak(currentPeak);
83 template <
typename Comparator>
86 Comparator operatorFunc;
89 const auto currentValue = filterFunction(currentPeak);
91 if (operatorFunc(currentValue, filterValue))
92 filteredWS.
addPeak(currentPeak);
Base class from which all concrete algorithm classes should be derived.
Interface to the class Mantid::DataObjects::PeaksWorkspace.
virtual Mantid::Geometry::IPeak & getPeak(int peakNum)=0
Return a reference to the Peak.
virtual void addPeak(const Mantid::Geometry::IPeak &ipeak)=0
Add a peak to the list.
virtual int getNumberPeaks() const =0
FilterPeaks : Filter a peaks workspace based on a set number of queries to provide a new,...
void filterPeaks(const Mantid::API::IPeaksWorkspace &inputWS, Mantid::API::IPeaksWorkspace &filteredWS, const FilterFunction &filterFunction, const double filterValue)
Filter the input peaks workspace using a comparator and a value selection function.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
std::function< double(const Geometry::IPeak &)> FilterFunction
Typedef for the function to get the variable we're filtering against.
const std::string summary() const override
Summary of algorithms purpose.
std::function< std::string(const Geometry::IPeak &)> FilterFunctionStr
void filterPeaksStr(const Mantid::API::IPeaksWorkspace &inputWS, Mantid::API::IPeaksWorkspace &filteredWS, const FilterFunctionStr &filterFunction, const std::string &filterValue)
Select peaks from the input peak workspace by checking a string value.
Structure describing a single-crystal peak.
Helper class which provides the Collimation Length for SANS instruments.