Mantid
Loading...
Searching...
No Matches
ConvertSpectrumAxis2.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 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 "MantidAlgorithms/DllConfig.h"
12
13namespace Mantid {
14namespace Geometry {
15class DetectorInfo;
16}
17namespace API {
18class MatrixWorkspace;
19}
20namespace Algorithms {
36class MANTID_ALGORITHMS_DLL ConvertSpectrumAxis2 final : public API::Algorithm {
37public:
39 const std::string name() const override { return "ConvertSpectrumAxis"; }
41 const std::string summary() const override {
42 return "Converts the axis of a Workspace2D which normally holds spectrum "
43 "numbers to one of Q, Q^2 or theta. 'Note': After running this "
44 "algorithm, some features will be unavailable on the workspace as "
45 "it will have lost all connection to the instrument. This includes "
46 "things like the 3D Instrument Display.";
47 }
48
50 int version() const override { return (2); }
51 const std::vector<std::string> seeAlso() const override { return {"ConvertAxesToRealSpace", "ConvertUnits"}; }
53 const std::string category() const override { return "Transforms\\Units;Transforms\\Axes"; }
54
55private:
57 void init() override;
59 void exec() override;
61 void createThetaMap(API::Progress &progress, const std::string &targetUnit, API::MatrixWorkspace_sptr &inputWS);
63 double inPlaneTwoTheta(const size_t index, const API::MatrixWorkspace_sptr &inputWS) const;
65 double signedInPlaneTwoTheta(const size_t index, const API::MatrixWorkspace_sptr &inputWS) const;
67 void createElasticQMap(API::Progress &progress, const std::string &targetUnit, API::MatrixWorkspace_sptr &inputWS);
69 API::MatrixWorkspace_sptr createOutputWorkspace(API::Progress &progress, const std::string &targetUnit,
71
73 std::multimap<double, size_t> m_indexMap;
74
76 std::vector<double> m_axis;
77
80
82 void emplaceIndexMap(double value, size_t wsIndex);
83
85 double getEfixed(const size_t detectorIndex, const Mantid::Geometry::DetectorInfo &detectorInfo,
86 const API::MatrixWorkspace &inputWS, const int emode) const;
87};
88
89} // namespace Algorithms
90} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
IntArray detectorIndex
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Base MatrixWorkspace Abstract Class.
Helper class for reporting progress from algorithms.
Definition: Progress.h:25
Converts the representation of the vertical axis (the one up the side of a matrix in MantidPlot) of a...
std::vector< double > m_axis
Vector of axis in case ordering is not asked.
int version() const override
Algorithm's version.
bool m_toOrder
Flag whether ordering is needed.
const std::string category() const override
Algorithm's category for identification.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
const std::string summary() const override
Summary of algorithms purpose.
const std::string name() const override
Algorithm's name.
std::multimap< double, size_t > m_indexMap
Map to which the conversion to the unit is stored.
Geometry::DetectorInfo is an intermediate step towards a DetectorInfo that is part of Instrument-2....
Definition: DetectorInfo.h:49
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.