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:
64 const std::string name() const override { return "LoadHFIRSANS"; }
66 const std::string summary() const override {
67 return "Loads a SANS data file produce by the HFIR instruments at ORNL. "
68 "The instrument geometry is also loaded. The center of the detector "
69 "is placed at (0,0,D), where D is the sample-to-detector distance.";
70 }
71
73 int version() const override { return 1; }
74 const std::vector<std::string> seeAlso() const override { return {"LoadSpiceAscii", "LoadSpiceXML2DDet"}; }
76 const std::string category() const override { return "DataHandling\\Text;SANS\\DataHandling"; }
77
79 int confidence(Kernel::FileDescriptor &descriptor) const override;
80
81 int getNumberOfMonitors() const { return m_nMonitors; }
82
83private:
85 void init() override;
87 void exec() override;
88
89 void setInputFileAsHandler();
90 void setSansSpiceXmlFormatVersion();
91 void setTimes();
92 void setWavelength();
93
94 std::pair<int, int> parseDetectorDimensions(const std::string &dims_str);
95 std::vector<int> readData(const std::string &dataXpath = "//Data");
96 void permuteTubes(std::vector<int> &data);
97
98 void storeValue(int specID, double value, double error, double wavelength, double dwavelength);
99 void createWorkspace();
100 template <class T> void addRunProperty(const std::string &name, const T &value, const std::string &units = "");
101 template <class T> void addRunTimeSeriesProperty(const std::string &name, const T &value);
102 void setBeamTrapRunProperty();
103 void storeMetaDataIntoWS();
104 void runLoadInstrument();
105 void rotateDetector();
106 void setDetectorDistance();
107 void moveDetector();
108 std::string getInstrumentStringParameter(const std::string &parameter);
109 double getInstrumentDoubleParameter(const std::string &parameter);
110 double getSourceToSampleDistance();
111 void setBeamDiameter();
112
113 /* constants */
115 static const int m_nMonitors = 2;
116 // when parsing the metadata ignore those tags
117 const std::vector<std::string> m_tags_to_ignore{"Detector", "DetectorWing"};
118
121 std::map<std::string, std::string> m_metadata;
122
123 double m_sansSpiceXmlFormatVersion{0.0};
127 Mantid::Types::Core::DateAndTime m_startTime;
128 Mantid::Types::Core::DateAndTime m_endTime;
129};
130} // namespace DataHandling
131} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
double error
Definition: IndexPeaks.cpp:133
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.
Definition: LoadHFIRSANS.h:60
const std::string summary() const override
Summary of algorithms purpose.
Definition: LoadHFIRSANS.h:66
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
Definition: LoadHFIRSANS.h:76
Mantid::Types::Core::DateAndTime m_startTime
Definition: LoadHFIRSANS.h:127
DataObjects::Workspace2D_sptr m_workspace
Definition: LoadHFIRSANS.h:120
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Definition: LoadHFIRSANS.h:74
Mantid::DataHandling::XmlHandler m_xmlHandler
Definition: LoadHFIRSANS.h:119
std::map< std::string, std::string > m_metadata
Definition: LoadHFIRSANS.h:121
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition: LoadHFIRSANS.h:64
int version() const override
Algorithm's version for identification overriding a virtual method.
Definition: LoadHFIRSANS.h:73
Mantid::Types::Core::DateAndTime m_endTime
Definition: LoadHFIRSANS.h:128
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.
Definition: Algorithm.h:30