Mantid
Loading...
Searching...
No Matches
ReadGroupsFromFile.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2009 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
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12
13#include "MantidAPI/Algorithm.h"
14#include "MantidAlgorithms/DllConfig.h"
16#include <unordered_map>
17
18namespace Mantid {
19namespace Algorithms {
59class MANTID_ALGORITHMS_DLL ReadGroupsFromFile final : public API::Algorithm {
60public:
64 const std::string name() const override { return "ReadGroupsFromFile"; }
66 const std::string summary() const override {
67 return "Read a diffraction calibration file (*.cal) or an XML grouping "
68 "file (*.xml) and an instrument name, and output a 2D workspace "
69 "containing on the Y-axis the values of the Group each detector "
70 "belongs to. This is used to visualise the grouping scheme for "
71 "powder diffractometers, where a large number of detectors are "
72 "grouped together. The output 2D workspace can be visualize using "
73 "the show instrument method.";
74 }
75
77 int version() const override { return (1); }
78 const std::vector<std::string> seeAlso() const override {
79 return {"CreateDummyCalFile", "CreateCalFileByNames", "AlignDetectors", "DiffractionFocussing",
80 "LoadCalFile", "SaveCalFile", "MergeCalFiles"};
81 }
83 const std::string category() const override { return "Diffraction\\DataHandling\\CalFiles"; }
84
85private:
88 using calmap = std::unordered_map<int, std::pair<int, int>>;
90 void init() override;
92 void exec() override;
94 void readGroupingFile(const std::string &filename);
96 void readXMLGroupingFile(const std::string &filename);
102 DataObjects::Workspace2D_sptr loadEmptyInstrument(const std::string &instrument_xml_name);
106};
107
108} // namespace Algorithms
109} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Read a diffraction calibration file (*.cal) and an instrument name, and output a 2D workspace contain...
int version() const override
Algorithm's version.
const std::string summary() const override
Summary of algorithms purpose.
const std::string category() const override
Algorithm's category for identification.
const std::string name() const override
Algorithm's name.
std::unordered_map< int, std::pair< int, int > > calmap
Map containing the detector entries found in the *.cal file.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
DataObjects::Workspace2D_sptr loadEmptyInstrument(const std::string &instrument_xml_name)
Child Algorithm to Load the associated empty instrument.
calmap calibration
Calibration map containing the detector entries found in the *.cal file.
std::map< detid_t, int > readGroupingFile(const std::string &groupingFileName, Progress &prog)
Read old-style .cal file to get the grouping.
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
Helper class which provides the Collimation Length for SANS instruments.