"Framework/git@code.ornl.gov:mantidproject/mantid.git" did not exist on "0bb8dc03d70ae464dcb73f4a9830b183e7ab6566"
Newer
Older
Doucet, Mathieu
committed
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidDataHandling/GetMaskedDetectors.h"
#include "MantidAPI/SpectraDetectorMap.h"
#include "MantidKernel/ArrayProperty.h"
Doucet, Mathieu
committed
#include <map>
Doucet, Mathieu
committed
namespace Mantid
{
namespace DataHandling
{
// Register the algorithm into the algorithm factory
DECLARE_ALGORITHM(GetMaskedDetectors)
Janik Zikovsky
committed
/// Sets documentation strings for this algorithm
void GetMaskedDetectors::initDocs()
{
this->setWikiSummary("This algorithm returns a std::vector<int> containing the detector ID's of detectors that have been masked with [[MaskDetectors]] or it's like. ");
this->setOptionalMessage("This algorithm returns a std::vector<int> containing the detector ID's of detectors that have been masked with MaskDetectors or it's like.");
}
Doucet, Mathieu
committed
using namespace Kernel;
using namespace API;
/// (Empty) Constructor
GetMaskedDetectors::GetMaskedDetectors() {}
/// Destructor
GetMaskedDetectors::~GetMaskedDetectors() {}
void GetMaskedDetectors::init()
{
declareProperty(
new WorkspaceProperty<>("InputWorkspace","", Direction::Input),
"The name of the workspace that will be used as input for the algorithm" );
declareProperty(new ArrayProperty<detid_t>("DetectorList", new NullValidator<std::vector<detid_t> >, Direction::Output),
"A comma separated list or array containing a list of masked detector ID's" );
Doucet, Mathieu
committed
}
void GetMaskedDetectors::exec()
{
// Get the input workspace
const MatrixWorkspace_sptr WS = getProperty("InputWorkspace");
// List masked of detector IDs
std::vector<detid_t> detectorList;
Doucet, Mathieu
committed
Janik Zikovsky
committed
WS->getInstrument()->getDetectors(det_map);
Doucet, Mathieu
committed
for (detid2det_map::const_iterator iter = det_map.begin();
Doucet, Mathieu
committed
iter != det_map.end(); ++iter )
Doucet, Mathieu
committed
{
Doucet, Mathieu
committed
if ( iter->second->isMasked() )
Doucet, Mathieu
committed
{
Doucet, Mathieu
committed
detectorList.push_back(iter->first);
}