/
LoadTOFRawNexus.h
104 lines (77 loc) · 3.38 KB
/
LoadTOFRawNexus.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
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2007 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
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/IFileLoader.h"
#include "MantidAPI/Sample.h"
#include "MantidAPI/SpectraDetectorTypes.h"
#include "MantidDataHandling/DllConfig.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidKernel/DateAndTime.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidNexus/NexusClasses.h"
#include <mutex>
namespace Mantid {
namespace DataHandling {
/**
Loads a NeXus file that conforms to the TOFRaw instrument definition format and
stores it in a 2D workspace.
*/
class MANTID_DATAHANDLING_DLL LoadTOFRawNexus : public API::IFileLoader<Kernel::NexusDescriptor> {
public:
/// Default Constructor
LoadTOFRawNexus();
/// Algorithm's name for identification overriding a virtual method
const std::string name() const override { return "LoadTOFRawNexus"; }
/// Summary of algorithms purpose
const std::string summary() const override { return "Loads a NeXus file confirming to the TOFRaw format"; }
/// Algorithm's version for identification overriding a virtual method
int version() const override { return 1; }
const std::vector<std::string> seeAlso() const override { return {"LoadNexus"}; }
/// Algorithm's category for identification overriding a virtual method
const std::string category() const override { return "DataHandling\\Nexus"; }
static std::string getEntryName(const std::string &filename);
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::NexusDescriptor &descriptor) const override;
void countPixels(const std::string &nexusfilename, const std::string &entry_name,
std::vector<std::string> &bankNames);
/// Number of pixels
size_t m_numPixels;
/// Signal # to load. Default 1
int m_signalNo;
protected:
void init() override;
void exec() override;
/// Validate the optional input properties
void checkOptionalProperties();
/// Run LoadInstrument as a ChildAlgorithm
void runLoadInstrument(DataObjects::Workspace2D_sptr);
/// Load in details about the sample
void loadSampleData(DataObjects::Workspace2D_sptr, Mantid::NeXus::NXEntry &entry);
void loadBank(const std::string &nexusfilename, const std::string &entry_name, const std::string &bankName,
const API::MatrixWorkspace_sptr &WS, const detid2index_map &id_to_wi);
/// List of the absolute time of each pulse
std::vector<Types::Core::DateAndTime> pulseTimes;
/// Number of bins
size_t m_numBins;
/// Interval of chunk
specnum_t m_spec_min, m_spec_max;
/// Name of the 'data' field to load (depending on Signal)
std::string m_dataField;
/// Name of the 'axis' field to load (depending on Signal)
std::string m_axisField;
/// Units of the X axis found
std::string m_xUnits;
/// Mutex to avoid simultaneous file access
std::mutex m_fileMutex;
/// Flag for whether or not to assume the data is old SNS raw files;
bool m_assumeOldFile;
};
} // namespace DataHandling
} // namespace Mantid