Mantid
Loading...
Searching...
No Matches
LoadPSIMuonBin.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
14#include <cstdint>
15
20namespace Mantid {
21namespace DataHandling {
22
23struct headerData {
25 int16_t tdcOverflow;
26 int16_t numberOfRuns;
29 int32_t totalEvents;
36 int32_t periodOfSave;
37 int32_t periodOfMon;
38 std::string sample;
39 std::string temp;
40 std::string field;
41 std::string orientation;
42 std::string comment;
43 std::string dateStart;
44 std::string dateEnd;
45 std::string timeStart;
46 std::string timeEnd;
47 std::string monDeviation;
48 int32_t scalars[18];
49 std::string labels_scalars[18]; // 18 Strings with 4 max length
50 std::string labelsOfHistograms[16]; // 18 Strings with 4 max length
51 int16_t integerT0[16];
52 int16_t firstGood[16];
53 int16_t lastGood[16];
54 float realT0[16];
55 float temperatures[4];
57 float monLow[4];
58 float monHigh[4];
59};
60
62 std::vector<std::string> titles;
63 std::string startDateTime;
65};
66
67class MANTID_DATAHANDLING_DLL LoadPSIMuonBin : public API::IFileLoader<Kernel::FileDescriptor> {
68public:
69 const std::string name() const override;
70 const std::string summary() const override;
71 int version() const override;
72 const std::string category() const override;
73 int confidence(Kernel::FileDescriptor &descriptor) const override;
74 bool loadMutipleAsOne() override;
75
76private:
77 void init() override;
78 void exec() override;
79 std::string getFormattedDateTime(const std::string &date, const std::string &time);
80 void assignOutputWorkspaceParticulars(DataObjects::Workspace2D_sptr &outputWorkspace);
81 void readSingleVariables(Mantid::Kernel::BinaryStreamReader &streamReader);
82 void readStringVariables(Mantid::Kernel::BinaryStreamReader &streamReader);
83 void readArrayVariables(Mantid::Kernel::BinaryStreamReader &streamReader);
84 void readInHeader(Mantid::Kernel::BinaryStreamReader &streamReader);
85 void readInHistograms(Mantid::Kernel::BinaryStreamReader &streamReader);
86 void generateUnknownAxis();
87 void makeDeadTimeTable(const size_t &numSpec);
88 void setDetectorGroupingTable(const size_t &numSpec);
90 // Temperature file processing
91 void readInTemperatureFile(DataObjects::Workspace2D_sptr &ws);
92 std::string detectTempFile();
93 void processLine(const std::string &line, DataObjects::Workspace2D_sptr &ws);
94 void readInTemperatureFileHeader(const std::string &contents);
95 void processHeaderLine(const std::string &line);
96 void processDateHeaderLine(const std::string &line);
97 void processTitleHeaderLine(const std::string &line);
98
99 // Sample log helper functions
101 void addToSampleLog(const std::string &logName, const std::string &logText, DataObjects::Workspace2D_sptr &ws);
102 void addToSampleLog(const std::string &logName, const double &logNumber, DataObjects::Workspace2D_sptr &ws);
103 void addToSampleLog(const std::string &logName, const int &logNumber, DataObjects::Workspace2D_sptr &ws);
104
105 std::vector<std::vector<double>> m_histograms;
106 struct headerData m_header;
107 struct temperatureHeaderData m_tempHeader;
108 std::vector<double> m_xAxis;
109 std::vector<std::vector<double>> m_eAxis;
110};
111
112} // namespace DataHandling
113} // namespace Mantid
Defines an interface to an algorithm that loads a file so that it can take part in the automatic sele...
Definition: IFileLoader.h:19
std::vector< std::vector< double > > m_eAxis
std::vector< std::vector< double > > m_histograms
Assists with reading a binary file by providing standard overloads for the istream operators (>>) to ...
Defines a wrapper around an open file.
std::shared_ptr< Algorithm > Algorithm_sptr
Typedef for a shared pointer to an Algorithm.
Definition: Algorithm.h:61
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
Helper class which provides the Collimation Length for SANS instruments.