15#include <Poco/DOM/DOMParser.h>
16#include <Poco/DOM/Document.h>
17#include <Poco/DOM/Element.h>
23using namespace Kernel;
25using namespace Geometry;
29 "Name of the input workspace");
31 "The XML definition of the shape");
33 "Whether monitors should be included if they are contained in the\n"
34 "shape (default false)");
35 declareProperty(
"DetectorList", std::vector<int>(),
"The list of detector ids included within the shape",
41 bool includeMonitors =
getProperty(
"IncludeMonitors");
48 const auto &detectorInfo = WS->detectorInfo();
49 const auto &detIDs = detectorInfo.detectorIDs();
51 std::vector<int> foundDets;
54 detid2det_map::size_type objCmptCount = detectorInfo.size();
55 auto iprogress_step =
static_cast<int>(objCmptCount / 100);
56 if (iprogress_step == 0)
60 for (
size_t i = 0; i < detectorInfo.size(); ++i) {
61 if ((includeMonitors) || (!detectorInfo.isMonitor(i))) {
63 if (shape_sptr->isValid(detectorInfo.position(i))) {
65 g_log.
debug() <<
"Detector contained in shape " << detIDs[i] <<
'\n';
66 foundDets.emplace_back(detIDs[i]);
70 if (iprogress % iprogress_step == 0) {
71 progress(
static_cast<double>(iprogress) /
static_cast<double>(objCmptCount));
#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.
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
void interruption_point()
This is called during long-running operations, and check if the algorithm has requested that it be ca...
A property class for workspaces.
void init() override
Virtual method - must be overridden by concrete algorithm.
void exec() override
Virtual method - must be overridden by concrete algorithm.
Class originally intended to be used with the DataHandling 'LoadInstrument' algorithm.
std::shared_ptr< CSGObject > createShape(Poco::XML::Element *pElem)
Creates a geometric object from a DOM-element-node pointing to an element whose child nodes contain t...
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void debug(const std::string &msg)
Logs at debug level.
Validator to check that a property is not left empty.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
@ Input
An input workspace.
@ Output
An output workspace.