Skip to main content

Tpx3FileReader

Struct Tpx3FileReader 

Source
pub struct Tpx3FileReader { /* private fields */ }
Expand description

A TPX3 file reader with memory-mapped I/O.

Implementations§

Source§

impl Tpx3FileReader

Source

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.

Source

pub fn with_config(self, config: DetectorConfig) -> Self

Sets the detector configuration.

Source

pub fn file_size(&self) -> usize

Returns the file size in bytes.

Source

pub fn packet_count(&self) -> usize

Returns the number of 8-byte packets in the file.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.