-
Notifications
You must be signed in to change notification settings - Fork 122
/
LoadMuonNexusV2.h
89 lines (83 loc) · 3.45 KB
/
LoadMuonNexusV2.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
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2020 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/NexusFileLoader.h"
#include "MantidAPI/WorkspaceGroup_fwd.h"
#include "MantidDataHandling/LoadMuonNexusV2NexusHelper.h"
#include "MantidDataHandling/LoadMuonStrategy.h"
#include "MantidGeometry/IDTypes.h"
#include "MantidNexus/NexusClasses.h"
namespace Mantid {
namespace DataHandling {
/** @class LoadMuonNexusV2 LoadMuonNexusV2.h DataHandling/LoadMuonNexusV2.h
Loads a file in the Nexus Muon format V2 and stores it in a 2D workspace
(Workspace2D class). LoadMuonNexus is an algorithm that loads
an HDF5 file and as such inherits from API::NexusFileLoader and
the init() & execLoader() methods.
Required Properties:
<UL>
<LI> Filename - The name of and path to the input NeXus file </LI>
<LI> OutputWorkspace - The name of the workspace in which to store the imported
data
(a multiperiod file will store higher periods in workspaces called
OutputWorkspace_PeriodNo)
[ not yet implemented for Muon Nexus V2 ]</LI>
<LI> spectrum_min - The spectrum to start loading from</LI>
<LI> spectrum_max - The spectrum to load to</LI>
<LI> spectrum_list - An ArrayProperty of spectra to load</LI>
</UL>
@author Stephen Smith, ISIS
*/
class DLLExport LoadMuonNexusV2 : public API::NexusFileLoader {
public:
// Default constructor
LoadMuonNexusV2();
/// Algorithm's name for identification overriding a virtual method
const std::string name() const override { return "LoadMuonNexusV2"; }
/// Summary of algorithms purpose
const std::string summary() const override {
return "The LoadMuonNexus algorithm will read the given NeXus Muon data "
"file Version 2 and use the results to populate the named "
"workspace. LoadMuonNexus may be invoked by Load if it is "
"given a NeXus file of this type.";
}
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::NexusHDF5Descriptor &descriptor) const override;
// Version
int version() const override { return 1; }
/// Algorithm's category for identification overriding a virtual method
const std::string category() const override { return "DataHandling\\Nexus"; }
private:
/// Overwrites Algorithm method.
void init() override;
/// Overwrites Algorithm method
void execLoader() override;
// Determines whether entry contains multi period data
void isEntryMultiPeriod();
// Run child algorithm LoadISISNexus2
API::Workspace_sptr runLoadISISNexus();
// Load Muon specific properties
void loadMuonProperties(size_t numSpectra);
/// The name and path of the input file
std::string m_filename;
/// The number of the input entry
int64_t m_entrynumber;
// Is file multi period
bool m_isFileMultiPeriod;
// Are multi periods loaded
bool m_multiPeriodsLoaded;
// Choose loader strategy
void chooseLoaderStrategy(const API::Workspace_sptr &workspace);
// The loading strategy used
std::unique_ptr<LoadMuonStrategy> m_loadMuonStrategy;
// Nexus loading helper class
std::unique_ptr<LoadMuonNexusV2NexusHelper> m_nexusLoader;
// Change the time axis unit as LoadISISNexus has the wrong one
void applyTimeAxisUnitCorrection(API::Workspace &workspace);
};
} // namespace DataHandling
} // namespace Mantid