Mantid
Loading...
Searching...
No Matches
MaskDetectors.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 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 +
7#pragma once
8
10#include "MantidDataHandling/DllConfig.h"
14
15namespace Mantid {
16namespace Indexing {
17class SpectrumNumber;
18}
19namespace DataHandling {
40class MANTID_DATAHANDLING_DLL MaskDetectors final : public API::Algorithm {
41public:
43 const std::string name() const override { return "MaskDetectors"; };
45 const std::string summary() const override {
46 return "An algorithm to mask a detector, or set of detectors, as not to be "
47 "used. The workspace spectra associated with those detectors are "
48 "zeroed.";
49 }
50
52 int version() const override { return 1; };
53 const std::vector<std::string> seeAlso() const override {
54 return {"MaskDetectorsInShape", "MaskDetectorsIf", "MaskSpectra", "MaskBTP", "MaskAngle", "InvertMask"};
55 }
57 const std::string category() const override { return "Transforms\\Masking"; }
58
59private:
60 // create type for range information
61 using RangeInfo = std::tuple<size_t, size_t, bool>;
62
63 const std::string workspaceMethodName() const override { return "maskDetectors"; }
64 const std::string workspaceMethodInputProperty() const override { return "Workspace"; }
65
66 // Implement abstract Algorithm methods
67 void init() override;
68 void exec() override;
69
71 void handleMaskByMaskWorkspace(const DataObjects::MaskWorkspace_const_sptr &maskWs,
72 const API::MatrixWorkspace_const_sptr &WS, std::vector<detid_t> &detectorList,
73 std::vector<size_t> &indexList, const RangeInfo &rangeInfo);
74
76 void handleMaskByMatrixWorkspace(const API::MatrixWorkspace_const_sptr &maskWs,
77 const API::MatrixWorkspace_const_sptr &WS, std::vector<detid_t> &detectorList,
78 std::vector<size_t> &indexList, const RangeInfo &rangeInfo);
79
80 void execPeaks(const DataObjects::PeaksWorkspace_sptr &WS);
81 void fillIndexListFromSpectra(std::vector<size_t> &indexList, std::vector<Indexing::SpectrumNumber> spectraList,
82 const API::MatrixWorkspace_sptr &WS, const RangeInfo &range_info);
83 void appendToDetectorListFromComponentList(std::vector<detid_t> &detectorList,
84 const std::vector<std::string> &componentList,
86 void appendToIndexListFromWS(std::vector<size_t> &indexList, const API::MatrixWorkspace_const_sptr &maskedWorkspace,
87 const RangeInfo &range_info);
88 void appendToDetectorListFromWS(std::vector<detid_t> &detectorList, const API::MatrixWorkspace_const_sptr &inputWs,
90 const std::tuple<size_t, size_t, bool> &range_info);
91 void appendToIndexListFromMaskWS(std::vector<size_t> &indexList,
92 const DataObjects::MaskWorkspace_const_sptr &maskedWorkspace,
93 const std::tuple<size_t, size_t, bool> &range_info);
94 void extractMaskedWSDetIDs(std::vector<detid_t> &detectorList, const DataObjects::MaskWorkspace_const_sptr &maskWS);
95 void constrainMaskedIndexes(std::vector<size_t> &indexList, const RangeInfo &range_info);
96
97 RangeInfo getRanges(const API::MatrixWorkspace_sptr &targWS);
98};
99
100} // namespace DataHandling
101} // namespace Mantid
IntArray detectorList
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
An algorithm to mask a detector, or set of detectors.
Definition: MaskDetectors.h:40
const std::string workspaceMethodName() const override
Definition: MaskDetectors.h:63
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Definition: MaskDetectors.h:53
std::tuple< size_t, size_t, bool > RangeInfo
Definition: MaskDetectors.h:61
const std::string workspaceMethodInputProperty() const override
Definition: MaskDetectors.h:64
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
Definition: MaskDetectors.h:57
int version() const override
Algorithm's version for identification overriding a virtual method.
Definition: MaskDetectors.h:52
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition: MaskDetectors.h:43
const std::string summary() const override
Summary of algorithms purpose.
Definition: MaskDetectors.h:45
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< const MaskWorkspace > MaskWorkspace_const_sptr
shared pointer to a const MaskWorkspace
Definition: MaskWorkspace.h:67
std::shared_ptr< PeaksWorkspace > PeaksWorkspace_sptr
Typedef for a shared pointer to a peaks workspace.
Helper class which provides the Collimation Length for SANS instruments.