Mantid
|
This task does the disk IO from loading the NXS file, and so will be on a disk IO mutex. More...
#include <LoadBankFromDiskTask.h>
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... | |
DefaultEventLoader & | m_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::Progress * | prog |
Progress reporting. More... | |
Kernel::ThreadScheduler & | scheduler |
ThreadScheduler running this task. More... | |
std::shared_ptr< BankPulseTimes > | thisBankPulseTimes |
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... | |
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.
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.
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().
|
private |
Load the event_id field, which has been opened.
file | An NeXus::File object opened at the correct group |
Definition at line 160 of file LoadBankFromDiskTask.cpp.
References Mantid::DataHandling::DefaultEventLoader::alg, entry_name, Mantid::DataHandling::DefaultEventLoader::eventid_max, Mantid::API::Algorithm::getCancel(), Mantid::API::Algorithm::getLogger(), m_loader, m_loadError, m_loadSize, m_loadStart, m_max_id, m_min_id, Mantid::DataHandling::DefaultEventLoader::pixelID_to_wi_offset, recalculateDataSize(), and Mantid::Kernel::Logger::warning().
Referenced by run().
|
private |
Load the event_index field (a list of size of # of pulses giving the index in the event list for that pulse)
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().
|
private |
Load weight of weigthed events if they exist.
file | An NeXus::File object opened at the correct group |
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().
|
private |
Load the pulse times, if needed.
This sets thisBankPulseTimes to the right pointer.
Definition at line 53 of file LoadBankFromDiskTask.cpp.
References Mantid::DataHandling::DefaultEventLoader::alg, Mantid::API::Algorithm::getLogger(), Mantid::DataHandling::LoadEventNexus::m_allBanksPulseTimes, Mantid::DataHandling::DefaultEventLoader::m_bankPulseTimes, m_framePeriodNumbers, m_loader, thisBankPulseTimes, and Mantid::Kernel::Logger::warning().
Referenced by run().
|
private |
Open and load the times-of-flight data.
file | An NeXus::File object opened at the correct group |
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().
|
private |
Open the event_id field and validate the contents.
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().
|
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.
size | :: The size of events value. |
Definition at line 457 of file LoadBankFromDiskTask.cpp.
Referenced by loadEventId(), loadEventWeights(), loadTof(), and prepareEventId().
|
overridevirtual |
Main method that performs the work for the task.
Implements Mantid::Kernel::Task.
Definition at line 301 of file LoadBankFromDiskTask.cpp.
References Mantid::DataHandling::DefaultEventLoader::alg, Mantid::EMPTY_INT(), entry_name, entry_type, Mantid::Kernel::Logger::error(), Mantid::API::Algorithm::getCancel(), Mantid::API::Algorithm::getLogger(), loadEventId(), loadEventIndex(), loadEventWeights(), loadPulseTimes(), loadTof(), Mantid::DataHandling::LoadEventNexus::m_filename, m_have_weight, Mantid::DataHandling::DefaultEventLoader::m_haveWeights, m_loader, m_loadError, m_loadSize, m_loadStart, m_max_id, m_min_id, Mantid::DataHandling::LoadEventNexus::m_specMax, Mantid::DataHandling::LoadEventNexus::m_specMin, Mantid::DataHandling::LoadEventNexus::m_top_entry_name, Mantid::DataHandling::numEvents(), prepareEventId(), prog, Mantid::Kernel::ThreadScheduler::push(), Mantid::Kernel::ProgressBase::report(), scheduler, Mantid::DataHandling::DefaultEventLoader::splitProcessing, thisBankPulseTimes, and Mantid::Kernel::Logger::warning().
|
private |
NXS path to bank.
Definition at line 52 of file LoadBankFromDiskTask.h.
Referenced by loadEventId(), loadEventIndex(), loadEventWeights(), loadTof(), prepareEventId(), and run().
|
private |
|
private |
Frame period numbers.
Definition at line 76 of file LoadBankFromDiskTask.h.
Referenced by loadPulseTimes().
|
private |
Flag for simulated data.
Definition at line 74 of file LoadBankFromDiskTask.h.
Referenced by loadEventWeights(), and run().
|
private |
Algorithm being run.
Definition at line 50 of file LoadBankFromDiskTask.h.
Referenced by loadEventId(), loadEventIndex(), loadEventWeights(), loadPulseTimes(), loadTof(), prepareEventId(), and run().
|
private |
Did we get an error in loading.
Definition at line 62 of file LoadBankFromDiskTask.h.
Referenced by loadEventId(), loadEventIndex(), loadEventWeights(), loadTof(), and run().
|
private |
How much to load in the file.
Definition at line 68 of file LoadBankFromDiskTask.h.
Referenced by loadEventId(), loadEventWeights(), loadTof(), and run().
|
private |
Index to load start at in the file.
Definition at line 66 of file LoadBankFromDiskTask.h.
Referenced by loadEventId(), loadEventWeights(), loadTof(), and run().
|
private |
Maximum pixel ID in this data.
Definition at line 72 of file LoadBankFromDiskTask.h.
Referenced by LoadBankFromDiskTask(), loadEventId(), and run().
|
private |
Minimum pixel ID in this data.
Definition at line 70 of file LoadBankFromDiskTask.h.
Referenced by LoadBankFromDiskTask(), loadEventId(), and run().
|
private |
Old names in the file?
Definition at line 64 of file LoadBankFromDiskTask.h.
Referenced by loadTof(), and prepareEventId().
|
private |
|
private |
ThreadScheduler running this task.
Definition at line 58 of file LoadBankFromDiskTask.h.
Referenced by run().
|
private |
Object with the pulse times for this bank.
Definition at line 60 of file LoadBankFromDiskTask.h.
Referenced by loadPulseTimes(), and run().