26const double LIVE_VALUE = 0.;
32const double DEAD_VALUE = 1.;
35const double ERROR_VALUE = 0.;
46 this->
init(numvectors, 1, 1);
76 for (std::size_t i = 0; i < nHist; ++i) {
77 this->
dataY(i)[0] = LIVE_VALUE;
78 this->
dataE(i)[0] = ERROR_VALUE;
91 for (
size_t i = 0; i < numWksp; i++) {
98 numMasked += ids.size();
100 std::stringstream errss;
101 errss <<
"No instrument is associated with mask workspace " << this->
getName();
102 throw std::runtime_error(errss.str());
121 for (
size_t i = 0; i < numHist; i++) {
124 detIDs.insert(temp.begin(), temp.end());
140 for (
size_t i = 0; i < numHist; i++) {
156 std::stringstream msg;
158 msg <<
"There is no instrument associated with workspace \'" << this->
getName() <<
"\'";
160 msg <<
"There is no proper instrument associated with workspace \'" << this->
getName()
161 <<
"\'. Number of detectors = " << this->
getInstrument()->getNumberDetectors();
162 throw std::runtime_error(msg.str());
166 if (this->
getValue(detectorID, LIVE_VALUE) != LIVE_VALUE) {
177 }
catch (std::out_of_range &) {
187 if (detectorIDs.empty()) {
191 const auto it = std::find_if_not(detectorIDs.cbegin(), detectorIDs.cend(),
192 [
this](
const auto detectorID) { return this->isMasked(detectorID); });
193 return it == detectorIDs.cend();
200 return (this->
dataY(wkspIndex)[0] != LIVE_VALUE);
210 double value(LIVE_VALUE);
222 for (
auto detectorID : detectorIDs) {
228 double value(LIVE_VALUE);
252 std::ostringstream os;
267 hasinst = inst->getNumberDetectors() > 0;
282IPropertyManager::getValue<Mantid::DataObjects::MaskWorkspace_sptr>(
const std::string &name)
const {
287 std::string message =
288 "Attempt to assign property " + name +
" to incorrect type. Expected shared_ptr<MaskWorkspace>.";
289 throw std::runtime_error(message);
295IPropertyManager::getValue<Mantid::DataObjects::MaskWorkspace_const_sptr>(
const std::string &name)
const {
296 auto *prop =
dynamic_cast<PropertyWithValue<Mantid::DataObjects::MaskWorkspace_sptr> *
>(getPointerToProperty(name));
298 return prop->operator()();
300 std::string message =
301 "Attempt to assign property " + name +
" to incorrect type. Expected const shared_ptr<MaskWorkspace>.";
302 throw std::runtime_error(message);
double value
The value of the point.
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
#define DECLARE_WORKSPACE(classname)
Geometry::DetectorInfo & mutableDetectorInfo()
Return a non-const reference to the DetectorInfo object.
const Geometry::DetectorInfo & detectorInfo() const
Return a const reference to the DetectorInfo object.
Geometry::Instrument_const_sptr getInstrument() const
Returns the parameterized instrument.
virtual MantidVec & dataE(const std::size_t index)
Deprecated, use mutableE() instead. Returns the error data.
virtual MantidVec & dataY(const std::size_t index)
Deprecated, use mutableY() instead. Returns the y data.
const std::string & getName() const override
Get the workspace name.
const std::string toString() const override
Return human-readable string.
void clearMask()
Clear original incorrect mask.
void setMaskedIndex(const std::size_t wkspIndex, const bool mask=true)
const std::string id() const override
Gets the name of the workspace type.
bool isMaskedIndex(const std::size_t wkspIndex) const
Use this method with MaskWorkspace that doesn't have an instrument.
void copyFrom(std::shared_ptr< const SpecialWorkspace2D > sourcews) override
Copy the set up from another workspace.
bool hasInstrument() const
Check whether any instrument associated.
void setMasked(const detid_t detectorID, const bool mask=true) override
Mask an individual pixel.
bool isMasked(const detid_t detectorID) const override
std::set< detid_t > getMaskedDetectors() const
MaskWorkspace::getMaskedDetectors.
std::set< std::size_t > getMaskedWkspIndices() const
MaskWorkspace::getMaskedWkspIndices.
std::size_t getNumberMasked() const override
double getValue(const detid_t detectorID) const
Return the special value (Y) in the workspace at the given detector ID.
const std::string toString() const override
Return human-readable string.
void init(const size_t &NVectors, const size_t &XLength, const size_t &YLength) override
Sets the size of the workspace and initializes arrays to zero.
std::set< detid_t > getDetectorIDs(const std::size_t workspaceIndex) const
Return the detector ID at the given workspace index (i.e., spectrum/histogram index)
virtual void copyFrom(std::shared_ptr< const SpecialWorkspace2D > sourcews)
Duplicate SpecialWorkspace2D.
void setValue(const detid_t detectorID, const double value, const double error=0.)
Set the special value (Y) in the workspace at the given detector ID.
std::size_t getNumberHistograms() const override
Returns the histogram number.
bool isMasked(const size_t index) const
Returns true if the detector is masked.
void clearMaskFlags()
Sets all mask flags to false (unmasked).
size_t indexOf(const detid_t id) const
Returns the index of the detector with the given detector ID.
The concrete, templated class for properties.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< const MaskWorkspace > MaskWorkspace_const_sptr
shared pointer to a const MaskWorkspace
std::shared_ptr< MaskWorkspace > MaskWorkspace_sptr
shared pointer to the MaskWorkspace class
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.