23const static std::string EPP_WORKSPACE{
"EPPWorkspace"};
26const static std::string WIDTH{
"HalfWidthInSigmas"};
45const std::string
IntegrateEPP::summary()
const {
return "Integrate a workspace around elastic peak positions."; }
53 "A workspace to be integrated.");
56 "An workspace containing the integrated histograms.");
59 "Table containing information on the elastic peaks.");
60 const auto mandatoryDouble = std::make_shared<Kernel::MandatoryValidator<double>>();
61 const auto positiveDouble = std::make_shared<Kernel::BoundedValidator<double>>();
62 positiveDouble->setLower(0.0);
63 positiveDouble->setLowerExclusive(
true);
64 const auto mandatoryPositiveDouble = std::make_shared<Kernel::CompositeValidator>();
65 mandatoryPositiveDouble->add(mandatoryDouble);
66 mandatoryPositiveDouble->add(positiveDouble);
68 "Half of the integration width in multiplies of 'Sigma'.");
77 const double sigmaMultiplier =
getProperty(PropertyNames::WIDTH);
78 const auto indexCol = eppWS->getColumn(
"WorkspaceIndex");
79 const auto sigmaCol = eppWS->getColumn(
"Sigma");
80 const auto centreCol = eppWS->getColumn(
"PeakCentre");
81 const auto statusCol = eppWS->getColumn(
"FitStatus");
82 std::vector<double> begins(inWS->getNumberHistograms(), 0.0);
83 std::vector<double> ends(begins.size(), 0.0);
84 for (
size_t i = 0; i < eppWS->rowCount(); ++i) {
85 const auto &fitStatus = statusCol->cell<std::string>(i);
86 if (fitStatus !=
"success") {
89 const double centre = centreCol->toDouble(i);
90 const double halfWidth = sigmaMultiplier * sigmaCol->toDouble(i);
91 const int index = indexCol->cell<
int>(i);
92 if (
index < 0 ||
static_cast<size_t>(
index) >= begins.size()) {
93 throw std::runtime_error(
"The 'WorkspaceIndex' column contains an invalid value.");
95 begins[
index] = centre - halfWidth;
96 ends[
index] = centre + halfWidth;
100 integrate->setProperty(
"InputWorkspace", inWS);
102 integrate->setPropertyValue(
"OutputWorkspace", outWSName);
103 integrate->setProperty(
"RangeLowerList", begins);
104 integrate->setProperty(
"RangeUpperList", ends);
105 integrate->setProperty(
"IncludePartialBins",
true);
106 integrate->executeAsChildAlg();
116 std::map<std::string, std::string> issues;
120 if (inWS && eppWS && eppWS->rowCount() > inWS->getNumberHistograms()) {
121 issues[PropertyNames::EPP_WORKSPACE] =
"The EPP workspace contains too many rows.";
#define DECLARE_ALGORITHM(classname)
std::map< DeltaEMode::Type, std::string > index
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
void interruption_point()
This is called during long-running operations, and check if the algorithm has requested that it be ca...
A property class for workspaces.
IntegrateEPP : Integrate a workspace around the elastic peak positions given by a EPP table.
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
const std::string category() const override
Algorithm's category for identification.
int version() const override
Algorithm's version for identification.
void init() override
Initialize the algorithm's properties.
void exec() override
Execute the algorithm.
std::map< std::string, std::string > validateInputs() override
Validate input properties.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
std::shared_ptr< const ITableWorkspace > ITableWorkspace_const_sptr
shared pointer to Mantid::API::ITableWorkspace (const version)
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
static const std::string OUTPUT_WORKSPACE
static const std::string INPUT_WORKSPACE
Describes the direction (within an algorithm) of a Property.
@ Input
An input workspace.
@ Output
An output workspace.