pub struct Tpx3FileReader { /* private fields */ }Expand description
A TPX3 file reader with memory-mapped I/O.
Implementations§
Source§impl Tpx3FileReader
impl Tpx3FileReader
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Opens a TPX3 file for reading with default configuration.
§Errors
Returns an error if the file cannot be opened or memory-mapped.
Sourcepub fn with_config(self, config: DetectorConfig) -> Self
pub fn with_config(self, config: DetectorConfig) -> Self
Sets the detector configuration.
Sourcepub fn packet_count(&self) -> usize
pub fn packet_count(&self) -> usize
Returns the number of 8-byte packets in the file.
Sourcepub fn read_batch(&self) -> Result<HitBatch>
pub fn read_batch(&self) -> Result<HitBatch>
Reads and parses all hits from the file into a HitBatch (SoA).
This uses the pulse-based time-ordered stream to ensure correct temporal ordering across pulses and chips.
§Errors
Returns an error if the file size is invalid or the data cannot be parsed.
Sourcepub fn read_batch_time_ordered(&self) -> Result<HitBatch>
pub fn read_batch_time_ordered(&self) -> Result<HitBatch>
Reads hits using the efficient time-ordered stream.
This uses a pulse-based K-way merge to produce time-ordered hits without loading the entire file or performing a global sort.
This is functionally equivalent to read_batch() and is retained
for clarity.
§Errors
Returns an error if the file size is invalid.
Sourcepub fn stream_time_ordered(&self) -> Result<TimeOrderedHitStream>
pub fn stream_time_ordered(&self) -> Result<TimeOrderedHitStream>
Returns a time-ordered stream of hit batches (pulse-merged).
§Errors
Returns an error if the file size is invalid.
Sourcepub fn stream_time_ordered_events(&self) -> Result<TimeOrderedEventStream>
pub fn stream_time_ordered_events(&self) -> Result<TimeOrderedEventStream>
Returns a time-ordered stream of event batches (pulse-merged with TDC).
§Errors
Returns an error if the file size is invalid.
Sourcepub fn iter_packets(&self) -> impl Iterator<Item = Tpx3Packet> + '_
pub fn iter_packets(&self) -> impl Iterator<Item = Tpx3Packet> + '_
Returns an iterator over raw packets.
§Panics
Panics if a chunk is not exactly 8 bytes. This should be unreachable because
chunks_exact(8) guarantees each chunk length.
Auto Trait Implementations§
impl Freeze for Tpx3FileReader
impl RefUnwindSafe for Tpx3FileReader
impl Send for Tpx3FileReader
impl Sync for Tpx3FileReader
impl Unpin for Tpx3FileReader
impl UnwindSafe for Tpx3FileReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more