Mantid
Loading...
Searching...
No Matches
LoadILLDiffraction.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2017 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
9#include <utility>
10
12#include "MantidDataHandling/DllConfig.h"
15#include "MantidKernel/V3D.h"
17
18namespace Mantid {
19namespace DataHandling {
20
25class MANTID_DATAHANDLING_DLL LoadILLDiffraction : public API::IFileLoader<Kernel::NexusDescriptor> {
26public:
27 const std::string name() const override;
28 int version() const override;
29 const std::vector<std::string> seeAlso() const override { return {"LoadNexus"}; }
30 const std::string category() const override;
31 const std::string summary() const override;
32 int confidence(Kernel::NexusDescriptor &descriptor) const override;
34
35private:
36 enum ScanType : size_t { NoScan = 0, DetectorScan = 1, OtherScan = 2 };
37
39 int axis;
41 std::string name;
42 std::string property;
43 std::string unit;
44
45 ScannedVariables(std::string n, std::string p, std::string u)
46 : axis(0), scanned(0), name(std::move(n)), property(std::move(p)), unit(std::move(u)) {}
47
48 void setAxis(int a) { axis = a; }
49 void setScanned(int s) { scanned = s; }
50 };
51
52 void init() override;
53 std::map<std::string, std::string> validateInputs() override;
54 void exec() override;
55
56 void calculateRelativeRotations(std::vector<double> &instrumentAngles, const Kernel::V3D &firstTubePosition);
57
58 void fillDataScanMetaData(const NeXus::NXDouble &);
59 void fillMovingInstrumentScan(const NeXus::NXUInt &, const NeXus::NXDouble &);
60 void fillStaticInstrumentScan(const NeXus::NXUInt &, const NeXus::NXDouble &, const double &);
61
62 std::vector<Types::Core::DateAndTime> getAbsoluteTimes(const NeXus::NXDouble &) const;
63 std::vector<double> getAxis(const NeXus::NXDouble &) const;
64 std::vector<double> getDurations(const NeXus::NXDouble &) const;
65 std::vector<double> getMonitor(const NeXus::NXDouble &) const;
66 std::string getInstrumentFilePath(const std::string &) const;
67 Kernel::V3D getReferenceComponentPosition(const API::MatrixWorkspace_sptr &instrumentWorkspace);
68 bool containsCalibratedData(const std::string &filename) const;
69
70 std::vector<double> getScannedVaribleByPropertyName(const NeXus::NXDouble &scan,
71 const std::string &propertyName) const;
72
73 void initStaticWorkspace(const std::string &start_time);
74 void initMovingWorkspace(const NeXus::NXDouble &scan, const std::string &start_time);
75
76 void loadDataScan();
77 API::MatrixWorkspace_sptr loadEmptyInstrument(const std::string &start_time);
78 void loadMetaData();
79 void loadScanVars();
80 void loadStaticInstrument();
81 void moveTwoThetaZero(double);
82 void resolveInstrument();
83 void resolveScanType();
84 void setSampleLogs();
85 void computeThetaOffset();
86 void convertAxisAndTranspose();
87
89 double m_offsetTheta{0.};
90 size_t m_sizeDim1;
92 size_t m_sizeDim2;
97
98 std::string m_instName;
99 std::set<std::string> m_instNames;
100 std::string m_filename;
101 Types::Core::DateAndTime m_startTime;
103 double m_pixelHeight{0.};
104 double m_maxHeight{0.};
105
106 std::vector<ScannedVariables> m_scanVar;
108 bool m_useCalibratedData{false};
110 bool m_isSpectrometer{false};
111};
112
113} // namespace DataHandling
114} // namespace Mantid
Defines an interface to an algorithm that loads a file so that it can take part in the automatic sele...
Definition: IFileLoader.h:19
LoadILLDiffraction : Loads ILL diffraction nexus files.
std::vector< ScannedVariables > m_scanVar
holds the scan info
size_t m_sizeDim1
size of dim1, number of tubes (D2B) or the whole detector (D20)
size_t m_sizeDim2
size of dim2, number of pixels (1 for D20!)
size_t m_resolutionMode
resolution mode; 1:low, 2:nominal, 3:high
API::MatrixWorkspace_sptr m_outWorkspace
output workspace
std::string m_instName
instrument name to load the IDF
size_t m_numberDetectorsRead
number of cells read from 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....
size_t m_numberDetectorsActual
number of cells actually active
ScanType m_scanType
NoScan, DetectorScan or OtherScan.
std::set< std::string > m_instNames
supported instruments
std::string m_filename
file name to load
size_t m_numberScanPoints
number of scan points
Types::Core::DateAndTime m_startTime
start time of acquisition
Defines a wrapper around a file whose internal structure can be accessed using the NeXus API.
Class for 3D vectors.
Definition: V3D.h:34
Templated class implementation of NXDataSet.
Definition: NexusClasses.h:203
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.
STL namespace.
ScannedVariables(std::string n, std::string p, std::string u)