18using namespace Kernel;
20using namespace DataObjects;
29 "The name of the first input workspace");
31 "The name of the second input workspace");
33 "Verify that the supplied data do not overlap");
35 "The label to set the Y axis to");
37 "The unit to set the Y axis to");
54 if (((eventWs1) && (!eventWs2)) || ((!eventWs1) && (eventWs2))) {
55 const std::string message(
"Only one of the input workspaces are of type "
56 "EventWorkspace; please use matching workspace "
57 "types (both EventWorkspace's or both "
60 throw std::invalid_argument(message);
63 if (eventWs1 && eventWs2) {
90 bool checkSpectra)
const {
93 std::set<specnum_t> spectra;
94 std::set<detid_t> detectors;
96 for (
size_t i = 0; i < nhist1; ++i) {
99 spectra.insert(spectrum);
100 const auto &dets = spec.getDetectorIDs();
101 for (
auto const &det : dets) {
102 detectors.insert(det);
109 for (
size_t j = 0; j < nhist2; ++j) {
113 if (spectrum > 0 && spectra.find(spectrum) != spectra.end()) {
114 g_log.
error() <<
"The input workspaces have overlapping spectrum numbers " << spectrum <<
"\n";
115 throw std::invalid_argument(
"The input workspaces have overlapping spectrum numbers");
118 const auto &dets = spec.getDetectorIDs();
119 for (
const auto &det : dets) {
120 if (detectors.find(det) != detectors.end()) {
121 g_log.
error() <<
"The input workspaces have common detectors: " << (det) <<
"\n";
122 throw std::invalid_argument(
"The input workspaces have common detectors");
149 output->history().addHistory(ws1.
getHistory());
173 output->history().addHistory(ws1.
getHistory());
#define DECLARE_ALGORITHM(classname)
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual bool processGroups()
Process WorkspaceGroup inputs.
specnum_t getSpectrumNo() const
void setSpectrumNo(specnum_t num)
Sets the the spectrum number of this spectrum.
Base MatrixWorkspace Abstract Class.
virtual ISpectrum & getSpectrum(const size_t index)=0
Return the underlying ISpectrum ptr at the given workspace index.
virtual std::size_t getNumberHistograms() const =0
Returns the number of histograms in the workspace.
void setYUnitLabel(const std::string &newLabel)
Sets a new caption for the data (Y axis) in the workspace.
void setYUnit(const std::string &newUnit)
Sets a new unit for the data (Y axis) in the workspace.
A property class for workspaces.
const WorkspaceHistory & getHistory() const
Returns a reference to the WorkspaceHistory const.
Joins two partial, non-overlapping workspaces into one.
void checkForOverlap(const API::MatrixWorkspace &ws1, const API::MatrixWorkspace &ws2, bool checkSpectra) const
Checks that the two input workspaces have non-overlapping spectra numbers and contributing detectors.
bool processGroups() override
Appends the removal of the empty group after execution to the Algorithm::processGroups() method.
void exec() override
Executes the algorithm.
void fixSpectrumNumbers(const API::MatrixWorkspace &ws1, const API::MatrixWorkspace &ws2, API::MatrixWorkspace &output) override
Abstract method to be implemented in concrete algorithm classes.
bool m_overlapChecked
True if spectra overlap.
API::MatrixWorkspace_sptr conjoinHistograms(const API::MatrixWorkspace &ws1, const API::MatrixWorkspace &ws2)
Conjoin two histogram workspaces together, including the history.
void setYUnitAndLabel(API::MatrixWorkspace &ws) const
API::MatrixWorkspace_sptr conjoinEvents(const DataObjects::EventWorkspace &ws1, const DataObjects::EventWorkspace &ws2)
Conjoin two event workspaces together, including the history.
void checkCompatibility(const API::MatrixWorkspace &ws1, const API::MatrixWorkspace &ws2)
Checks that the two input workspace have common size and the same instrument & unit.
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.
This class is intended to fulfill the design specified in <https://github.com/mantidproject/documents...
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.
The concrete, templated class for properties.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< const EventWorkspace > EventWorkspace_const_sptr
shared pointer to a const Workspace2D
int32_t specnum_t
Typedef for a spectrum Number.
@ InOut
Both an input & output workspace.
@ Input
An input workspace.