-
Notifications
You must be signed in to change notification settings - Fork 122
/
LoadILLSANS.h
98 lines (88 loc) · 4.45 KB
/
LoadILLSANS.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
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2013 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/IFileLoader.h"
#include "MantidDataHandling/LoadHelper.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidKernel/System.h"
#include "MantidNexus/NexusClasses.h"
namespace Mantid {
namespace DataHandling {
/** LoadILLSANS; supports D11, D22 and D33 (TOF/monochromatic)
*/
class DLLExport LoadILLSANS : public API::IFileLoader<Kernel::NexusDescriptor> {
public:
LoadILLSANS();
const std::string name() const override;
const std::string summary() const override;
int version() const override;
const std::vector<std::string> seeAlso() const override { return {"LoadNexus"}; }
const std::string category() const override;
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::NexusDescriptor &descriptor) const override;
private:
enum MultichannelType { TOF, KINETIC };
struct DetectorPosition {
double distanceSampleRear;
double distanceSampleBottomTop;
double distanceSampleRightLeft;
double shiftLeft;
double shiftRight;
double shiftUp;
double shiftDown;
void operator>>(std::ostream &strm) {
strm << "DetectorPosition : "
<< "distanceSampleRear = " << distanceSampleRear << ", "
<< "distanceSampleBottomTop = " << distanceSampleBottomTop << ", "
<< "distanceSampleRightLeft = " << distanceSampleRightLeft << ", "
<< "shiftLeft = " << shiftLeft << ", "
<< "shiftRight = " << shiftRight << ", "
<< "shiftUp = " << shiftUp << ", "
<< "shiftDown = " << shiftDown << '\n';
}
};
void init() override;
void exec() override;
void setInstrumentName(const NeXus::NXEntry &, const std::string &);
DetectorPosition getDetectorPositionD33(const NeXus::NXEntry &, const std::string &);
void initWorkSpace(NeXus::NXEntry &, const std::string &);
void initWorkSpaceD11B(NeXus::NXEntry &, const std::string &);
void initWorkSpaceD22B(NeXus::NXEntry &, const std::string &);
void initWorkSpaceD33(NeXus::NXEntry &, const std::string &);
void initWorkSpaceD16(NeXus::NXEntry &, const std::string &);
void createEmptyWorkspace(const size_t, const size_t, const MultichannelType type = MultichannelType::TOF);
size_t loadDataFromMonitors(NeXus::NXEntry &firstEntry, size_t firstIndex = 0,
const MultichannelType type = MultichannelType::TOF);
size_t loadDataFromTubes(NeXus::NXInt &, const std::vector<double> &, size_t,
const MultichannelType type = MultichannelType::TOF);
void runLoadInstrument();
void moveDetectorsD33(const DetectorPosition &);
void moveDetectorDistance(double distance, const std::string &componentName);
void moveDetectorHorizontal(double, const std::string &);
void moveDetectorVertical(double, const std::string &);
Kernel::V3D getComponentPosition(const std::string &componentName);
void loadMetaData(const NeXus::NXEntry &, const std::string &);
std::string getInstrumentFilePath(const std::string &) const;
void rotateInstrument(double, const std::string &);
void placeD16(double, double, const std::string &);
void adjustTOF();
void moveSource();
LoadHelper m_loadHelper; ///< Load helper for metadata
std::string m_instrumentName; ///< Name of the instrument
std::vector<std::string> m_supportedInstruments; ///< List of supported instruments
API::MatrixWorkspace_sptr m_localWorkspace; ///< to-be output workspace
std::vector<double> m_defaultBinning; ///< the default x-axis binning
std::string m_resMode; ///< Resolution mode for D11 and D22
bool m_isTOF; ///< TOF or monochromatic flag
double m_sourcePos; ///< Source Z (for D33 TOF)
bool m_isD16Omega; ///< Data come from a D16 omega scan flag
void setFinalProperties(const std::string &filename);
std::vector<double> getVariableTimeBinning(const NeXus::NXEntry &, const std::string &, const NeXus::NXInt &,
const NeXus::NXFloat &) const;
};
} // namespace DataHandling
} // namespace Mantid