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

PulseIndexer contains information for mapping from pulse index/number to event index. More...

#include <PulseIndexer.h>

Classes

struct  Iterator
 
struct  IteratorValue
 

Public Member Functions

Iterator begin () const
 
const Iterator cbegin () const
 
const Iterator cend () const
 
Iterator end () const
 
std::pair< size_t, size_t > getEventIndexRange (const size_t pulseIndex) const
 The range of event(tof,detid) indices to read for this pulse.
 
size_t getFirstPulseIndex () const
 Which element in the event_index array is the first one to use.
 
size_t getLastPulseIndex () const
 Which element in the event_index array is the last one to use.
 
size_t getStartEventIndex (const size_t pulseIndex) const
 The first event(tof,detid) index to read for this pulse.
 
size_t getStopEventIndex (const size_t pulseIndex) const
 The one past the last event(tof,detid) index to read for this pulse.
 
 PulseIndexer (std::shared_ptr< std::vector< uint64_t > const > const &event_index, const std::size_t firstEventIndex, const std::size_t numEvents, const std::string &entry_name, const std::vector< size_t > &pulse_roi)
 

Private Member Functions

size_t determineFirstPulseIndex () const
 This performs a linear search because it is much more likely that the index to look for is at the beginning.
 
size_t determineLastPulseIndex () const
 This looks at the event_indexes and number of events to read then determines what is the maximum pulse to use.
 
bool includedPulse (const size_t pulseIndex) const
 returns true when the roi says the pulse should be used
 
 PulseIndexer ()
 

Private Attributes

const std::string m_entry_name
 Name of the NXentry to be used in exceptions.
 
const std::shared_ptr< std::vector< uint64_t > const > m_event_index
 vector of indices (length of # of pulses) into the event arrays
 
std::size_t m_firstEventIndex
 How far into the array of events the tof/detid are already.
 
std::size_t m_numEvents
 Total number of events tof/detid that should be processed.
 
std::size_t m_numPulses
 Total number of pulsetime/pulseindex.
 
std::vector< std::size_t > m_roi
 Alternating values describe ranges of [use, don't) of pulse index ranges.
 
bool m_roi_complex
 true when there is more to check than the pulse being between the ends
 

Detailed Description

PulseIndexer contains information for mapping from pulse index/number to event index.

The events come in two sets of parallel arrays:

In general, NUM_PULSE<NUM_EVENT, but this is not true for "dark count" measurements.

Once configured, this allows for the caller to start at the first index into the pulse information, then get the range of event [inclusive, exclusive) detid and tof to iterate through.

Definition at line 33 of file PulseIndexer.h.

Constructor & Destructor Documentation

◆ PulseIndexer() [1/2]

Mantid::DataHandling::PulseIndexer::PulseIndexer ( std::shared_ptr< std::vector< uint64_t > const > const &  event_index,
const std::size_t  firstEventIndex,
const std::size_t  numEvents,
const std::string &  entry_name,
const std::vector< size_t > &  pulse_roi 
)

◆ PulseIndexer() [2/2]

Mantid::DataHandling::PulseIndexer::PulseIndexer ( )
private

Member Function Documentation

◆ begin()

PulseIndexer::Iterator Mantid::DataHandling::PulseIndexer::begin ( ) const

Definition at line 238 of file PulseIndexer.cpp.

References getFirstPulseIndex().

◆ cbegin()

const PulseIndexer::Iterator Mantid::DataHandling::PulseIndexer::cbegin ( ) const

Definition at line 230 of file PulseIndexer.cpp.

References getFirstPulseIndex().

◆ cend()

const PulseIndexer::Iterator Mantid::DataHandling::PulseIndexer::cend ( ) const

Definition at line 234 of file PulseIndexer.cpp.

References getLastPulseIndex().

◆ determineFirstPulseIndex()

size_t Mantid::DataHandling::PulseIndexer::determineFirstPulseIndex ( ) const
private

This performs a linear search because it is much more likely that the index to look for is at the beginning.

Definition at line 82 of file PulseIndexer.cpp.

References m_event_index, and m_firstEventIndex.

Referenced by PulseIndexer().

◆ determineLastPulseIndex()

size_t Mantid::DataHandling::PulseIndexer::determineLastPulseIndex ( ) const
private

This looks at the event_indexes and number of events to read then determines what is the maximum pulse to use.

Definition at line 122 of file PulseIndexer.cpp.

References m_event_index, m_firstEventIndex, and m_numEvents.

Referenced by PulseIndexer().

◆ end()

PulseIndexer::Iterator Mantid::DataHandling::PulseIndexer::end ( ) const

Definition at line 240 of file PulseIndexer.cpp.

References getLastPulseIndex().

◆ getEventIndexRange()

std::pair< size_t, size_t > Mantid::DataHandling::PulseIndexer::getEventIndexRange ( const size_t  pulseIndex) const

The range of event(tof,detid) indices to read for this pulse.

Definition at line 146 of file PulseIndexer.cpp.

References getStartEventIndex(), getStopEventIndex(), m_entry_name, m_event_index, m_firstEventIndex, and m_numEvents.

Referenced by Mantid::DataHandling::PulseIndexer::Iterator::calculateEventRange(), and PulseIndexer().

◆ getFirstPulseIndex()

size_t Mantid::DataHandling::PulseIndexer::getFirstPulseIndex ( ) const

Which element in the event_index array is the first one to use.

Definition at line 143 of file PulseIndexer.cpp.

References m_roi.

Referenced by begin(), and cbegin().

◆ getLastPulseIndex()

size_t Mantid::DataHandling::PulseIndexer::getLastPulseIndex ( ) const

Which element in the event_index array is the last one to use.

Definition at line 144 of file PulseIndexer.cpp.

References m_roi.

Referenced by cend(), and end().

◆ getStartEventIndex()

size_t Mantid::DataHandling::PulseIndexer::getStartEventIndex ( const size_t  pulseIndex) const

The first event(tof,detid) index to read for this pulse.

When this is after the event indices to use, it returns the value of getStopEventIndex. This is only public for testing.

Definition at line 166 of file PulseIndexer.cpp.

References getStopEventIndex(), m_firstEventIndex, and m_roi.

Referenced by getEventIndexRange(), and getStopEventIndex().

◆ getStopEventIndex()

size_t Mantid::DataHandling::PulseIndexer::getStopEventIndex ( const size_t  pulseIndex) const

The one past the last event(tof,detid) index to read for this pulse.

When this is not a pulse index to use, it returns the value of getStartEventIndex. When the pulseIndex is past the end of the use regions, it returns the m_numEvents. This is only public for testing.

Definition at line 205 of file PulseIndexer.cpp.

References getStartEventIndex(), includedPulse(), m_event_index, m_firstEventIndex, m_numEvents, and m_roi.

Referenced by getEventIndexRange(), and getStartEventIndex().

◆ includedPulse()

bool Mantid::DataHandling::PulseIndexer::includedPulse ( const size_t  pulseIndex) const
private

returns true when the roi says the pulse should be used

Definition at line 187 of file PulseIndexer.cpp.

References m_roi, and m_roi_complex.

Referenced by getStopEventIndex().

Member Data Documentation

◆ m_entry_name

const std::string Mantid::DataHandling::PulseIndexer::m_entry_name
private

Name of the NXentry to be used in exceptions.

Definition at line 138 of file PulseIndexer.h.

Referenced by getEventIndexRange().

◆ m_event_index

const std::shared_ptr<std::vector<uint64_t> const> Mantid::DataHandling::PulseIndexer::m_event_index
private

vector of indices (length of # of pulses) into the event arrays

Definition at line 107 of file PulseIndexer.h.

Referenced by determineFirstPulseIndex(), determineLastPulseIndex(), getEventIndexRange(), getStopEventIndex(), and PulseIndexer().

◆ m_firstEventIndex

std::size_t Mantid::DataHandling::PulseIndexer::m_firstEventIndex
private

How far into the array of events the tof/detid are already.

This is used when data is read in chunks. It is generally taken from the zeroth element of the event_index array, but is also used for chunking by pulse-time.

Another way to think of this value is the offset into the tof/detid arrays from disk that are actually in memory. Because of this, all indices into the event arrays (tof/detid) have this value subtracted off.

Definition at line 117 of file PulseIndexer.h.

Referenced by determineFirstPulseIndex(), determineLastPulseIndex(), getEventIndexRange(), getStartEventIndex(), and getStopEventIndex().

◆ m_numEvents

std::size_t Mantid::DataHandling::PulseIndexer::m_numEvents
private

Total number of events tof/detid that should be processed.

This can be less than the total number of events in the actual array. This value plus the m_firstEventIndex should be <= the total events in the NXevent_data being processed.

Definition at line 124 of file PulseIndexer.h.

Referenced by determineLastPulseIndex(), getEventIndexRange(), getStopEventIndex(), and PulseIndexer().

◆ m_numPulses

std::size_t Mantid::DataHandling::PulseIndexer::m_numPulses
private

Total number of pulsetime/pulseindex.

Definition at line 135 of file PulseIndexer.h.

Referenced by PulseIndexer().

◆ m_roi

std::vector<std::size_t> Mantid::DataHandling::PulseIndexer::m_roi
private

Alternating values describe ranges of [use, don't) of pulse index ranges.

There will always be a gap between neighboring values.

Definition at line 130 of file PulseIndexer.h.

Referenced by getFirstPulseIndex(), getLastPulseIndex(), getStartEventIndex(), getStopEventIndex(), includedPulse(), and PulseIndexer().

◆ m_roi_complex

bool Mantid::DataHandling::PulseIndexer::m_roi_complex
private

true when there is more to check than the pulse being between the ends

Definition at line 132 of file PulseIndexer.h.

Referenced by includedPulse(), and PulseIndexer().


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