Newer
Older
Janik Zikovsky
committed
}
// ----------------- LHS detectors are subset of RHS, which are Grouped
// --------------------------------------
if (!done) {
// Didn't find it? Now we need to iterate through the output workspace to
// match the detector ID.
// NOTE: This can be SUPER SLOW!
for (rhsWI = 0; rhsWI < static_cast<int64_t>(rhs_nhist); rhsWI++) {
const auto &rhsDets = rhs->getSpectrum(rhsWI).getDetectorIDs();
// Checks that lhsDets is a subset of rhsDets
if (std::includes(rhsDets.begin(), rhsDets.end(), lhsDets.begin(),
lhsDets.end())) {
// This one is right. Now we can stop looking.
Janik Zikovsky
committed
(*table)[lhsWI] = rhsWI;
Janik Zikovsky
committed
}
}
Janik Zikovsky
committed
// ------- Still nothing ! -----------
if (!done) {
(*table)[lhsWI] = -1;
// std::ostringstream mess;
// mess << "BinaryOperation: cannot find a RHS spectrum that
// contains the detectors in LHS workspace index " << lhsWI <<
// "\n";
// throw std::runtime_error(mess.str());
Janik Zikovsky
committed
}
}
return table;
}
Janik Zikovsky
committed
Peterson, Peter
committed
} // namespace Mantid