-
Notifications
You must be signed in to change notification settings - Fork 122
/
LoadILLDiffraction.h
130 lines (104 loc) · 4.9 KB
/
LoadILLDiffraction.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef MANTID_DATAHANDLING_LOADILLDIFFRACTION_H_
#define MANTID_DATAHANDLING_LOADILLDIFFRACTION_H_
#include "MantidAPI/IFileLoader.h"
#include "MantidDataHandling/DllConfig.h"
#include "MantidDataHandling/LoadHelper.h"
#include "MantidKernel/DateAndTime.h"
#include "MantidKernel/V3D.h"
#include "MantidNexus/NexusClasses.h"
namespace Mantid {
namespace DataHandling {
/** LoadILLDiffraction : Loads ILL diffraction nexus files.
@date 15/05/17
Copyright © 2017 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class MANTID_DATAHANDLING_DLL LoadILLDiffraction
: public API::IFileLoader<Kernel::NexusDescriptor> {
public:
const std::string name() const override;
int version() const override;
const std::string category() const override;
const std::string summary() const override;
int confidence(Kernel::NexusDescriptor &descriptor) const override;
LoadILLDiffraction();
private:
enum ScanType : size_t { NoScan = 0, DetectorScan = 1, OtherScan = 2 };
struct ScannedVariables {
int axis;
int scanned;
std::string name;
std::string property;
std::string unit;
ScannedVariables(std::string n, std::string p, std::string u)
: axis(0), scanned(0), name(n), property(p), unit(u) {}
void setAxis(int a) { axis = a; }
void setScanned(int s) { scanned = s; }
};
void init() override;
std::map<std::string, std::string> validateInputs() override;
void exec() override;
void calculateRelativeRotations(std::vector<double> &instrumentAngles,
const Kernel::V3D &tube1Position);
void fillDataScanMetaData(const NeXus::NXDouble &);
void fillMovingInstrumentScan(const NeXus::NXUInt &, const NeXus::NXDouble &);
void fillStaticInstrumentScan(const NeXus::NXUInt &, const NeXus::NXDouble &,
const NeXus::NXFloat &);
std::vector<Types::Core::DateAndTime>
getAbsoluteTimes(const NeXus::NXDouble &) const;
std::vector<double> getAxis(const NeXus::NXDouble &) const;
std::vector<double> getDurations(const NeXus::NXDouble &) const;
std::vector<double> getMonitor(const NeXus::NXDouble &) const;
std::string getInstrumentFilePath(const std::string &) const;
Kernel::V3D getReferenceComponentPosition(
const API::MatrixWorkspace_sptr &instrumentWorkspace);
bool containsCalibratedData(const std::string &filename) const;
std::vector<double>
getScannedVaribleByPropertyName(const NeXus::NXDouble &scan,
const std::string &propertyName) const;
void initStaticWorkspace();
void initMovingWorkspace(const NeXus::NXDouble &scan);
void loadDataScan();
API::MatrixWorkspace_sptr loadEmptyInstrument();
void loadMetaData();
void loadScanVars();
void loadStaticInstrument();
void moveTwoThetaZero(double);
void resolveInstrument();
void resolveScanType();
void setSampleLogs();
void computeThetaOffset();
double
m_offsetTheta; ///< the 2theta offset for D20 to account for dead pixels
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_numberDetectorsRead; ///< number of cells read from file
size_t m_numberDetectorsActual; ///< number of cells actually active
size_t m_numberScanPoints; ///< number of scan points
size_t m_resolutionMode; ///< resolution mode; 1:low, 2:nominal, 3:high
std::string m_instName; ///< instrument name to load the IDF
std::set<std::string> m_instNames; ///< supported instruments
std::string m_filename; ///< file name to load
Types::Core::DateAndTime m_startTime; ///< start time of acquisition
ScanType m_scanType; ///< NoScan, DetectorScan or OtherScan
std::vector<ScannedVariables> m_scanVar; ///< holds the scan info
LoadHelper m_loadHelper; ///< a helper for metadata
API::MatrixWorkspace_sptr m_outWorkspace; ///< output workspace
};
} // namespace DataHandling
} // namespace Mantid
#endif /* MANTID_DATAHANDLING_LOADILLDIFFRACTION_H_ */