Mantid
Loading...
Searching...
No Matches
BankPulseTimes.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
9#include "MantidDataHandling/DllConfig.h"
11#include <mutex>
12
13namespace Mantid::Nexus {
14class File;
15}
16
17namespace Mantid::DataHandling {
22class MANTID_DATAHANDLING_DLL BankPulseTimes {
23public:
25 static const int FIRST_PERIOD;
27 static const std::string DEFAULT_START_TIME;
28
30 BankPulseTimes(Nexus::File &file, const std::vector<int> &periodNumbers);
31
33 BankPulseTimes(const std::vector<Mantid::Types::Core::DateAndTime> &times);
34
36 BankPulseTimes(const std::vector<Mantid::Types::Core::DateAndTime> &times, const std::vector<int> &periodNumbers);
37
39 size_t numberOfPulses() const;
40
42 bool arePulseTimesIncreasing() const;
43
45 int periodNumber(const size_t index) const;
47 const Mantid::Types::Core::DateAndTime &pulseTime(const size_t index) const;
48
55 std::vector<size_t> getPulseIndices(const Mantid::Types::Core::DateAndTime &start,
56 const Mantid::Types::Core::DateAndTime &stop) const;
57
58 // convert a list of time intervals to pulse indices
59 std::vector<size_t> getPulseIndices(const std::vector<Mantid::Kernel::TimeInterval> &splitters) const;
60
62 bool equals(size_t otherNumPulse, const std::string &otherStartTime);
63
65 std::string startTime;
66
67private:
68 template <typename ValueType>
69 void readData(Nexus::File &file, std::size_t numValues, Mantid::Types::Core::DateAndTime &start);
70
72 void updateStartTime();
73
75 void finalizePeriodNumbers();
76
78 std::vector<int> periodNumbers;
79
81 std::vector<Mantid::Types::Core::DateAndTime> pulseTimes;
82
84
85 mutable int8_t m_sorting_info;
86 mutable std::mutex m_sortingMutex;
87};
88} // namespace Mantid::DataHandling
std::map< DeltaEMode::Type, std::string > index
This class defines the pulse times for a specific bank.
std::string startTime
String describing the start time.
std::vector< Mantid::Types::Core::DateAndTime > pulseTimes
Array of the pulse times.
static const int FIRST_PERIOD
Starting number for assigning periods.
std::vector< int > periodNumbers
Vector of period numbers corresponding to each pulse.
static const std::string DEFAULT_START_TIME
Unix epoch used as default epoch when the file does not specify one.
bool MANTID_API_DLL equals(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs, double tolerance=0.0)
Performs a comparison operation on two workspaces, using the CompareWorkspaces algorithm.
Header for a base Nexus::Exception.