Mantid
Loading...
Searching...
No Matches
LoadSpice2D.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#include <map>
15#include <string>
16#include <utility>
17#include <vector>
18
19namespace Poco {
20namespace XML {
21class Element;
22}
23} // namespace Poco
24
25namespace Mantid {
26namespace DataHandling {
58class MANTID_DATAHANDLING_DLL LoadSpice2D : public API::IFileLoader<Kernel::FileDescriptor> {
59public:
61 const std::string name() const override { return "LoadSpice2D"; }
63 const std::string summary() const override {
64 return "Loads a SANS data file produce by the HFIR instruments at ORNL. "
65 "The instrument geometry is also loaded. The center of the detector "
66 "is placed at (0,0,D), where D is the sample-to-detector distance.";
67 }
68
70 int version() const override { return 1; }
71 const std::vector<std::string> seeAlso() const override { return {"LoadSpiceAscii", "LoadSpiceXML2DDet"}; }
73 const std::string category() const override { return "DataHandling\\Text;SANS\\DataHandling"; }
75 static const int nMonitors = 2;
76
78 int confidence(Kernel::FileDescriptor &descriptor) const override;
79
80private:
82 void init() override;
84 void exec() override;
85
88 void throwException(Poco::XML::Element *elem, const std::string &name, const std::string &fileName);
90 void runLoadInstrument(const std::string &inst_name, const DataObjects::Workspace2D_sptr &localWorkspace);
91
92 void setInputPropertiesAsMemberProperties();
93
94 void addMetadataAsRunProperties(const std::map<std::string, std::string> &);
95 std::pair<int, int> parseDetectorDimensions(const std::string &);
97 std::vector<int> getData(const std::string &);
98 void createWorkspace(const std::vector<int> &data, const std::string &title, double monitor1_counts,
99 double monitor2_counts);
100 void setWavelength(std::map<std::string, std::string> &metadata);
101 template <class T>
102 T addRunProperty(std::map<std::string, std::string> &metadata, const std::string &oldName, const std::string &newName,
103 const std::string &units = "");
104 template <class T> void addRunProperty(const std::string &name, const T &value, const std::string &units = "");
105 void setBeamTrapRunProperty(std::map<std::string, std::string> &metadata);
106 void detectorDistance(std::map<std::string, std::string> &metadata);
107 void detectorTranslation(std::map<std::string, std::string> &metadata);
108 void setMetadataAsRunProperties(std::map<std::string, std::string> &metadata);
109 void rotateDetector(const double &);
110 void setTimes();
111 void setSansSpiceXmlFormatVersion(std::map<std::string, std::string> &metadata);
112
113 // Member variables:
115 double m_wavelength_input{0.0};
116 double m_wavelength_spread_input{0.0};
118 double m_wavelength{0.0};
119 double m_dwavelength{0.0};
120 double m_sansSpiceXmlFormatVersion{0.0};
121 Mantid::Types::Core::DateAndTime m_startTime;
122 Mantid::Types::Core::DateAndTime m_endTime;
123};
124} // namespace DataHandling
125} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
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: LoadSpice2D.h:58
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition: LoadSpice2D.h:61
const std::string summary() const override
Summary of algorithms purpose.
Definition: LoadSpice2D.h:63
DataObjects::Workspace2D_sptr m_workspace
Definition: LoadSpice2D.h:114
Mantid::Types::Core::DateAndTime m_endTime
Definition: LoadSpice2D.h:122
int version() const override
Algorithm's version for identification overriding a virtual method.
Definition: LoadSpice2D.h:70
Mantid::Types::Core::DateAndTime m_startTime
Definition: LoadSpice2D.h:121
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: LoadSpice2D.h:71
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
Definition: LoadSpice2D.h:73
Mantid::DataHandling::XmlHandler m_xmlHandler
Definition: LoadSpice2D.h:117
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