21using Kernel::Direction;
23using namespace Kernel;
30 "A workspace whose masking is to be extracted");
31 declareProperty(
"UngroupDetectors",
false,
"If true, the spectra will be ungrouped and masked individually.");
33 "A workspace containing the masked spectra as zeroes and ones.");
37 "A comma separated list or array containing a list of masked "
48 auto inputMaskWS = std::dynamic_pointer_cast<const DataObjects::MaskWorkspace>(inputWS);
49 auto inputWSIsSpecial = bool(inputMaskWS);
50 if (inputWSIsSpecial) {
51 g_log.
notice() <<
"Input workspace is a MaskWorkspace.\n";
56 const auto &detInfo = inputWS->detectorInfo();
57 const auto &detIds = detInfo.detectorIDs();
58 for (
size_t i = 0; i < detInfo.size(); ++i) {
59 if ((inputWSIsSpecial && inputMaskWS->isMasked(detIds[i])) || detInfo.isMasked(i)) {
66 std::shared_ptr<DataObjects::MaskWorkspace> maskWS;
68 maskWS = std::make_shared<DataObjects::MaskWorkspace>(inputWS->getInstrument());
70 maskWS = std::make_shared<DataObjects::MaskWorkspace>(inputWS);
72 maskWS->setTitle(inputWS->getTitle());
77 maskWS->setMasked(detectorID);
78 }
catch (std::invalid_argument
const &) {
79 g_log.
warning() <<
"Detector ID = " << detectorID <<
" is masked but does not exist in any output spectra\n ";
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
A property class for workspaces.
Support for a property that holds an array of values.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void notice(const std::string &msg)
Logs at notice level.
void warning(const std::string &msg)
Logs at warning level.
void information(const std::string &msg)
Logs at information level.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< const Mantid::Geometry::IDetector > IDetector_const_sptr
Shared pointer to IDetector (const version)
@ Input
An input workspace.
@ Output
An output workspace.