19using namespace Kernel;
21using namespace DataObjects;
43 m_progress = std::make_unique<API::Progress>(
this, 0.0, 1.0, totalHists);
48 for (int64_t i = 0; i < nhist1; ++i) {
50 auto &outSpec = output->getSpectrum(i);
55 outSpec.copyInfoFrom(inSpec);
59 for (
const auto &inputMask : ws1.
maskedBins(i)) {
60 output->flagMasked(i, inputMask.first, inputMask.second);
72 auto &outSpectrumInfo = output->mutableSpectrumInfo();
74 for (int64_t j = 0; j < nhist2; ++j) {
77 auto &outSpec = output->getSpectrum(nhist1 + j);
83 outSpec.copyInfoFrom(inSpec);
87 for (
const auto &inputMask : ws2.
maskedBins(j)) {
88 output->flagMasked(nhist1 + j, inputMask.first, inputMask.second);
92 if (spectrumInfo.hasDetectors(j) && spectrumInfo.isMasked(j)) {
93 output->getSpectrum(nhist1 + j).clearData();
116 auto output = create<EventWorkspace>(eventWs1, totalHists, eventWs1.
binEdges(0));
119 m_progress = std::make_unique<API::Progress>(
this, 0.0, 1.0, totalHists);
122 for (int64_t i = 0; i < nhist1; ++i) {
130 auto &outSpectrumInfo = output->mutableSpectrumInfo();
131 for (int64_t j = 0; j < nhist2; ++j) {
133 int64_t outputWi = j + nhist1;
134 output->getSpectrum(outputWi) = eventWs2.
getSpectrum(j);
138 if (spectrumInfo.hasDetectors(j) && spectrumInfo.isMasked(j)) {
139 output->getSpectrum(outputWi).
clearData();
159 const std::string message(
"The input workspaces are not compatible because "
160 "they come from different instruments");
161 throw std::invalid_argument(message);
166 const std::string ws1_unitID = (ws1_unit ? ws1_unit->unitID() :
"");
167 const std::string ws2_unitID = (ws2_unit ? ws2_unit->unitID() :
"");
169 if (ws1_unitID != ws2_unitID) {
170 const std::string message(
"The input workspaces are not compatible because "
171 "they have different units on the X axis");
172 throw std::invalid_argument(message);
176 const std::string message(
"The input workspaces have inconsistent distribution flags");
177 throw std::invalid_argument(message);
192 for (
size_t i = 0; i < length; i++) {
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_CRITICAL(name)
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
Base class from which all concrete algorithm classes should be derived.
const std::shared_ptr< Kernel::Unit > & unit() const
The unit for this axis.
const SpectrumInfo & spectrumInfo() const
Return a reference to the SpectrumInfo object.
Geometry::Instrument_const_sptr getInstrument() const
Returns the parameterized instrument.
void setHistogram(T &&...data)
Sets the Histogram associated with this spectrum.
specnum_t getSpectrumNo() const
Base MatrixWorkspace Abstract Class.
const MaskList & maskedBins(const size_t &workspaceIndex) const
Returns the list of masked bins for a spectrum.
virtual ISpectrum & getSpectrum(const size_t index)=0
Return the underlying ISpectrum ptr at the given workspace index.
HistogramData::BinEdges binEdges(const size_t index) const
virtual std::size_t getNumberHistograms() const =0
Returns the number of histograms in the workspace.
bool hasMaskedBins(const size_t &workspaceIndex) const
Does this spectrum contain any masked bins.
const HistogramData::HistogramX & x(const size_t index) const
bool isDistribution() const
Are the Y-values dimensioned?
virtual Axis * getAxis(const std::size_t &axisIndex) const
Get a non owning pointer to a workspace axis.
const HistogramData::HistogramY & y(const size_t index) const
void checkCompatibility(const API::MatrixWorkspace &ws1, const API::MatrixWorkspace &ws2)
Checks that the two input workspace have common size and the same instrument & unit.
std::unique_ptr< API::Progress > m_progress
Progress reporting object.
WorkspaceJoiners()
Constructor.
DataObjects::EventWorkspace_sptr execEvent(const DataObjects::EventWorkspace &eventWs1, const DataObjects::EventWorkspace &eventWs2)
Executes the algorithm for event workspace inputs.
void getMinMax(const API::MatrixWorkspace &ws, specnum_t &min, specnum_t &max)
Determine the minimum and maximum spectra ids.
API::MatrixWorkspace_sptr execWS2D(const API::MatrixWorkspace &ws1, const API::MatrixWorkspace &ws2)
Executes the algorithm for histogram workspace inputs.
const std::string category() const override
Algorithm's category for identification.
virtual void fixSpectrumNumbers(const API::MatrixWorkspace &ws1, const API::MatrixWorkspace &ws2, API::MatrixWorkspace &output)=0
Abstract method to be implemented in concrete algorithm classes.
void clearData() override
Mask the spectrum to this value. Removes all events.
This class is intended to fulfill the design specified in <https://github.com/mantidproject/documents...
EventList & getSpectrum(const size_t index) override
Return the underlying ISpectrum ptr at the given workspace index.
std::size_t getNumberHistograms() const override
Get the number of histograms, usually the same as the number of pixels or detectors.
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
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
std::shared_ptr< const Unit > Unit_const_sptr
Shared pointer to the Unit base class (const version)
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
int32_t specnum_t
Typedef for a spectrum Number.