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"
12#include <mutex>
13
14namespace Mantid::DataHandling {
19class MANTID_DATAHANDLING_DLL BankPulseTimes {
20public:
22 static const int FIRST_PERIOD;
24 static const std::string DEFAULT_START_TIME;
25
27 BankPulseTimes(Nexus::File &file, const std::vector<int> &periodNumbers);
28
30 BankPulseTimes(const std::vector<Mantid::Types::Core::DateAndTime> &times);
31
33 BankPulseTimes(const std::vector<Mantid::Types::Core::DateAndTime> &times, const std::vector<int> &periodNumbers);
34
36 size_t numberOfPulses() const;
37
39 bool arePulseTimesIncreasing() const;
40
42 int periodNumber(const size_t index) const;
44 const Mantid::Types::Core::DateAndTime &pulseTime(const size_t index) const;
45
52 std::vector<size_t> getPulseIndices(const Mantid::Types::Core::DateAndTime &start,
53 const Mantid::Types::Core::DateAndTime &stop) const;
54
55 // convert a list of time intervals to pulse indices
56 std::vector<size_t> getPulseIndices(const std::vector<Mantid::Kernel::TimeInterval> &splitters) const;
57
59 bool equals(size_t otherNumPulse, const std::string &otherStartTime);
60
62 std::string startTime;
63
64private:
65 template <typename ValueType>
66 void readData(Nexus::File &file, std::size_t numValues, Mantid::Types::Core::DateAndTime &start);
67
69 void updateStartTime();
70
72 void finalizePeriodNumbers();
73
75 std::vector<int> periodNumbers;
76
78 std::vector<Mantid::Types::Core::DateAndTime> pulseTimes;
79
81
82 mutable int8_t m_sorting_info;
83 mutable std::mutex m_sortingMutex;
84};
85} // 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.