21using Kernel::Direction;
23using namespace Kernel;
30 "A workspace whose masking is to be extracted");
32 "A workspace containing the masked spectra as zeroes and ones.");
36 "A comma separated list or array containing a list of masked "
47 auto inputMaskWS = std::dynamic_pointer_cast<const DataObjects::MaskWorkspace>(inputWS);
48 auto inputWSIsSpecial = bool(inputMaskWS);
49 if (inputWSIsSpecial) {
50 g_log.
notice() <<
"Input workspace is a MaskWorkspace.\n";
55 const auto &detInfo = inputWS->detectorInfo();
56 const auto &detIds = detInfo.detectorIDs();
57 for (
size_t i = 0; i < detInfo.size(); ++i) {
58 if ((inputWSIsSpecial && inputMaskWS->isMasked(detIds[i])) || detInfo.isMasked(i)) {
65 auto maskWS = std::make_shared<DataObjects::MaskWorkspace>(inputWS);
66 maskWS->setTitle(inputWS->getTitle());
68 const auto &spectrumInfo = inputWS->spectrumInfo();
69 const auto nHist =
static_cast<int64_t
>(inputWS->getNumberHistograms());
70 Progress prog(
this, 0.0, 1.0, nHist);
73 for (int64_t i = 0; i < nHist; ++i) {
75 bool inputIsMasked(
false);
76 if (spectrumInfo.hasDetectors(i)) {
78 inputIsMasked = (inputWSIsSpecial && inputMaskWS->isMaskedIndex(i)) || spectrumInfo.isMasked(i);
80 maskWS->setMaskedIndex(i, inputIsMasked);
#define DECLARE_ALGORITHM(classname)
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
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.
Helper class for reporting progress from algorithms.
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 information(const std::string &msg)
Logs at information level.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
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)
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
@ Input
An input workspace.
@ Output
An output workspace.