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
10#include "MantidDataHandling/DllConfig.h"
15
16#include <cstdint>
17
22namespace Mantid {
23namespace DataHandling {
24
25struct headerData {
27 int16_t tdcOverflow;
28 int16_t numberOfRuns;
31 int32_t totalEvents;
38 int32_t periodOfSave;
39 int32_t periodOfMon;
40 std::string sample;
41 std::string temp;
42 std::string field;
43 std::string orientation;
44 std::string comment;
45 std::string dateStart;
46 std::string dateEnd;
47 std::string timeStart;
48 std::string timeEnd;
49 std::string monDeviation;
50 int32_t scalars[18];
51 std::string labels_scalars[18]; // 18 Strings with 4 max length
52 std::string labelsOfHistograms[16]; // 18 Strings with 4 max length
53 int16_t integerT0[16];
54 int16_t firstGood[16];
55 int16_t lastGood[16];
56 float realT0[16];
57 float temperatures[4];
59 float monLow[4];
60 float monHigh[4];
61};
62
64 std::vector<std::string> titles;
65 std::string startDateTime;
67};
68
69class MANTID_DATAHANDLING_DLL LoadPSIMuonBin : public API::IFileLoader<Kernel::FileDescriptor> {
70public:
71 const std::string name() const override;
72 const std::string summary() const override;
73 int version() const override;
74 const std::string category() const override;
75 int confidence(Kernel::FileDescriptor &descriptor) const override;
76
77private:
78 void init() override;
79 void exec() override;
80 std::string getFormattedDateTime(const std::string &date, const std::string &time);
81 void assignOutputWorkspaceParticulars(DataObjects::Workspace2D_sptr &outputWorkspace);
82 void readSingleVariables(Mantid::Kernel::BinaryStreamReader &streamReader);
83 void readStringVariables(Mantid::Kernel::BinaryStreamReader &streamReader);
84 void readArrayVariables(Mantid::Kernel::BinaryStreamReader &streamReader);
85 void readInHeader(Mantid::Kernel::BinaryStreamReader &streamReader);
86 void readInHistograms(Mantid::Kernel::BinaryStreamReader &streamReader);
87 void generateUnknownAxis();
88 void makeDeadTimeTable(const size_t &numSpec);
89 void setDetectorGroupingTable(const size_t &numSpec);
91 // Temperature file processing
92 void readInTemperatureFile(DataObjects::Workspace2D_sptr &ws);
93 std::string detectTempFile();
94 void processLine(const std::string &line, DataObjects::Workspace2D_sptr &ws);
95 void readInTemperatureFileHeader(const std::string &contents);
96 void processHeaderLine(const std::string &line);
97 void processDateHeaderLine(const std::string &line);
98 void processTitleHeaderLine(const std::string &line);
99
100 // Sample log helper functions
102 void addToSampleLog(const std::string &logName, const std::string &logText, DataObjects::Workspace2D_sptr &ws);
103 void addToSampleLog(const std::string &logName, const double &logNumber, DataObjects::Workspace2D_sptr &ws);
104 void addToSampleLog(const std::string &logName, const int &logNumber, DataObjects::Workspace2D_sptr &ws);
105
106 std::vector<std::vector<double>> m_histograms;
107 struct headerData m_header;
108 struct temperatureHeaderData m_tempHeader;
109 std::vector<double> m_xAxis;
110 std::vector<std::vector<double>> m_eAxis;
111};
112
113} // namespace DataHandling
114} // namespace Mantid
std::string name
Definition Run.cpp:60
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:52
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.