-
Notifications
You must be signed in to change notification settings - Fork 121
/
LoadILLReflectometry.h
94 lines (89 loc) · 3.69 KB
/
LoadILLReflectometry.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
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2014 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 "MantidAPI/MatrixWorkspace_fwd.h"
#include "MantidDataHandling/LoadHelper.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidNexus/NexusClasses.h"
#include "MantidTypes/Core/DateAndTime.h"
namespace Mantid {
namespace DataHandling {
/*! LoadILLReflectometry : Loads an ILL reflectometry Nexus data file.
*/
class DLLExport LoadILLReflectometry : public API::IFileLoader<Kernel::NexusDescriptor> {
public:
LoadILLReflectometry() = default;
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::NexusDescriptor &descriptor) const override;
/// Algorithm's name for identification. @see Algorithm::name
const std::string name() const override { return "LoadILLReflectometry"; }
/// Algorithm's version for identification. @see Algorithm::version
int version() const override { return 1; }
const std::vector<std::string> seeAlso() const override { return {"LoadNexus"}; }
/// Algorithm's category for search and find. @see Algorithm::category
const std::string category() const override { return "DataHandling\\Nexus;ILL\\Reflectometry"; }
/// Algorithm's summary. @see Algorithm::summary
const std::string summary() const override {
return "Loads an ILL reflectometry Nexus file (instrument D17 or "
"FIGARO).";
}
double doubleFromRun(const std::string &entryName) const;
private:
/// ID tags for supported instruments.
enum class Supported { D17, FIGARO };
void init() override;
void exec() override;
double sampleDetectorDistance() const;
double sourceSampleDistance() const;
void sampleHorizontalOffset();
void sampleAngle(NeXus::NXEntry &entry);
void initWorkspace(const std::vector<std::vector<int>> &monitorsData);
void initNames(NeXus::NXEntry &entry);
void initPixelWidth();
void loadDataDetails(NeXus::NXEntry &entry);
std::vector<double> getXValues();
void convertTofToWavelength();
double reflectometryPeak();
void loadData(NeXus::NXEntry &entry, const std::vector<std::vector<int>> &monitorsData,
const std::vector<double> &xVals);
void loadNexusEntriesIntoProperties();
std::vector<int> loadSingleMonitor(NeXus::NXEntry &entry, const std::string &monitor_data);
std::vector<std::vector<int>> loadMonitors(NeXus::NXEntry &entry);
void loadInstrument();
double peakOffsetAngle();
void addSampleLogs();
double detectorRotation();
void placeDetector();
void placeSlits();
void placeSource();
double collimationAngle() const;
double detectorAngle() const;
double offsetAngle(const double peakCentre, const double detectorCentre, const double detectorDistance) const;
Supported m_instrument{Supported::D17};
size_t m_acqMode{1}; ///(1: TOF (default), 0: monochromatic)
size_t m_numberOfChannels{0};
size_t m_numberOfHistograms{0};
std::string m_detectorAngleName;
std::string m_sampleAngleName;
std::string m_offsetFrom;
std::string m_chopper1Name;
std::string m_chopper2Name;
double m_tofDelay{0.0};
double m_channelWidth{0.0};
double m_detectorAngle{0.0};
double m_detectorDistance{0.0};
double m_pixelWidth{0.0};
double m_sampleZOffset{0.0};
double m_sourceDistance{0.0};
double m_sampleAngle{0.0};
Mantid::DataHandling::LoadHelper m_loader;
Mantid::Types::Core::DateAndTime m_startTime;
API::MatrixWorkspace_sptr m_localWorkspace;
};
} // namespace DataHandling
} // namespace Mantid