18using namespace Kernel;
20using namespace DataObjects;
24 "Name of the input workspace");
26 "Name of the output workspace");
29 "Re-integrates the proton charge. This will modify the "
30 "gd_prtn_chrg. Does nothing for multi-period data");
45 const bool integratePCharge)
const {
48 const Run &run = inputWS->run();
55 "data, then you will be normalising against the "
63 int periodNumber = std::stoi(currentPeriodNumberProperty->
value());
68 if (chargePropertyArray) {
69 charge = chargePropertyArray->operator()()[periodNumber - 1];
72 "multiperiod data workspace (" +
73 inputWS->getName() +
")",
74 "proton_charge_by_period");
78 throw std::domain_error(
"The proton charge found for period number " +
std::to_string(periodNumber) +
79 " in the input workspace (" + inputWS->getName() +
80 ") run information is zero. When applying "
81 "NormaliseByCurrent on multiperiod data, a "
82 "non-zero value is required for every period in "
83 "the proton_charge_by_period log.");
88 if (integratePCharge) {
89 inputWS->run().integrateProtonCharge();
91 charge = inputWS->run().getProtonCharge();
93 g_log.
error() <<
"The proton charge is not set for the run attached to "
95 inputWS->getName() +
")\n";
100 throw std::domain_error(
"The proton charge found in the input workspace (" + inputWS->getName() +
101 ") run information is zero");
111 const bool integratePCharge =
getProperty(
"RecalculatePCharge");
118 double invcharge = 1.0 / charge;
122 if (inputWS != outputWS) {
123 outputWS = inputWS * invcharge;
126 inputWS *= invcharge;
129 outputWS->setYUnitLabel(
"Counts per microAmp.hour");
#define DECLARE_ALGORITHM(classname)
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.
Kernel::Property * getLogData(const std::string &name) const
Access a single log entry.
HeldType getPropertyValueAsType(const std::string &name) const
Get the value of a property as the given TYPE.
This class stores information regarding an experimental run as a series of log entries.
A property class for workspaces.
void init() override
Virtual method - must be overridden by concrete algorithm.
void exec() override
Virtual method - must be overridden by concrete algorithm.
double extractCharge(const std::shared_ptr< Mantid::API::MatrixWorkspace > &inputWS, const bool integratePCharge) const
Extract a value for the charge from the input workspace.
Support for a property that holds an array of values.
Exception for when an item is not found in a collection.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void error(const std::string &msg)
Logs at error level.
void information(const std::string &msg)
Logs at information level.
The concrete, templated class for properties.
Base class for properties.
virtual std::string value() const =0
Returns the value of the property as a string.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::string to_string(const wide_integer< Bits, Signed > &n)
@ Input
An input workspace.
@ Output
An output workspace.