21using namespace Geometry;
22using namespace Kernel;
33 std::vector<std::string> outputs;
34 for (
const auto &input : inputs) {
39 outputs.insert(outputs.end(),
group.begin(),
group.end());
44 outputs.emplace_back(matrixws->getName());
46 throw(std::runtime_error(
"The input " + input +
" is neither a WorkspaceGroup nor a MatrixWorkspace"));
60 m_xUnit = ref->getAxis(0)->unit()->unitID();
70 m_hasDx.emplace_back(ref->hasDx(i));
82 if (ws->getNumberHistograms() !=
m_numberSpectra && checkNumberHistograms)
83 errors +=
"different number of histograms; ";
84 if (ws->getAxis(0)->unit()->unitID() !=
m_xUnit)
85 errors +=
"different X units; ";
87 errors +=
"different spectrum axis units; ";
89 errors +=
"different Y units; ";
91 errors +=
"different data type (Histogram Data vs Point Data); ";
93 errors +=
"different distribution flag (Histogrm vs Distribution); ";
95 errors +=
"a mix of workspaces with and without detector scans; ";
97 errors +=
"workspaces with detectors scans have different number of "
100 errors +=
"different instrument names; ";
104 if (
m_hasDx[i] != ws->hasDx(i)) {
105 errors +=
"spectra must have either Dx values or not; ";
124std::list<API::MatrixWorkspace_sptr>
126 std::list<MatrixWorkspace_sptr> inWS;
128 for (
size_t i = 0; i < inputWorkspaces.size(); ++i) {
131 ws = AnalysisDataService::Instance().retrieveWS<
MatrixWorkspace>(inputWorkspaces[i]);
133 throw std::runtime_error(
"Could not find a MatrixWorkspace with the name " + inputWorkspaces[i]);
135 inWS.emplace_back(ws);
137 if (!inWS.back()->isCommonBins()) {
138 g_log.
error(
"Input workspaces must have common binning for all spectra");
139 throw std::invalid_argument(
"Input workspaces must have common binning for all spectra");
146 if (!compatibility.empty()) {
147 g_log.
error(
"Input workspaces are not compatible: " + compatibility);
148 throw std::invalid_argument(
"Input workspaces are not compatible: " + compatibility);
Base MatrixWorkspace Abstract Class.
virtual std::size_t getNumberHistograms() const =0
Returns the number of histograms in the workspace.
Class to hold a set of workspaces.
std::vector< std::string > getNames() const
Returns the names of workspaces that make up this group.
std::string m_spectrumAxisUnit
std::vector< bool > m_hasDx
static std::vector< std::string > unWrapGroups(const std::vector< std::string > &)
Flattens the list of group workspaces (if any) into list of workspaces.
std::list< API::MatrixWorkspace_sptr > validateInputWorkspaces(const std::vector< std::string > &inputWorkspaces, Kernel::Logger &g_log)
Checks that the input workspace all exist, that they are the same size, have the same units and the s...
void setReferenceProperties(const API::MatrixWorkspace_sptr &)
Sets the properties of the reference (usually first) workspace, to later check the compatibility of t...
std::string checkCompatibility(const API::MatrixWorkspace_sptr &, bool checkNumberHistograms=false)
Compares the properties of the input workspace with the reference.
std::string m_instrumentName
The Logger class is in charge of the publishing messages from the framework through various channels.
void error(const std::string &msg)
Logs at error level.
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Kernel::Logger g_log("DetermineSpinStateOrder")