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
13#include "MantidMDAlgorithms/DllConfig.h"
15
16#include <boost/scoped_ptr.hpp>
17#include <optional>
18
19namespace Mantid {
20namespace MDAlgorithms {
21
27class MANTID_MDALGORITHMS_DLL LoadMD : public API::IFileLoader<Nexus::NexusDescriptorLazy> {
28public:
29 LoadMD();
30
32 const std::string name() const override { return "LoadMD"; };
34 const std::string summary() const override { return "Load a MDEventWorkspace in .nxs format."; }
35
37 int version() const override { return 1; };
38 const std::vector<std::string> seeAlso() const override { return {"SaveMD"}; }
40 const std::string category() const override { return "MDAlgorithms\\DataHandling"; }
41
43 int confidence(Nexus::NexusDescriptorLazy &descriptor) const override;
44
45private:
47 void init() override;
49 void exec() override;
50
51 // ki-kf for Inelastic convention; kf-ki for Crystallography convention
52 std::string convention;
53
55 template <typename MDE, size_t nd> void doLoad(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws);
56
57 void loadExperimentInfos(std::shared_ptr<Mantid::API::MultipleExperimentInfos> ws);
58
59 template <typename NumT>
60 void loadSlab(const std::string &name, NumT *data, const DataObjects::MDHistoWorkspace_sptr &ws, NXnumtype dataType);
61 void loadHisto();
62
63 void loadDimensions();
64
65 void loadDimensions2();
66
67 void loadCoordinateSystem();
68
69 void loadQConvention();
70
71 void loadVisualNormalization(const std::string &key, std::optional<Mantid::API::MDNormalization> &normalization);
72
74 void loadAffineMatricies(const API::IMDWorkspace_sptr &ws);
76 API::CoordTransform *loadAffineMatrix(const std::string &entry_name);
77
79 void setMDFrameOnWorkspaceFromLegacyFile(const API::IMDWorkspace_sptr &ws);
80
82 void checkForRequiredLegacyFixup(const API::IMDWorkspace_sptr &ws);
83
85 std::vector<double> qDimensions(const API::IMDWorkspace_sptr &ws);
86
88 boost::scoped_ptr<Nexus::File> m_file;
89
91 std::string m_filename;
92
94 size_t m_numDims;
95
97 std::vector<Mantid::Geometry::IMDDimension_sptr> m_dims;
101 std::string m_QConvention;
104
107
109 std::optional<Mantid::API::MDNormalization> m_visualNormalization;
110 std::optional<Mantid::API::MDNormalization> m_visualNormalizationHisto;
111
113 static const std::string VISUAL_NORMALIZATION_KEY;
114 static const std::string VISUAL_NORMALIZATION_KEY_HISTO;
115
118};
119
120} // namespace MDAlgorithms
121} // namespace Mantid
std::string name
Definition Run.cpp:60
Unique SingleValueParameter Declaration for InputNDimensions.
Defines an interface to an algorithm that loads a file so that it can take part in the automatic sele...
Definition IFileLoader.h:19
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:27
boost::scoped_ptr< Nexus::File > m_file
Open file handle.
Definition LoadMD.h:88
const std::string summary() const override
Summary of algorithms purpose.
Definition LoadMD.h:34
std::vector< Mantid::Geometry::IMDDimension_sptr > m_dims
Each dimension object loaded.
Definition LoadMD.h:97
Kernel::SpecialCoordinateSystem m_coordSystem
Coordinate system.
Definition LoadMD.h:99
int version() const override
Algorithm's version for identification.
Definition LoadMD.h:37
bool m_requiresMDFrameCorrection
MDFrame correction flag.
Definition LoadMD.h:117
void loadExperimentInfos(std::shared_ptr< Mantid::API::MultipleExperimentInfos > ws)
std::string m_QConvention
QConvention.
Definition LoadMD.h:101
std::string m_filename
Name of that file.
Definition LoadMD.h:91
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:38
std::optional< Mantid::API::MDNormalization > m_visualNormalizationHisto
Definition LoadMD.h:110
int m_saveMDVersion
Version of SaveMD used to save the file.
Definition LoadMD.h:106
bool m_BoxStructureAndMethadata
load only the box structure with empty boxes but do not tload boxes events
Definition LoadMD.h:103
std::optional< Mantid::API::MDNormalization > m_visualNormalization
Visual normalization.
Definition LoadMD.h:109
static const std::string VISUAL_NORMALIZATION_KEY_HISTO
Definition LoadMD.h:114
const std::string category() const override
Algorithm's category for identification.
Definition LoadMD.h:40
static const std::string VISUAL_NORMALIZATION_KEY
Named entry.
Definition LoadMD.h:113
const std::string name() const override
Algorithm's name for identification.
Definition LoadMD.h:32
size_t m_numDims
Number of dimensions in loaded file.
Definition LoadMD.h:94
The primitive types published by this API.
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
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.