12#include <boost/algorithm/string.hpp>
14#include "Poco/NumberFormatter.h"
18using namespace Kernel;
26 "Workspace to be corrected");
28 std::vector<std::string> normOptions{
"Monitor",
"Timer"};
29 this->declareProperty(
"NormalisationType",
"Monitor", std::make_shared<StringListValidator>(normOptions),
30 "Type of Normalisation to use");
33 "Corrected workspace");
40 std::string normalisation =
getProperty(
"NormalisationType");
43 boost::algorithm::to_lower(normalisation);
44 auto norm_count = inputWS->run().getPropertyValueAsType<
double>(normalisation);
47 if (boost::iequals(normalisation,
"monitor")) {
48 factor = 1.0e8 / norm_count;
50 factor = 1.0 / norm_count;
54 scaleAlg->setProperty(
"InputWorkspace", inputWS);
55 scaleAlg->setProperty(
"OutputWorkspace", outputWS);
56 scaleAlg->setProperty(
"Factor", factor);
57 scaleAlg->setProperty(
"Operation",
"Multiply");
58 scaleAlg->executeAsChildAlg();
62 setProperty(
"OutputMessage",
"Normalisation by " + normalisation +
": " + Poco::NumberFormatter::format(norm_count));
#define DECLARE_ALGORITHM(classname)
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.
A property class for workspaces.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void exec() override
Execution code.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
@ Input
An input workspace.
@ Output
An output workspace.