Mantid
Loading...
Searching...
No Matches
LoadMD.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 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
15#include "MantidMDAlgorithms/DllConfig.h"
16
17#include <boost/optional.hpp>
18#include <boost/scoped_ptr.hpp>
19
20namespace Mantid {
21namespace MDAlgorithms {
22
28class MANTID_MDALGORITHMS_DLL LoadMD : public API::NexusFileLoader {
29public:
30 LoadMD();
31
33 const std::string name() const override { return "LoadMD"; };
35 const std::string summary() const override { return "Load a MDEventWorkspace in .nxs format."; }
36
38 int version() const override { return 1; };
39 const std::vector<std::string> seeAlso() const override { return {"SaveMD"}; }
41 const std::string category() const override { return "MDAlgorithms\\DataHandling"; }
42
44 int confidence(Kernel::NexusHDF5Descriptor &descriptor) const override;
45
46private:
48 void init() override;
50 void execLoader() override;
51
52 // ki-kf for Inelastic convention; kf-ki for Crystallography convention
53 std::string convention;
54
56 template <typename MDE, size_t nd> void doLoad(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws);
57
58 void loadExperimentInfos(std::shared_ptr<Mantid::API::MultipleExperimentInfos> ws);
59
60 void loadSlab(const std::string &name, void *data, const DataObjects::MDHistoWorkspace_sptr &ws,
61 ::NeXus::NXnumtype dataType);
62 void loadHisto();
63
64 void loadDimensions();
65
66 void loadDimensions2();
67
68 void loadCoordinateSystem();
69
70 void loadQConvention();
71
72 void loadVisualNormalization(const std::string &key, boost::optional<Mantid::API::MDNormalization> &normalization);
73
75 void loadAffineMatricies(const API::IMDWorkspace_sptr &ws);
77 API::CoordTransform *loadAffineMatrix(const std::string &entry_name);
78
80 void setMDFrameOnWorkspaceFromLegacyFile(const API::IMDWorkspace_sptr &ws);
81
83 void checkForRequiredLegacyFixup(const API::IMDWorkspace_sptr &ws);
84
86 std::vector<double> qDimensions(const API::IMDWorkspace_sptr &ws);
87
89 // clang-format off
90 boost::scoped_ptr< ::NeXus::File> m_file;
91 // clang-format on
92
94 std::string m_filename;
95
97 size_t m_numDims;
98
100 std::vector<Mantid::Geometry::IMDDimension_sptr> m_dims;
104 std::string m_QConvention;
107
110
112 boost::optional<Mantid::API::MDNormalization> m_visualNormalization;
113 boost::optional<Mantid::API::MDNormalization> m_visualNormalizationHisto;
114
116 static const std::string VISUAL_NORMALIZATION_KEY;
117 static const std::string VISUAL_NORMALIZATION_KEY_HISTO;
118
121};
122
123} // namespace MDAlgorithms
124} // namespace Mantid
Unique SingleValueParameter Declaration for InputNDimensions.
std::shared_ptr< MDEventWorkspace< MDE, nd > > sptr
Typedef for a shared pointer of this kind of event workspace.
Load a .nxs file into a MDEventWorkspace.
Definition: LoadMD.h:28
const std::string summary() const override
Summary of algorithms purpose.
Definition: LoadMD.h:35
std::vector< Mantid::Geometry::IMDDimension_sptr > m_dims
Each dimension object loaded.
Definition: LoadMD.h:100
Kernel::SpecialCoordinateSystem m_coordSystem
Coordinate system.
Definition: LoadMD.h:102
boost::optional< Mantid::API::MDNormalization > m_visualNormalizationHisto
Definition: LoadMD.h:113
std::string convention
Definition: LoadMD.h:53
int version() const override
Algorithm's version for identification.
Definition: LoadMD.h:38
bool m_requiresMDFrameCorrection
MDFrame correction flag.
Definition: LoadMD.h:120
void loadExperimentInfos(std::shared_ptr< Mantid::API::MultipleExperimentInfos > ws)
boost::scoped_ptr< ::NeXus::File > m_file
Open file handle.
Definition: LoadMD.h:90
std::string m_QConvention
QConvention.
Definition: LoadMD.h:104
std::string m_filename
Name of that file.
Definition: LoadMD.h:94
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: LoadMD.h:39
int m_saveMDVersion
Version of SaveMD used to save the file.
Definition: LoadMD.h:109
bool m_BoxStructureAndMethadata
load only the box structure with empty boxes but do not tload boxes events
Definition: LoadMD.h:106
static const std::string VISUAL_NORMALIZATION_KEY_HISTO
Definition: LoadMD.h:117
const std::string category() const override
Algorithm's category for identification.
Definition: LoadMD.h:41
static const std::string VISUAL_NORMALIZATION_KEY
Named entry.
Definition: LoadMD.h:116
boost::optional< Mantid::API::MDNormalization > m_visualNormalization
Visual normalization.
Definition: LoadMD.h:112
const std::string name() const override
Algorithm's name for identification.
Definition: LoadMD.h:33
size_t m_numDims
Number of dimensions in loaded file.
Definition: LoadMD.h:97
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
Definition: IMDWorkspace.h:146
std::shared_ptr< MDHistoWorkspace > MDHistoWorkspace_sptr
A shared pointer to a MDHistoWorkspace.
SpecialCoordinateSystem
Special coordinate systems for Q3D.
Helper class which provides the Collimation Length for SANS instruments.