Mantid
Loading...
Searching...
No Matches
LoadBankFromDiskTask.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2017 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"
11#include "MantidKernel/Task.h"
13
14#include <cstdint>
15
16class BankPulseTimes;
17
18namespace NeXus {
19class File;
20}
21
22namespace Mantid {
23namespace DataHandling {
24class DefaultEventLoader;
25
29class MANTID_DATAHANDLING_DLL LoadBankFromDiskTask : public Kernel::Task {
30
31public:
32 LoadBankFromDiskTask(DefaultEventLoader &loader, std::string entry_name, std::string entry_type,
33 const std::size_t numEvents, const bool oldNeXusFileNames, API::Progress *prog,
34 std::shared_ptr<std::mutex> ioMutex, Kernel::ThreadScheduler &scheduler,
35 std::vector<int> framePeriodNumbers);
36
37 void run() override;
38
39private:
40 void loadPulseTimes(::NeXus::File &file);
41 std::vector<uint64_t> loadEventIndex(::NeXus::File &file);
42 void prepareEventId(::NeXus::File &file, int64_t &start_event, int64_t &stop_event,
43 const std::vector<uint64_t> &event_index);
44 std::unique_ptr<std::vector<uint32_t>> loadEventId(::NeXus::File &file);
45 std::unique_ptr<std::vector<float>> loadTof(::NeXus::File &file);
46 std::unique_ptr<std::vector<float>> loadEventWeights(::NeXus::File &file);
47 int64_t recalculateDataSize(const int64_t &size);
48
52 std::string entry_name;
54 std::string entry_type;
60 std::shared_ptr<BankPulseTimes> thisBankPulseTimes;
66 std::vector<int64_t> m_loadStart;
68 std::vector<int64_t> m_loadSize;
70 uint32_t m_min_id;
72 uint32_t m_max_id;
76 const std::vector<int> m_framePeriodNumbers;
77}; // END-DEF-CLASS LoadBankFromDiskTask
78
79} // namespace DataHandling
80} // namespace Mantid
This class defines the pulse times for a specific bank.
Helper class for reporting progress from algorithms.
Definition: Progress.h:25
Helper class for LoadEventNexus that is specific to the current default loading code for NXevent_data...
This task does the disk IO from loading the NXS file, and so will be on a disk IO mutex.
uint32_t m_max_id
Maximum pixel ID in this data.
Kernel::ThreadScheduler & scheduler
ThreadScheduler running this task.
std::vector< int64_t > m_loadSize
How much to load in the file.
uint32_t m_min_id
Minimum pixel ID in this data.
API::Progress * prog
Progress reporting.
std::vector< int64_t > m_loadStart
Index to load start at in the file.
const std::vector< int > m_framePeriodNumbers
Frame period numbers.
std::shared_ptr< BankPulseTimes > thisBankPulseTimes
Object with the pulse times for this bank.
DefaultEventLoader & m_loader
Algorithm being run.
bool m_loadError
Did we get an error in loading.
A Task is a unit of work to be scheduled and run by a ThreadPool.
Definition: Task.h:29
The ThreadScheduler object defines how tasks are allocated to threads and in what order.
std::size_t numEvents(::NeXus::File &file, bool &hasTotalCounts, bool &oldNeXusFileNames, const std::string &prefix, const NexusHDF5Descriptor &descriptor)
Get the number of events in the currently opened group.
Helper class which provides the Collimation Length for SANS instruments.