/
LoadSwans.h
53 lines (46 loc) · 1.78 KB
/
LoadSwans.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
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2016 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/Algorithm.h"
#include "MantidAPI/IFileLoader.h"
#include "MantidDataHandling/DllConfig.h"
#include "MantidDataObjects/EventWorkspace.h"
#include "MantidKernel/FileDescriptor.h"
#include <map>
namespace Mantid {
namespace DataHandling {
/** LoadSwans : Test Loader to read data from the LDRD new SWANS detector
*/
class MANTID_DATAHANDLING_DLL LoadSwans final : public API::IFileLoader<Kernel::FileDescriptor> {
public:
LoadSwans();
const std::string name() const override;
int version() const override;
const std::string category() const override;
const std::string summary() const override;
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::FileDescriptor &descriptor) const override;
private:
void init() override;
void exec() override;
std::map<uint32_t, std::vector<uint32_t>> loadData();
std::vector<double> loadMetaData();
void setMetaDataAsWorkspaceProperties(const std::vector<double> &metadata);
void loadDataIntoTheWorkspace(const std::map<uint32_t, std::vector<uint32_t>> &eventMap);
void setTimeAxis();
void loadInstrument();
void placeDetectorInSpace();
unsigned int getDetectorSize();
// Member variables
DataObjects::EventWorkspace_sptr m_ws;
unsigned int m_detector_size = 0;
// Constants:
// This has to be here because the data file to date has no metadata
const std::string m_instrumentName = "SWANS";
};
} // namespace DataHandling
} // namespace Mantid