Skip to content

Commit

Permalink
Allow for an unlabeled detector module as in unit test for re #4104
Browse files Browse the repository at this point in the history
Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Nov 17, 2011
1 parent b5be732 commit 992d3a8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Code/Mantid/Framework/Crystal/src/SaveIsawPeaks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace Crystal
std::vector<Peak> peaks = ws->getPeaks();

// We cannot assume the peaks have bank type detector modules, so we have a string to check this
std::string bankPart = "";
std::string bankPart = "?";

// We must sort the peaks first by run, then bank #, and save the list of workspace indices of it
typedef std::map<int, std::vector<size_t> > bankMap_t;
Expand All @@ -108,7 +108,7 @@ namespace Crystal
continue;
}
// Save the "bank" part once to check whether it really is a bank
if( bankPart == "") bankPart = bankName.substr(0,4);
if( bankPart == "?") bankPart = bankName.substr(0,4);
// Take out the "bank" part of the bank name and convert to an int
bankName = bankName.substr(4, bankName.size()-4);
Strings::convert(bankName, bank);
Expand All @@ -122,9 +122,8 @@ namespace Crystal
Instrument_const_sptr inst = ws->getInstrument();
if (!inst) throw std::runtime_error("No instrument in PeaksWorkspace. Cannot save peaks file.");

if( bankPart != "bank") {
std::ostringstream mess;
mess << "Detector module of type " << bankPart << " not supported in ISAWPeaks. Cannot save peaks file";
if( bankPart != "bank" && bankPart != "?" ) {
std::ostringstream mess; mess << "Detector module of type " << bankPart << " not supported in ISAWPeaks. Cannot save peaks file";
throw std::runtime_error( mess.str() );
}

Expand Down

0 comments on commit 992d3a8

Please sign in to comment.