Skip to content

Commit

Permalink
Adding mask check to Instrument. Refs #4208.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Dec 8, 2011
1 parent d4649e1 commit e7e8986
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ namespace Mantid
Kernel::V3D getBeamDirection() const;

IDetector_const_sptr getDetector(const detid_t &detector_id) const;
bool isDetectorMasked(const detid_t &detector_id) const;
bool isDetectorMasked(const std::set<detid_t> &detector_ids) const;

/// Returns a pointer to the geometrical object for the given set of IDs
IDetector_const_sptr getDetectorG(const std::vector<detid_t> &det_ids) const;

Expand Down
20 changes: 20 additions & 0 deletions Code/Mantid/Framework/Geometry/src/Instrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,26 @@ namespace Mantid
}
}

bool Instrument::isDetectorMasked(const detid_t &detector_id) const
{
return m_instr->getDetector(detector_id)->isMasked();
}

bool Instrument::isDetectorMasked(const std::set<detid_t> &detector_ids) const
{
if (detector_ids.empty())
{
throw Kernel::Exception::NotFoundError("No detectors specified in isDetectorMasked", "");
}

for (std::set<detid_t>::const_iterator it = detector_ids.begin(); it != detector_ids.end(); ++it)
{
if (! this->isDetectorMasked(*it))
return false;
}
return true;
}

/**
* Returns a pointer to the geometrical object for the given set of IDs
* @param det_ids :: A list of detector ids
Expand Down

0 comments on commit e7e8986

Please sign in to comment.