37 "An input event workspace to use as a source for the events.");
44 "Output event workspace containing a flat background.");
59 double sampleRange = end - start;
60 g_log.
debug() <<
"Total Range = " << sampleRange <<
'\n';
63 double dataMin, dataMax;
64 inputWS->getEventXMinMax(dataMin, dataMax);
66 g_log.
debug() <<
"Data Range (" << dataMin <<
" < x < " << dataMax <<
")\n";
71 auto nRegions =
static_cast<int>((dataMax - dataMin) / sampleRange);
73 g_log.
debug() <<
"We will need to replicate the selected region " << nRegions <<
" times.\n";
77 crop_alg->setProperty(
"InputWorkspace", inputWS);
78 crop_alg->setProperty(
"XMin", start);
79 crop_alg->setProperty(
"XMax", end);
80 crop_alg->setPropertyValue(
"OutputWorkspace",
"__extracted_chunk");
86 shift_alg->setProperty(
"InputWorkspace", chunkws);
88 shift_alg->setProperty(
"Offset", -(start - dataMin));
89 shift_alg->executeAsChildAlg();
90 outputWS = shift_alg->getProperty(
"OutputWorkspace");
93 clone->setProperty(
"InputWorkspace", outputWS);
94 clone->setPropertyValue(
"OutputWorkspace",
"__background_chunk");
95 clone->executeAsChildAlg();
101 for (
int i = 0; i < nRegions; ++i) {
104 shiftchunk->setProperty(
"InputWorkspace", tmpChunkWs);
105 shiftchunk->setProperty(
"OutputWorkspace", tmpChunkWs);
106 shiftchunk->setProperty(
"Offset", sampleRange);
107 shiftchunk->executeAsChildAlg();
108 tmpChunkWs = shiftchunk->getProperty(
"OutputWorkspace");
112 plus_alg->setProperty(
"LHSWorkspace", outputWS);
113 plus_alg->setProperty(
"RHSWorkspace", tmpChunkWs);
114 plus_alg->setProperty(
"OutputWorkspace", outputWS);
115 plus_alg->executeAsChildAlg();
116 outputWS = plus_alg->getProperty(
"OutputWorkspace");
117 tmpChunkWs = plus_alg->getProperty(
"RHSWorkspace");
124 finalcrop_alg->setProperty(
"InputWorkspace", outputWS);
125 finalcrop_alg->setProperty(
"XMin", dataMin);
126 finalcrop_alg->setProperty(
"XMax", dataMax);
127 finalcrop_alg->execute();
128 outputWS = finalcrop_alg->getProperty(
"OutputWorkspace");
131 outputEWS->clearMRU();
135 outputEWS->getEventXMinMax(dataMin, dataMax);
136 outputEWS->setAllX(HistogramData::BinEdges{dataMin, dataMax});
#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.
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
Helper class for reporting progress from algorithms.
A property class for workspaces.
CreateFlatEventWorkspace : Creates a flat event workspace that can be used for background removal.
int version() const override
Algorithm's version for identification.
void init() override
Initialize the algorithm's properties.
void exec() override
Execute the algorithm.
const std::string category() const override
Algorithm's category for identification.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void debug(const std::string &msg)
Logs at debug level.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
@ Input
An input workspace.
@ Output
An output workspace.