/** Extract masked detectors from a MaskWorkspace
  * @return vector of detector IDs of the detectors that are
  * masked
  */
std::vector<detid_t> ExtractMaskToTable::extractMaskFromMaskWorkspace() {
  // output vector
  std::vector<detid_t> maskeddetids;

  // Go through all spectra to find masked workspace
  MaskWorkspace_const_sptr maskws =
      boost::dynamic_pointer_cast<const MaskWorkspace>(m_dataWS);
  size_t numhist = maskws->getNumberHistograms();
  for (size_t i = 0; i < numhist; ++i) {
    // Rule out the spectrum without mask
    if (maskws->readY(i)[0] < 1.0E-9)
      continue;

    // Get spectrum
    const API::ISpectrum *spec = maskws->getSpectrum(i);
    if (!spec)
      throw runtime_error(
          "Unable to get spectrum reference from mask workspace.");

    const set<detid_t> detidset = spec->getDetectorIDs();
    std::copy(detidset.cbegin(), detidset.cend(),
              std::inserter(maskeddetids, maskeddetids.end()));
  }
  return maskeddetids;
}
/** Extract masked detectors from a MaskWorkspace
  * @return vector of detector IDs of the detectors that are
  * masked
  */
std::vector<detid_t> ExtractMaskToTable::extractMaskFromMaskWorkspace() {
  // output vector
  std::vector<detid_t> maskeddetids;

  // Go through all spectra to find masked workspace
  MaskWorkspace_const_sptr maskws =
      boost::dynamic_pointer_cast<const MaskWorkspace>(m_dataWS);
  size_t numhist = maskws->getNumberHistograms();
  for (size_t i = 0; i < numhist; ++i) {
    // Rule out the spectrum without mask
    if (maskws->readY(i)[0] < 1.0E-9)
      continue;

    const auto &detidset = maskws->getSpectrum(i).getDetectorIDs();
    std::copy(detidset.cbegin(), detidset.cend(),
              std::inserter(maskeddetids, maskeddetids.end()));
  }
  return maskeddetids;
}