Skip to content

Commit

Permalink
Add validation to workspaces to ensure MatrixWorkspaces are used
Browse files Browse the repository at this point in the history
Refs #11125
  • Loading branch information
DanNixon committed Feb 24, 2015
1 parent f29d2a0 commit dac7b69
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Code/Mantid/Framework/Algorithms/src/CopyDetectorMapping.cpp
Expand Up @@ -42,11 +42,25 @@ void CopyDetectorMapping::exec() {
std::map<std::string, std::string> CopyDetectorMapping::validateInputs() {
std::map<std::string, std::string> issues;

MatrixWorkspace_const_sptr wsToMatch = getProperty("WorkspaceToMatch");
MatrixWorkspace_sptr wsToMatch = getProperty("WorkspaceToMatch");
MatrixWorkspace_sptr wsToRemap = getProperty("WorkspaceToRemap");

// Check histohram counts match
if (wsToMatch->getNumberHistograms() != wsToRemap->getNumberHistograms())
// Check that the workspaces actually are MatrixWorkspaces
bool validWorkspaces = true;

if (wsToMatch == NULL) {
issues["WorkspaceToMatch"] = "Must be a MatrixWorkspace";
validWorkspaces = false;
}

if (wsToRemap == NULL) {
issues["WorkspaceToRemap"] = "Must be a MatrixWorkspace";
validWorkspaces = false;
}

// Check histohram counts match (assuming both are MatrixWorkspaces)
if (validWorkspaces &&
wsToMatch->getNumberHistograms() != wsToRemap->getNumberHistograms())
issues["WorkspaceToRemap"] =
"Number of histograms must match WorkspaceToMatch";

Expand Down

0 comments on commit dac7b69

Please sign in to comment.