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"
14
15#include <cstdint>
16
17namespace Mantid::Nexus {
18class File;
19}
20
21namespace Mantid {
22namespace DataHandling {
23class BankPulseTimes;
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::unique_ptr<std::vector<uint64_t>> loadEventIndex(Nexus::File &file);
42 void prepareEventId(Nexus::File &file, uint64_t &start_event, uint64_t &stop_event,
43 const uint64_t &start_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 uint64_t recalculateDataSize(const int64_t size);
48
52 std::string entry_name;
54 std::string entry_type;
60 std::shared_ptr<BankPulseTimes> thisBankPulseTimes;
63 // Old names in the file are different
64 std::string m_detIdFieldName;
71 uint32_t m_min_id;
73 uint32_t m_max_id;
77 const std::vector<int> m_framePeriodNumbers;
78}; // END-DEF-CLASS LoadBankFromDiskTask
79
80} // namespace DataHandling
81} // namespace Mantid
Helper class for reporting progress from algorithms.
Definition Progress.h:25
This class defines the pulse times for a specific bank.
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.
Nexus::DimVector m_loadStart
Index to load start at in the file.
uint32_t m_max_id
Maximum pixel ID in this data.
Kernel::ThreadScheduler & scheduler
ThreadScheduler running this task.
std::string entry_name
NXS address to bank.
uint32_t m_min_id
Minimum pixel ID in this data.
API::Progress * prog
Progress reporting.
Nexus::DimVector m_loadSize
How much to load 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 Nexus::NexusDescriptor &descriptor)
Get the number of events in the currently opened group.
Header for a base Nexus::Exception.
std::vector< dimsize_t > DimVector
Helper class which provides the Collimation Length for SANS instruments.