|
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. | |
| void | run () override |
| Main method that performs the work for the task. | |
Public Member Functions inherited from Mantid::Kernel::Task | |
| virtual double | cost () |
| What is the computational cost of this task? | |
| std::shared_ptr< std::mutex > | getMutex () |
| Get the mutex object for this Task. | |
| void | setMutex (const std::shared_ptr< std::mutex > &mutex) |
| Set the mutex object for this Task. | |
| void | setMutexObject (void *object) |
| Use an arbitrary pointer to lock (mutex) the execution of this task. | |
| Task () | |
| Default constructor. | |
| Task (double cost) | |
| Constructor with cost. | |
| virtual | ~Task ()=default |
| Destructor. | |
Private Member Functions | |
| std::unique_ptr< std::vector< uint32_t > > | loadEventId (Nexus::File &file) |
| Load the event_id field, which has been opened. | |
| std::unique_ptr< 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) | |
| std::unique_ptr< std::vector< float > > | loadEventWeights (Nexus::File &file) |
| Load weight of weigthed events if they exist. | |
| void | loadPulseTimes (Nexus::File &file) |
| Load the pulse times, if needed. | |
| std::unique_ptr< std::vector< float > > | loadTof (Nexus::File &file) |
| Open and load the times-of-flight data. | |
| void | prepareEventId (Nexus::File &file, uint64_t &start_event, uint64_t &stop_event, const uint64_t &start_event_index) |
| Open the event_id field and validate the contents. | |
| uint64_t | recalculateDataSize (const int64_t size) |
| Interpret the value describing the number of events. | |
Private Attributes | |
| std::string | entry_name |
| NXS address to bank. | |
| std::string | entry_type |
| NXS type. | |
| std::string | m_detIdFieldName |
| const std::vector< int > | m_framePeriodNumbers |
| Frame period numbers. | |
| bool | m_have_weight |
| Flag for simulated data. | |
| DefaultEventLoader & | m_loader |
| Algorithm being run. | |
| bool | m_loadError |
| Did we get an error in loading. | |
| Nexus::DimVector | m_loadSize |
| How much to load in the file. | |
| Nexus::DimVector | m_loadStart |
| Index to load start at in the file. | |
| uint32_t | m_max_id |
| Maximum pixel ID in this data. | |
| uint32_t | m_min_id |
| Minimum pixel ID in this data. | |
| std::string | m_timeOfFlightFieldName |
| API::Progress * | prog |
| Progress reporting. | |
| Kernel::ThreadScheduler & | scheduler |
| ThreadScheduler running this task. | |
| std::shared_ptr< BankPulseTimes > | thisBankPulseTimes |
| Object with the pulse times for this bank. | |
Additional Inherited Members | |
Protected Attributes inherited from Mantid::Kernel::Task | |
| double | m_cost |
| Cached computational cost for the thread. | |
| std::shared_ptr< std::mutex > | m_mutex |
| Mutex associated with this task (can be NULL) | |
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 address 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 43 of file LoadBankFromDiskTask.cpp.
References Mantid::Kernel::Task::m_cost, m_detIdFieldName, m_max_id, m_min_id, m_timeOfFlightFieldName, 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 168 of file LoadBankFromDiskTask.cpp.
References Mantid::DataHandling::DefaultEventLoader::alg, Mantid::Nexus::Info::dims, entry_name, Mantid::DataHandling::DefaultEventLoader::eventid_max, Mantid::API::Algorithm::getLogger(), m_detIdFieldName, 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 107 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 267 of file LoadBankFromDiskTask.cpp.
References Mantid::DataHandling::DefaultEventLoader::alg, entry_name, NXnumtype::FLOAT32, 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 64 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 222 of file LoadBankFromDiskTask.cpp.
References Mantid::DataHandling::DefaultEventLoader::alg, Mantid::Nexus::Info::dims, entry_name, Mantid::API::Algorithm::getLogger(), m_loader, m_loadError, m_loadSize, m_loadStart, m_timeOfFlightFieldName, 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 |
| start_event_index | :: (a list of size of # of pulses giving the index in the event list for that pulse) |
Definition at line 135 of file LoadBankFromDiskTask.cpp.
References Mantid::DataHandling::DefaultEventLoader::alg, Mantid::DataHandling::DefaultEventLoader::chunk, Mantid::Kernel::Logger::debug(), Mantid::Nexus::Info::dims, Mantid::EMPTY_INT(), entry_name, Mantid::DataHandling::DefaultEventLoader::eventsPerChunk, Mantid::DataHandling::DefaultEventLoader::firstChunkForBank, Mantid::API::Algorithm::getLogger(), m_detIdFieldName, m_loader, 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 545 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 305 of file LoadBankFromDiskTask.cpp.
References Mantid::DataHandling::DefaultEventLoader::alg, Mantid::DataHandling::LoadEventNexus::compressEvents, Mantid::DataHandling::LoadEventNexus::compressTolerance, Mantid::Kernel::VectorHelper::createAxisFromRebinParams(), Mantid::Kernel::Logger::debug(), Mantid::Kernel::delta, Mantid::EMPTY_DBL(), Mantid::EMPTY_INT(), entry_name, entry_type, Mantid::Kernel::Logger::error(), Mantid::DataHandling::LoadEventNexus::filter_bad_pulses, Mantid::DataHandling::LoadEventNexus::filter_tof_max, Mantid::DataHandling::LoadEventNexus::filter_tof_min, Mantid::DataHandling::LoadEventNexus::filter_tof_range, Mantid::API::Algorithm::getCancel(), Mantid::API::Algorithm::getLogger(), Mantid::Kernel::Logger::isDebug(), loadEventId(), loadEventIndex(), loadEventWeights(), loadPulseTimes(), loadTof(), Mantid::DataHandling::LoadEventNexus::longest_tof, Mantid::DataHandling::LoadEventNexus::m_filename, m_have_weight, Mantid::DataHandling::DefaultEventLoader::m_haveWeights, Mantid::DataHandling::LoadEventNexus::m_is_time_filtered, 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_tofMutex, Mantid::DataHandling::LoadEventNexus::m_top_entry_name, Mantid::DataHandling::DefaultEventLoader::m_ws, Mantid::DataHandling::EventWorkspaceCollection::nPeriods(), Mantid::DataHandling::numEvents(), Mantid::Kernel::parallel_minmax(), prepareEventId(), prog, Mantid::Kernel::ThreadScheduler::push(), Mantid::Kernel::ProgressBase::report(), Mantid::Kernel::Timer::reset(), scheduler, Mantid::DataHandling::LoadEventNexus::shortest_tof, Mantid::DataHandling::DefaultEventLoader::splitProcessing, thisBankPulseTimes, and Mantid::Kernel::Logger::warning().
|
private |
NXS address to bank.
Definition at line 52 of file LoadBankFromDiskTask.h.
Referenced by loadEventId(), loadEventIndex(), loadEventWeights(), loadTof(), prepareEventId(), and run().
|
private |
|
private |
Definition at line 64 of file LoadBankFromDiskTask.h.
Referenced by LoadBankFromDiskTask(), loadEventId(), and prepareEventId().
|
private |
Frame period numbers.
Definition at line 77 of file LoadBankFromDiskTask.h.
Referenced by loadPulseTimes().
|
private |
Flag for simulated data.
Definition at line 75 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 69 of file LoadBankFromDiskTask.h.
Referenced by loadEventId(), loadEventWeights(), loadTof(), and run().
|
private |
Index to load start at in the file.
Definition at line 67 of file LoadBankFromDiskTask.h.
Referenced by loadEventId(), loadEventWeights(), loadTof(), and run().
|
private |
Maximum pixel ID in this data.
Definition at line 73 of file LoadBankFromDiskTask.h.
Referenced by LoadBankFromDiskTask(), loadEventId(), and run().
|
private |
Minimum pixel ID in this data.
Definition at line 71 of file LoadBankFromDiskTask.h.
Referenced by LoadBankFromDiskTask(), loadEventId(), and run().
|
private |
Definition at line 65 of file LoadBankFromDiskTask.h.
Referenced by LoadBankFromDiskTask(), and loadTof().
|
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().