Mantid
Loading...
Searching...
No Matches
LoadHFIRSANS.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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
14
15#include <map>
16#include <string>
17#include <utility>
18#include <vector>
19
20namespace Poco {
21namespace XML {
22class Element;
23}
24} // namespace Poco
25
26namespace Mantid {
27namespace DataHandling {
60class MANTID_DATAHANDLING_DLL LoadHFIRSANS : public API::IFileLoader<Kernel::FileDescriptor> {
61
62public:
66 const std::string name() const override { return "LoadHFIRSANS"; }
68 const std::string summary() const override {
69 return "Loads a SANS data file produce by the HFIR instruments at ORNL. "
70 "The instrument geometry is also loaded. The center of the detector "
71 "is placed at (0,0,D), where D is the sample-to-detector distance.";
72 }
73
75 int version() const override { return 1; }
76 const std::vector<std::string> seeAlso() const override { return {"LoadSpiceAscii", "LoadSpiceXML2DDet"}; }
78 const std::string category() const override { return "DataHandling\\Text;SANS\\DataHandling"; }
79
81 int confidence(Kernel::FileDescriptor &descriptor) const override;
82
83 int getNumberOfMonitors() const { return m_nMonitors; }
84
85private:
87 void init() override;
89 void exec() override;
90
91 void setInputFileAsHandler();
92 void setSansSpiceXmlFormatVersion();
93 void setTimes();
94 void setWavelength();
95
96 std::pair<int, int> parseDetectorDimensions(const std::string &dims_str);
97 std::vector<int> readData(const std::string &dataXpath = "//Data");
98 void permuteTubes(std::vector<int> &data);
99
100 void storeValue(int specID, double value, double error, double wavelength, double dwavelength);
101 void createWorkspace();
102 template <class T> void addRunProperty(const std::string &name, const T &value, const std::string &units = "");
103 template <class T> void addRunTimeSeriesProperty(const std::string &name, const T &value);
104 void setBeamTrapRunProperty();
105 void storeMetaDataIntoWS();
106 void runLoadInstrument();
107 void rotateDetector();
108 void setDetectorDistance();
109 void moveDetector();
110 std::string getInstrumentStringParameter(const std::string &parameter);
111 double getInstrumentDoubleParameter(const std::string &parameter);
112 double getSourceToSampleDistance();
113 void setBeamDiameter();
114
115 /* constants */
117 static const int m_nMonitors = 2;
118 // when parsing the metadata ignore those tags
119 const std::vector<std::string> m_tags_to_ignore{"Detector", "DetectorWing"};
120
123 std::map<std::string, std::string> m_metadata;
124
129 Mantid::Types::Core::DateAndTime m_startTime;
130 Mantid::Types::Core::DateAndTime m_endTime;
131};
132} // namespace DataHandling
133} // namespace Mantid
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
double error
Defines an interface to an algorithm that loads a file so that it can take part in the automatic sele...
Definition IFileLoader.h:19
This algorithm loads a SPICE2D file for HFIR SANS into a workspace.
const std::string summary() const override
Summary of algorithms purpose.
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
Mantid::Types::Core::DateAndTime m_startTime
DataObjects::Workspace2D_sptr m_workspace
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Mantid::DataHandling::XmlHandler m_xmlHandler
std::map< std::string, std::string > m_metadata
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
int version() const override
Algorithm's version for identification overriding a virtual method.
Mantid::Types::Core::DateAndTime m_endTime
Defines a wrapper around an open file.
std::shared_ptr< T > createWorkspace(InitArgs... args)
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
Helper class which provides the Collimation Length for SANS instruments.