Mantid
Loading...
Searching...
No Matches
LoadNexusMonitors2.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 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
11#include "MantidDataHandling/DllConfig.h"
13#include "MantidNexus/NexusFile.h"
14#include <boost/scoped_array.hpp>
15
16namespace Mantid {
17
18namespace HistogramData {
19class Counts;
20class BinEdges;
21} // namespace HistogramData
22namespace DataHandling {
23
40namespace LoadNexusMonitorsAlg {
41// spectrum is implicit in the structure as index + 1 - TODO was spectrumNo
43 std::string name{""};
47 bool hasEvent{false};
48 bool hasHisto{false};
49};
50} // namespace LoadNexusMonitorsAlg
51
52class MANTID_DATAHANDLING_DLL LoadNexusMonitors2 : public API::Algorithm {
53public:
55 const std::string name() const override { return "LoadNexusMonitors"; }
56
58 const std::string summary() const override { return "Load all monitors from a NeXus file into a workspace."; }
59
61 int version() const override { return 2; }
62 const std::vector<std::string> seeAlso() const override { return {"LoadNexus"}; }
63
65 const std::string category() const override { return "DataHandling\\Nexus"; }
66
67protected:
69 void init() override;
70
72 void exec() override;
73
74private:
76 void fixUDets(Nexus::File &file);
77
79 void runLoadLogs(const std::string &filename, const API::MatrixWorkspace_sptr &localWorkspace);
80
82 bool canOpenAsNeXus(const std::string &fname);
83
85 void splitMutiPeriodHistrogramData(const size_t numPeriods);
86
87 size_t getMonitorInfo(Nexus::File &file, size_t &numPeriods);
88
89 bool createOutputWorkspace(std::vector<bool> &loadMonitorFlags);
90
91 void readEventMonitorEntry(Nexus::File &file, size_t ws_index);
92
93 void readHistoMonitorEntry(Nexus::File &file, size_t ws_index, size_t numPeriods);
94
95private:
96 std::vector<LoadNexusMonitorsAlg::MonitorInfo> m_monitorInfo;
97 std::vector<HistogramData::BinEdges> m_multiPeriodBinEdges;
98 std::vector<HistogramData::Counts> m_multiPeriodCounts;
99 std::string m_filename;
101 size_t m_monitor_count{0};
102 std::string m_top_entry_name;
103};
104
105} // namespace DataHandling
106} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
int version() const override
Algorithm's version for identification overriding a virtual method.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
std::vector< LoadNexusMonitorsAlg::MonitorInfo > m_monitorInfo
std::string m_filename
The name and path of the input file.
std::vector< HistogramData::BinEdges > m_multiPeriodBinEdges
std::string m_top_entry_name
name of top level NXentry to use
const std::string name() const override
Algorithm's name for identification.
const std::string summary() const override
Summary of algorithms purpose.
API::MatrixWorkspace_sptr m_workspace
The workspace being filled out.
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
std::vector< HistogramData::Counts > m_multiPeriodCounts
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.
int32_t detid_t
Typedef for a detector ID.
int32_t specnum_t
Typedef for a spectrum Number.
Definition IDTypes.h:14
std::string name
name of the group in the nexus file - TODO was