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 PyErr_Warn(PyExc_DeprecationWarning, "'Detector::isMasked' is deprecated, "
20 "use 'DetectorInfo::isMasked' instead.");
21 const auto &detInfo = self.parameterMap().detectorInfo();
22 return detInfo.isMasked(self.index());
23}
24
25bool isMonitorDeprecated(const Detector &self) {
26 PyErr_Warn(PyExc_DeprecationWarning, "'Detector::isMonitor' is deprecated, "
27 "use 'DetectorInfo::isMonitor' instead.");
28 const auto &detInfo = self.parameterMap().detectorInfo();
29 return detInfo.isMonitor(self.index());
30}
31} // namespace
32
38 class_<Detector, bases<IDetector, ObjComponent>, boost::noncopyable>("Detector", no_init)
39 .def("isMasked", &isMaskedDeprecated, arg("self"),
40 "Returns the value of the masked flag. True means ignore this "
41 "detector")
42 .def("isMonitor", &isMonitorDeprecated, arg("self"),
43 "Returns True if the detector is marked as a monitor in the IDF");
44}
void export_Detector()
Enables boost.python to automatically "cast" an object up to the appropriate Detector leaf type.
Definition: Detector.cpp:37
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:43
Object Component class, this class brings together the physical attributes of the component to the po...
Definition: ObjComponent.h:33
const Geometry::DetectorInfo & detectorInfo() const
Only for use by ExperimentInfo. Returns a reference to the DetectorInfo.