21std::string
const INPUT_WORKSPACE(
"InputWorkspace");
22std::string
const FLOOD_WORKSPACE(
"FloodWorkspace");
23std::string
const OUTPUT_WORKSPACE(
"OutputWorkspace");
33 for (
size_t i = 0; i < nSpec; ++i) {
34 eventWS->getSpectrum(i).switchTo(EventType::WEIGHTED);
44 auto const floodBlocksize = flood->blocksize();
45 const ISpectrum *missingSpectrum =
nullptr;
46 for (
size_t i = 0; i < table->size(); ++i) {
47 auto const j = (*table)[i];
49 if (missingSpectrum) {
52 newFlood->dataY(i).assign(floodBlocksize, 1.0);
53 newFlood->dataE(i).assign(floodBlocksize, 0.0);
54 missingSpectrum = &newFlood->getSpectrum(i);
57 newFlood->getSpectrum(i).
copyDataFrom(flood->getSpectrum(j));
72 return "Algorithm to apply a flood correction to a workspace.";
78 return {
"ReflectometryReductionOneAuto",
"CreateFloodWorkspace"};
86 "The workspace to correct.");
89 "The flood workspace.");
92 "The corrected workspace.");
99 if (input->size() != flood->size()) {
100 flood = makeEqualSizes(input, flood);
103 auto const inputXUnitId = input->getAxis(0)->unit()->unitID();
104 bool const doConvertUnits = flood->getAxis(0)->unit()->unitID() != inputXUnitId;
105 bool const doRebin = flood->blocksize() > 1;
108 if (doConvertUnits) {
110 convert->setProperty(
"InputWorkspace", flood);
111 convert->setProperty(
"Target", inputXUnitId);
112 convert->setProperty(
"OutputWorkspace",
"dummy");
114 flood = convert->getProperty(
"OutputWorkspace");
117 rebin->setProperty(
"WorkspaceToRebin", flood);
118 rebin->setProperty(
"WorkspaceToMatch", input);
119 rebin->setProperty(
"OutputWorkspace",
"dummy");
121 flood =
rebin->getProperty(
"OutputWorkspace");
125 divide->setProperty(
"LHSWorkspace", input);
126 divide->setProperty(
"RHSWorkspace", flood);
127 divide->setProperty(
"OutputWorkspace",
"dummy");
130 correctEvents(output.get());
#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.
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.
This class provides an interface to an EventWorkspace.
A "spectrum" is an object that holds the data for a particular spectrum, in particular:
virtual void copyDataFrom(const ISpectrum &source)=0
Copy data from another ISpectrum with double-dynamic dispatch.
Base MatrixWorkspace Abstract Class.
virtual std::size_t getNumberHistograms() const =0
Returns the number of histograms in the workspace.
A property class for workspaces.
Algorithm to apply a flood correction workspace to a reflectometry data workspace.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
void init() override
Virtual method - must be overridden by concrete algorithm.
const std::string category() const override
function to return a category of the algorithm.
void exec() override
Virtual method - must be overridden by concrete algorithm.
const std::string summary() const override
function returns a summary message that will be displayed in the default GUI, and in the help.
int version() const override
function to return a version of the algorithm, must be overridden in all algorithms
static BinaryOperationTable_sptr buildBinaryOperationTable(const API::MatrixWorkspace_const_sptr &lhs, const API::MatrixWorkspace_const_sptr &rhs)
Build up an BinaryOperationTable for performing a binary operation e.g.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
void MANTID_KERNEL_DLL rebin(const std::vector< double > &xold, const std::vector< double > &yold, const std::vector< double > &eold, const std::vector< double > &xnew, std::vector< double > &ynew, std::vector< double > &enew, bool distribution, bool addition=false)
Rebins data according to a new output X array.
String constants for algorithm's properties.
@ Input
An input workspace.
@ Output
An output workspace.