Mantid
Loading...
Searching...
No Matches
CreateDetectorTable.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2019 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 "MantidAPI/Column.h"
14#include "MantidAlgorithms/DllConfig.h"
17#include <cstddef>
18
19namespace Mantid {
20namespace Algorithms {
21
22class MANTID_ALGORITHMS_DLL CreateDetectorTable final : public API::Algorithm {
23public:
27 const std::string name() const override { return "CreateDetectorTable"; }
29 int version() const override { return 1; }
31 const std::string category() const override { return "Utility\\Workspaces"; }
33 const std::string summary() const override {
34 return "Create a table showing detector information for the given "
35 "workspace and optionally the data for that detector";
36 }
37 std::map<std::string, std::string> validateInputs() override;
38
40 void setup();
41 void createColumns();
42 void populateTable();
43 void populateTableByDetID();
44 void setTableToOutput();
45
46private:
48 std::vector<int> workspaceIndices;
53 bool calcQ;
58 bool showSignedTwoTheta; // If true, signedVersion of the two theta
60 double sampleDist;
61 std::vector<API::Column_sptr> m_columnCache;
64 int wsIndex = 0;
65 int specNo = 0;
66 std::set<int> detIds;
67 std::string timeIndexes;
68 std::string isMonitor;
69 double dataY0 = 0, dataE0 = 0;
70 double R = 0, theta = 0, q = 0, phi = 0;
71 double difa = 0, difc = 0, difcUnc = 0, tzero = 0;
72 Kernel::V3D detPosition{0, 0, 0};
73 };
74
75 void init() override;
77 void exec() override;
78
79 void getSphericalCoordinates(size_t wsIndex, double &R, double &theta, double &phi);
80 const std::string getTimeIndexes(size_t wsIndex);
81 double getQ(size_t wsIndex);
82 void getDiffConst(size_t wsIndex, double &difa, double &difc, double &difcUnc, double &tzero);
83 void writeRowToTable(const int row, const DetectorRowData &data);
84 DetectorRowData calculateWsIdxData(size_t wsIndex);
85 bool retrieveSignedThetaParameter();
86};
87
89std::string createTruncatedList(const std::set<int> &elements);
90
91} // namespace Algorithms
92} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
const std::string category() const override
Algorithm's category for identification.
const std::string summary() const override
Summary of algorithms purpose.
const std::string name() const override
Algorithm's name.
std::vector< API::Column_sptr > m_columnCache
int version() const override
Algorithm's version.
const Geometry::DetectorInfo * detectorInfo
Geometry::DetectorInfo is an intermediate step towards a DetectorInfo that is part of Instrument-2....
Class for 3D vectors.
Definition V3D.h:34
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::string createTruncatedList(const std::set< int > &elements)
Converts a list to a string, shortened if necessary.
PointingAlong
Type to describe pointing along options.
Helper class which provides the Collimation Length for SANS instruments.