Mantid
Loading...
Searching...
No Matches
LoadSpiceXML2DDet.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
12#include "MantidDataHandling/DllConfig.h"
13
14namespace Mantid {
15namespace DataHandling {
16
18public:
19 SpiceXMLNode(std::string nodename);
20 void setParameters(const std::string &nodetype, const std::string &nodeunit, const std::string &nodedescription);
21 void setValue(const std::string &strvalue);
22
23 bool hasUnit() const;
24 bool hasValue() const;
25
26 bool isString() const;
27 bool isInteger() const;
28 bool isDouble() const;
29
30 const std::string getName() const;
31 const std::string getUnit() const;
32 const std::string getDescription() const;
33 const std::string getValue() const;
34
35 std::string m_name;
36 std::string m_value;
37 std::string m_unit;
39 std::string m_typefullname;
40 std::string m_description;
41};
42
45class MANTID_DATAHANDLING_DLL LoadSpiceXML2DDet final : public API::Algorithm {
46public:
49
51 const std::string name() const override;
52
54 int version() const override;
55 const std::vector<std::string> seeAlso() const override { return {"LoadSpice2D"}; }
56
58 const std::string category() const override;
59
61 const std::string summary() const override;
62
63private:
64 void init() override;
65 void exec() override;
66
68 void processInputs();
69
71 API::MatrixWorkspace_sptr createMatrixWorkspace(const std::vector<unsigned int> &vec_counts);
73 std::vector<unsigned int> binaryParseIntegers(std::string &binary_file_name);
74
76 std::vector<SpiceXMLNode> xmlParseSpice(const std::string &xmlfilename);
77
79 API::MatrixWorkspace_sptr xmlCreateMatrixWorkspaceKnownGeometry(const std::vector<SpiceXMLNode> &vecxmlnode,
80 const size_t &numpixelx, const size_t &numpixely,
81 const std::string &detnodename,
82 const bool &loadinstrument);
83
85 API::MatrixWorkspace_sptr xmlCreateMatrixWorkspaceUnknowGeometry(const std::vector<SpiceXMLNode> &vecxmlnode,
86 const std::string &detnodename,
87 const bool &loadinstrument);
88
89 API::MatrixWorkspace_sptr xmlParseDetectorNode(const std::string &detvaluestr, bool loadinstrument,
90 double &max_counts);
91
94 void setupSampleLogFromSpiceTable(const API::MatrixWorkspace_sptr &matrixws,
95 const API::ITableWorkspace_sptr &spicetablews, int ptnumber);
96
98 bool setupSampleLogs(const API::MatrixWorkspace_sptr &outws);
99
101 void loadInstrument(const API::MatrixWorkspace_sptr &matrixws, const std::string &idffilename);
102
104 bool getHB3AWavelength(const API::MatrixWorkspace_sptr &dataws, double &wavelength);
105
107 void setXtoLabQ(const API::MatrixWorkspace_sptr &dataws, const double &wavelength);
108
110 std::string m_detXMLFileName;
112 std::string m_detXMLNodeName;
127 std::string m_idfFileName;
133};
134
135} // namespace DataHandling
136} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
LoadSpiceXML2DDet : Load 2D detector data in XML format form SPICE.
std::string m_detXMLNodeName
XML node name in detector counts file.
double m_detSampleDistanceShift
shift distance from sample to detector center
bool m_hasScanTable
Flag to show whether the SPICE scan table workspace is given.
int m_ptNumber4Log
Pt number for the sample logs to load with presense of Spice scan table workspace.
bool m_loadInstrument
Flag to show whether instrument is required to load.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
~LoadSpiceXML2DDet() override
Destructor.
std::string m_detXMLFileName
SPICE detector XML file.
size_t m_numPixelY
Pixel size at Y direction.
std::string m_idfFileName
IDF file name to override Mantid's.
double m_detXShift
shift of detector on X and Y direction
size_t m_numPixelX
Pixel size at X direction.
double m_userSpecifiedWaveLength
User specified wave length.
bool hasValue() const
Check whether XML node has value set.
bool isDouble() const
Is this node of double type?
bool isInteger() const
Is this node of integer type?
void setValue(const std::string &strvalue)
Set node value in string format.
void setParameters(const std::string &nodetype, const std::string &nodeunit, const std::string &nodedescription)
Set XML node parameters.
const std::string getName() const
Get name of XML node.
bool hasUnit() const
Check whether XML has unit set.
const std::string getValue() const
Get node's value in string.
bool isString() const
Is this node of string type?
const std::string getUnit() const
Get unit of XML node.
const std::string getDescription() const
Get node's description.
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
Helper class which provides the Collimation Length for SANS instruments.