19using namespace Kernel;
25 "The XML definition of the user defined shape.");
27 "Whether to include monitors if "
28 "they are contained in the shape "
36 const bool includeMonitors =
getProperty(
"IncludeMonitors");
37 const std::string shapeXML =
getProperty(
"ShapeXML");
40 if (foundDets.empty()) {
41 g_log.
information(
"No detectors were found in the shape, nothing was masked");
50 const std::string &shapeXML,
51 const bool includeMonitors) {
53 alg->setPropertyValue(
"IncludeMonitors", includeMonitors ?
"1" :
"0");
54 alg->setPropertyValue(
"ShapeXML", shapeXML);
57 if (!alg->execute()) {
58 throw std::runtime_error(
"FindDetectorsInShape Child Algorithm has not "
59 "executed successfully\n");
61 }
catch (std::runtime_error &) {
62 g_log.
error(
"Unable to successfully execute FindDetectorsInShape Child Algorithm");
68 return alg->getProperty(
"DetectorList");
72 const std::vector<int> &detectorIds) {
73 auto &detectorInfo =
workspace->mutableDetectorInfo();
74 for (
const auto &
id : detectorIds)
75 detectorInfo.setMasked(detectorInfo.indexOf(
id),
true);
76 const auto &spectrumInfo =
workspace->spectrumInfo();
77 for (
size_t i = 0; i < spectrumInfo.size(); ++i)
78 if (spectrumInfo.hasDetectors(i) && spectrumInfo.isMasked(i))
#define DECLARE_ALGORITHM(classname)
IPeaksWorkspace_sptr workspace
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.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
A property class for workspaces.
void runMaskDetectors(const API::MatrixWorkspace_sptr &workspace, const std::vector< int > &detectorIds)
Calls MaskDetectors as a Child Algorithm.
void exec() override
Virtual method - must be overridden by concrete algorithm.
std::vector< int > runFindDetectorsInShape(const API::MatrixWorkspace_sptr &workspace, const std::string &shapeXML, const bool includeMonitors)
Run the FindDetectorsInShape Child Algorithm.
void init() override
Virtual method - must be overridden by concrete algorithm.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void error(const std::string &msg)
Logs at error level.
void information(const std::string &msg)
Logs at information level.
Validator to check that a property is not left empty.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
@ InOut
Both an input & output workspace.