Mantid
Loading...
Searching...
No Matches
LoadSQW2.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 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 "MantidMDAlgorithms/DllConfig.h"
15#include <fstream>
16
17namespace Mantid {
18
19// Forward declarations
20namespace API {
21class ExperimentInfo;
22}
23namespace Geometry {
24class OrientedLattice;
25}
26
27namespace MDAlgorithms {
28
29class MANTID_MDALGORITHMS_DLL LoadSQW2 : public API::IFileLoader<Kernel::FileDescriptor> {
30public:
31 const std::string name() const override;
32 int version() const override;
33 const std::vector<std::string> seeAlso() const override { return {"LoadNXSPE", "SaveNXSPE"}; }
34 const std::string category() const override;
35 const std::string summary() const override;
36 int confidence(Kernel::FileDescriptor &descriptor) const override;
37
38private:
41
42 void init() override;
43 void exec() override;
44 void cacheInputs();
45 void initFileReader();
46 int32_t readMainHeader();
47 void throwIfUnsupportedFileType(int32_t sqwType);
48 void createOutputWorkspace();
49 void readAllSPEHeadersToWorkspace();
50 std::shared_ptr<API::ExperimentInfo> readSingleSPEHeader();
51 void cacheFrameTransforms(const Geometry::OrientedLattice &lattice);
52 void skipDetectorSection();
53 void readDataSection();
54 void skipDataSectionMetadata();
55 void readSQWDimensions();
56 std::vector<int32_t> readProjection();
57 std::vector<float> calculateDimLimitsFromData();
58 Geometry::IMDDimension_sptr createQDimension(size_t index, float dimMin, float dimMax, size_t nbins,
59 const Kernel::DblMatrix &bmat);
60 Geometry::IMDDimension_sptr createEnDimension(float umin, float umax, size_t nbins);
61 void setupBoxController();
62 void setupFileBackend(const std::string &filebackPath);
63 void readPixelDataIntoWorkspace();
64 void splitAllBoxes();
65 void warnIfMemoryInsufficient(int64_t npixtot);
66 size_t addEventFromBuffer(const float *pixel);
67 void toOutputFrame(coord_t *centers);
68 void finalize();
69
70 std::unique_ptr<std::ifstream> m_file;
71 std::unique_ptr<Kernel::BinaryStreamReader> m_reader;
72 std::shared_ptr<SQWWorkspace> m_outputWS;
73 uint16_t m_nspe = 0;
75 std::string m_outputFrame;
76};
77
78} // namespace MDAlgorithms
79} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
Defines an interface to an algorithm that loads a file so that it can take part in the automatic sele...
Definition: IFileLoader.h:19
Templated class for the multi-dimensional event workspace.
Class to implement UB matrix.
Defines a wrapper around an open file.
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: LoadSQW2.h:33
std::unique_ptr< Kernel::BinaryStreamReader > m_reader
Definition: LoadSQW2.h:71
std::unique_ptr< std::ifstream > m_file
Definition: LoadSQW2.h:70
Kernel::DblMatrix m_uToRLU
Definition: LoadSQW2.h:74
std::shared_ptr< SQWWorkspace > m_outputWS
Definition: LoadSQW2.h:72
std::shared_ptr< IMDDimension > IMDDimension_sptr
Shared Pointer for IMDDimension. Frequently used type in framework.
Definition: IMDDimension.h:98
Helper class which provides the Collimation Length for SANS instruments.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
Definition: MDTypes.h:27