22const
std::
string DgsRemap::name()
const {
return "DgsRemap"; }
37 "An input workspace to mask and group.");
40 "A workspace containing masking information.");
43 "A workspace containing grouping information");
45 "Name of an old grouping format (not XML) file.");
46 this->
declareProperty(
"ExecuteOppositeOrder",
false,
"Execute grouping before masking.");
48 "The resulting workspace.");
58 bool runOpposite = this->
getProperty(
"ExecuteOppositeOrder");
74 mask->setProperty(
"Workspace", iWS);
75 mask->setProperty(
"MaskedWorkspace", maskWS);
76 mask->executeAsChildAlg();
82 std::string oldGroupingFile = this->
getProperty(
"OldGroupingFile");
83 if (groupWS && !oldGroupingFile.empty()) {
84 throw std::runtime_error(
"Choose either GroupingWorkspace or OldGroupingFile property!");
87 if (groupWS || !oldGroupingFile.empty()) {
89 group->setProperty(
"InputWorkspace", iWS);
90 group->setProperty(
"OutputWorkspace", iWS);
93 std::vector<int> groupDetIdList;
95 gWS->makeDetectorIDToGroupVector(groupDetIdList, ngroups);
96 group->setProperty(
"DetectorList", groupDetIdList);
98 if (!oldGroupingFile.empty()) {
99 group->setProperty(
"MapFile", oldGroupingFile);
101 group->setProperty(
"Behaviour",
"Average");
102 group->executeAsChildAlg();
103 oWS = group->getProperty(
"OutputWorkspace");
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
@ OptionalLoad
to specify a file to read but the file doesn't have to exist
A property class for workspaces.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
DgsRemap : This algorithm takes a workspace and masks and groups that workspace if appropriate inform...
void init() override
Initialize the algorithm's properties.
int version() const override
Algorithm's version for identification.
const std::string category() const override
Algorithm's category for identification.
void execGrouping(const API::MatrixWorkspace_sptr &iWS, API::MatrixWorkspace_sptr &oWS)
void exec() override
Execute the algorithm.
void execMasking(const API::MatrixWorkspace_sptr &iWS)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< GroupingWorkspace > GroupingWorkspace_sptr
shared pointer to the GroupingWorkspace class
@ Input
An input workspace.
@ Output
An output workspace.