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 {
58class MANTID_ALGORITHMS_DLL ReadGroupsFromFile final : public API::Algorithm {
59public:
63 const std::string name() const override { return "ReadGroupsFromFile"; }
65 const std::string summary() const override {
66 return "Read a diffraction calibration file (*.cal) or an XML grouping "
67 "file (*.xml) and an instrument name, and output a 2D workspace "
68 "containing on the Y-axis the values of the Group each detector "
69 "belongs to. This is used to visualise the grouping scheme for "
70 "powder diffractometers, where a large number of detectors are "
71 "grouped together. The output 2D workspace can be visualize using "
72 "the show instrument method.";
73 }
74
76 int version() const override { return (1); }
77 const std::vector<std::string> seeAlso() const override {
78 return {"CreateDummyCalFile", "CreateCalFileByNames", "DiffractionFocussing",
79 "LoadCalFile", "SaveCalFile", "MergeCalFiles"};
80 }
82 const std::string category() const override { return "Diffraction\\DataHandling\\CalFiles"; }
83
84private:
87 using calmap = std::unordered_map<int, std::pair<int, int>>;
89 void init() override;
91 void exec() override;
93 void readGroupingFile(const std::string &filename);
95 void readXMLGroupingFile(const std::string &filename);
101 DataObjects::Workspace2D_sptr loadEmptyInstrument(const std::string &instrument_xml_name);
105};
106
107} // namespace Algorithms
108} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
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.