Mantid
Loading...
Searching...
No Matches
Detector.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
10#include <boost/python/class.hpp>
11
15using namespace boost::python;
16
17namespace {
18bool isMaskedDeprecated(const Detector &self) {
19 if (PyErr_Warn(PyExc_DeprecationWarning, "'Detector::isMasked' is deprecated, "
20 "use 'DetectorInfo::isMasked' instead.") < 0)
21 throw boost::python::error_already_set();
22 const auto &detInfo = self.parameterMap().detectorInfo();
23 return detInfo.isMasked(self.index());
24}
25
26bool isMonitorDeprecated(const Detector &self) {
27 if (PyErr_Warn(PyExc_DeprecationWarning, "'Detector::isMonitor' is deprecated, "
28 "use 'DetectorInfo::isMonitor' instead.") < 0)
29 throw boost::python::error_already_set();
30 const auto &detInfo = self.parameterMap().detectorInfo();
31 return detInfo.isMonitor(self.index());
32}
33} // namespace
34
40 class_<Detector, bases<IDetector, ObjComponent>, boost::noncopyable>("Detector", no_init)
41 .def("isMasked", &isMaskedDeprecated, arg("self"),
42 "Returns the value of the masked flag. True means ignore this "
43 "detector")
44 .def("isMonitor", &isMonitorDeprecated, arg("self"),
45 "Returns True if the detector is marked as a monitor in the IDF");
46}
void export_Detector()
Enables boost.python to automatically "cast" an object up to the appropriate Detector leaf type.
Definition Detector.cpp:39
bool isMasked(const size_t index) const
Returns true if the detector is masked.
bool isMonitor(const size_t index) const
Returns true if the detector is a monitor.
This class represents a detector - i.e.
Definition Detector.h:30
size_t index() const override
Helper for legacy access mode. Returns the index of the detector.
Definition Detector.cpp:129
const ParameterMap & parameterMap() const override
Helper for legacy access mode. Returns a reference to the ParameterMap.
Definition Detector.cpp:126
Interface class for detector objects.
Definition IDetector.h:37
Object Component class, this class brings together the physical attributes of the component to the po...
const Geometry::DetectorInfo & detectorInfo() const
Only for use by ExperimentInfo. Returns a reference to the DetectorInfo.