Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::DataHandling::LoadBankFromDiskTask Class Reference

This task does the disk IO from loading the NXS file, and so will be on a disk IO mutex. More...

#include <LoadBankFromDiskTask.h>

Inheritance diagram for Mantid::DataHandling::LoadBankFromDiskTask:
Mantid::Kernel::Task

Public Member Functions

 LoadBankFromDiskTask (DefaultEventLoader &loader, std::string entry_name, std::string entry_type, const std::size_t numEvents, const bool oldNeXusFileNames, API::Progress *prog, std::shared_ptr< std::mutex > ioMutex, Kernel::ThreadScheduler &scheduler, std::vector< int > framePeriodNumbers)
 Constructor. More...
 
void run () override
 Main method that performs the work for the task. More...
 
- Public Member Functions inherited from Mantid::Kernel::Task
virtual double cost ()
 What is the computational cost of this task? More...
 
std::shared_ptr< std::mutex > getMutex ()
 Get the mutex object for this Task. More...
 
virtual void run ()=0
 Main method that performs the work for the task. More...
 
void setMutex (const std::shared_ptr< std::mutex > &mutex)
 Set the mutex object for this Task. More...
 
void setMutexObject (void *object)
 Use an arbitrary pointer to lock (mutex) the execution of this task. More...
 
 Task ()
 Default constructor. More...
 
 Task (double cost)
 Constructor with cost. More...
 
virtual ~Task ()=default
 Destructor. More...
 

Private Member Functions

std::unique_ptr< std::vector< uint32_t > > loadEventId (::NeXus::File &file)
 Load the event_id field, which has been opened. More...
 
std::vector< uint64_t > loadEventIndex (::NeXus::File &file)
 Load the event_index field (a list of size of # of pulses giving the index in the event list for that pulse) More...
 
std::unique_ptr< std::vector< float > > loadEventWeights (::NeXus::File &file)
 Load weight of weigthed events if they exist. More...
 
void loadPulseTimes (::NeXus::File &file)
 Load the pulse times, if needed. More...
 
std::unique_ptr< std::vector< float > > loadTof (::NeXus::File &file)
 Open and load the times-of-flight data. More...
 
void prepareEventId (::NeXus::File &file, int64_t &start_event, int64_t &stop_event, const std::vector< uint64_t > &event_index)
 Open the event_id field and validate the contents. More...
 
int64_t recalculateDataSize (const int64_t &size)
 Interpret the value describing the number of events. More...
 

Private Attributes

std::string entry_name
 NXS path to bank. More...
 
std::string entry_type
 NXS type. More...
 
const std::vector< int > m_framePeriodNumbers
 Frame period numbers. More...
 
bool m_have_weight
 Flag for simulated data. More...
 
DefaultEventLoaderm_loader
 Algorithm being run. More...
 
bool m_loadError
 Did we get an error in loading. More...
 
std::vector< int64_t > m_loadSize
 How much to load in the file. More...
 
std::vector< int64_t > m_loadStart
 Index to load start at in the file. More...
 
uint32_t m_max_id
 Maximum pixel ID in this data. More...
 
uint32_t m_min_id
 Minimum pixel ID in this data. More...
 
bool m_oldNexusFileNames
 Old names in the file? More...
 
API::Progressprog
 Progress reporting. More...
 
Kernel::ThreadSchedulerscheduler
 ThreadScheduler running this task. More...
 
std::shared_ptr< BankPulseTimesthisBankPulseTimes
 Object with the pulse times for this bank. More...
 

Additional Inherited Members

- Protected Attributes inherited from Mantid::Kernel::Task
double m_cost
 Cached computational cost for the thread. More...
 
std::shared_ptr< std::mutex > m_mutex
 Mutex associated with this task (can be NULL) More...
 

Detailed Description

This task does the disk IO from loading the NXS file, and so will be on a disk IO mutex.

Definition at line 29 of file LoadBankFromDiskTask.h.

Constructor & Destructor Documentation

◆ LoadBankFromDiskTask()

Mantid::DataHandling::LoadBankFromDiskTask::LoadBankFromDiskTask ( DefaultEventLoader loader,
std::string  entry_name,
std::string  entry_type,
const std::size_t  numEvents,
const bool  oldNeXusFileNames,
API::Progress prog,
std::shared_ptr< std::mutex >  ioMutex,
Kernel::ThreadScheduler scheduler,
std::vector< int >  framePeriodNumbers 
)

Constructor.

Parameters
loader:: Handle to the main loader
entry_name:: The pathname of the bank to load
entry_type:: The classtype of the entry to load
numEvents:: The number of events in the bank.
oldNeXusFileNames:: Identify if file is of old variety.
prog:: an optional Progress object
ioMutex:: a mutex shared for all Disk I-O tasks
scheduler:: the ThreadScheduler that runs this task.
framePeriodNumbers:: Period numbers corresponding to each frame

Definition at line 37 of file LoadBankFromDiskTask.cpp.

References Mantid::Kernel::Task::m_cost, m_max_id, m_min_id, Mantid::DataHandling::numEvents(), and Mantid::Kernel::Task::setMutex().

Member Function Documentation

◆ loadEventId()

std::unique_ptr< std::vector< uint32_t > > Mantid::DataHandling::LoadBankFromDiskTask::loadEventId ( ::NeXus::File &  file)
private

◆ loadEventIndex()

std::vector< uint64_t > Mantid::DataHandling::LoadBankFromDiskTask::loadEventIndex ( ::NeXus::File &  file)
private

Load the event_index field (a list of size of # of pulses giving the index in the event list for that pulse)

Parameters
file:: File handle for the NeXus file

Definition at line 97 of file LoadBankFromDiskTask.cpp.

References Mantid::DataHandling::DefaultEventLoader::alg, Mantid::Kernel::Logger::debug(), entry_name, Mantid::API::Algorithm::getLogger(), m_loader, and m_loadError.

Referenced by run().

◆ loadEventWeights()

std::unique_ptr< std::vector< float > > Mantid::DataHandling::LoadBankFromDiskTask::loadEventWeights ( ::NeXus::File &  file)
private

Load weight of weigthed events if they exist.

Parameters
fileAn NeXus::File object opened at the correct group
Returns
A new array containing the weights or a nullptr if the weights are not present

Definition at line 263 of file LoadBankFromDiskTask.cpp.

References Mantid::DataHandling::DefaultEventLoader::alg, entry_name, Mantid::API::Algorithm::getLogger(), m_have_weight, m_loader, m_loadError, m_loadSize, m_loadStart, recalculateDataSize(), and Mantid::Kernel::Logger::warning().

Referenced by run().

◆ loadPulseTimes()

void Mantid::DataHandling::LoadBankFromDiskTask::loadPulseTimes ( ::NeXus::File &  file)
private

◆ loadTof()

std::unique_ptr< std::vector< float > > Mantid::DataHandling::LoadBankFromDiskTask::loadTof ( ::NeXus::File &  file)
private

Open and load the times-of-flight data.

Parameters
fileAn NeXus::File object opened at the correct group
Returns
A new array containing the time of flights for this bank

Definition at line 220 of file LoadBankFromDiskTask.cpp.

References Mantid::DataHandling::DefaultEventLoader::alg, entry_name, Mantid::API::Algorithm::getLogger(), m_loader, m_loadError, m_loadSize, m_loadStart, m_oldNexusFileNames, recalculateDataSize(), Mantid::Kernel::Units::timeConversionVector(), and Mantid::Kernel::Logger::warning().

Referenced by run().

◆ prepareEventId()

void Mantid::DataHandling::LoadBankFromDiskTask::prepareEventId ( ::NeXus::File &  file,
int64_t &  start_event,
int64_t &  stop_event,
const std::vector< uint64_t > &  event_index 
)
private

Open the event_id field and validate the contents.

Parameters
file:: File handle for the NeXus file
start_event:: set to the index of the first event
stop_event:: set to the index of the last event + 1
event_index:: (a list of size of # of pulses giving the index in the event list for that pulse)

Definition at line 123 of file LoadBankFromDiskTask.cpp.

References Mantid::DataHandling::DefaultEventLoader::alg, Mantid::DataHandling::DefaultEventLoader::chunk, Mantid::Kernel::Logger::debug(), Mantid::EMPTY_INT(), entry_name, Mantid::DataHandling::DefaultEventLoader::eventsPerChunk, Mantid::DataHandling::DefaultEventLoader::firstChunkForBank, Mantid::API::Algorithm::getLogger(), m_loader, m_oldNexusFileNames, and recalculateDataSize().

Referenced by run().

◆ recalculateDataSize()

int64_t Mantid::DataHandling::LoadBankFromDiskTask::recalculateDataSize ( const int64_t &  size)
private

Interpret the value describing the number of events.

If the number is positive return it unchanged. If the value is negative (can happen at ISIS) add 2^32 to it.

Parameters
size:: The size of events value.

Definition at line 457 of file LoadBankFromDiskTask.cpp.

Referenced by loadEventId(), loadEventWeights(), loadTof(), and prepareEventId().

◆ run()

void Mantid::DataHandling::LoadBankFromDiskTask::run ( )
overridevirtual

Member Data Documentation

◆ entry_name

std::string Mantid::DataHandling::LoadBankFromDiskTask::entry_name
private

NXS path to bank.

Definition at line 52 of file LoadBankFromDiskTask.h.

Referenced by loadEventId(), loadEventIndex(), loadEventWeights(), loadTof(), prepareEventId(), and run().

◆ entry_type

std::string Mantid::DataHandling::LoadBankFromDiskTask::entry_type
private

NXS type.

Definition at line 54 of file LoadBankFromDiskTask.h.

Referenced by run().

◆ m_framePeriodNumbers

const std::vector<int> Mantid::DataHandling::LoadBankFromDiskTask::m_framePeriodNumbers
private

Frame period numbers.

Definition at line 76 of file LoadBankFromDiskTask.h.

Referenced by loadPulseTimes().

◆ m_have_weight

bool Mantid::DataHandling::LoadBankFromDiskTask::m_have_weight
private

Flag for simulated data.

Definition at line 74 of file LoadBankFromDiskTask.h.

Referenced by loadEventWeights(), and run().

◆ m_loader

DefaultEventLoader& Mantid::DataHandling::LoadBankFromDiskTask::m_loader
private

Algorithm being run.

Definition at line 50 of file LoadBankFromDiskTask.h.

Referenced by loadEventId(), loadEventIndex(), loadEventWeights(), loadPulseTimes(), loadTof(), prepareEventId(), and run().

◆ m_loadError

bool Mantid::DataHandling::LoadBankFromDiskTask::m_loadError
private

Did we get an error in loading.

Definition at line 62 of file LoadBankFromDiskTask.h.

Referenced by loadEventId(), loadEventIndex(), loadEventWeights(), loadTof(), and run().

◆ m_loadSize

std::vector<int64_t> Mantid::DataHandling::LoadBankFromDiskTask::m_loadSize
private

How much to load in the file.

Definition at line 68 of file LoadBankFromDiskTask.h.

Referenced by loadEventId(), loadEventWeights(), loadTof(), and run().

◆ m_loadStart

std::vector<int64_t> Mantid::DataHandling::LoadBankFromDiskTask::m_loadStart
private

Index to load start at in the file.

Definition at line 66 of file LoadBankFromDiskTask.h.

Referenced by loadEventId(), loadEventWeights(), loadTof(), and run().

◆ m_max_id

uint32_t Mantid::DataHandling::LoadBankFromDiskTask::m_max_id
private

Maximum pixel ID in this data.

Definition at line 72 of file LoadBankFromDiskTask.h.

Referenced by LoadBankFromDiskTask(), loadEventId(), and run().

◆ m_min_id

uint32_t Mantid::DataHandling::LoadBankFromDiskTask::m_min_id
private

Minimum pixel ID in this data.

Definition at line 70 of file LoadBankFromDiskTask.h.

Referenced by LoadBankFromDiskTask(), loadEventId(), and run().

◆ m_oldNexusFileNames

bool Mantid::DataHandling::LoadBankFromDiskTask::m_oldNexusFileNames
private

Old names in the file?

Definition at line 64 of file LoadBankFromDiskTask.h.

Referenced by loadTof(), and prepareEventId().

◆ prog

API::Progress* Mantid::DataHandling::LoadBankFromDiskTask::prog
private

Progress reporting.

Definition at line 56 of file LoadBankFromDiskTask.h.

Referenced by run().

◆ scheduler

Kernel::ThreadScheduler& Mantid::DataHandling::LoadBankFromDiskTask::scheduler
private

ThreadScheduler running this task.

Definition at line 58 of file LoadBankFromDiskTask.h.

Referenced by run().

◆ thisBankPulseTimes

std::shared_ptr<BankPulseTimes> Mantid::DataHandling::LoadBankFromDiskTask::thisBankPulseTimes
private

Object with the pulse times for this bank.

Definition at line 60 of file LoadBankFromDiskTask.h.

Referenced by loadPulseTimes(), and run().


The documentation for this class was generated from the following files: