tof_dataclasses::events::tof_hit

Struct TofHit

Source
pub struct TofHit {
Show 27 fields pub paddle_id: u8, pub time_a: f16, pub time_b: f16, pub peak_a: f16, pub peak_b: f16, pub charge_a: f16, pub charge_b: f16, pub paddle_len: f32, pub cable_len: f32, pub timestamp32: u32, pub timestamp16: u16, pub ctr_etx: u8, pub charge_min_i: u16, pub pos_across: u16, pub t0: u16, pub reserved: u8, pub version: ProtocolVersion, pub baseline_a: f16, pub baseline_a_rms: f16, pub baseline_b: f16, pub baseline_b_rms: f16, pub phase: f16, pub valid: bool, pub ftime_a: f32, pub ftime_b: f32, pub fpeak_a: f32, pub fpeak_b: f32,
}
Expand description

Comprehensive paddle information

Results of the (online) waveform analysis

A and B are the different ends of the paddle

Fields§

§paddle_id: u8

The ID of the paddle in TOF notation (1-160)

§time_a: f16§time_b: f16§peak_a: f16§peak_b: f16§charge_a: f16§charge_b: f16§paddle_len: f32

The paddle length will not get serialized and has to be set after the hit has been created

§cable_len: f32

The Harting cable length to the RB will not get serialized and has to be set after the hit has been created

§timestamp32: u32§timestamp16: u16§ctr_etx: u8§charge_min_i: u16§pos_across: u16

Reconstructed particle interaction position across the paddle

§t0: u16

Reconstructed particle interaction time

§reserved: u8§version: ProtocolVersion§baseline_a: f16§baseline_a_rms: f16§baseline_b: f16§baseline_b_rms: f16§phase: f16§valid: bool§ftime_a: f32§ftime_b: f32§fpeak_a: f32§fpeak_b: f32

Implementations§

Source§

impl TofHit

Source

pub fn new() -> Self

Source

pub fn set_paddle(&mut self, paddle: &Paddle)

Source

pub fn get_pid(paddle_end_id: u16) -> u8

Get the (official) paddle id

Convert the paddle end id following the convention

A-side : paddle id + 1000 B-side : paddle id + 2000

FIXME - maybe return Result?

Source

pub fn add_peak(&mut self, peak: &Peak)

Source

pub fn get_pos(&self) -> f32

Calculate the position across the paddle from the two times at the paddle ends

This will be measured from the A side

Source

pub fn get_t0(&self) -> f32

Calculate the interaction time based on the peak timings measured at the paddle ends A and B

That this works, the length of the paddle has to be set before (in mm). This assumes that the cable on both sides of the paddle are the same length

Source

pub fn get_edep(&self) -> f32

Philip’s energy deposition based on peak height

Source

pub fn get_time_a(&self) -> f32

Source

pub fn set_time_a(&mut self, t: f32)

Source

pub fn get_time_b(&self) -> f32

Source

pub fn set_time_b(&mut self, t: f32)

Source

pub fn get_peak_a(&self) -> f32

Source

pub fn set_peak_a(&mut self, p: f32)

Source

pub fn get_peak_b(&self) -> f32

Source

pub fn set_peak_b(&mut self, p: f32)

Source

pub fn get_charge_a(&self) -> f32

Source

pub fn set_charge_a(&mut self, c: f32)

Source

pub fn get_charge_b(&self) -> f32

Source

pub fn set_charge_b(&mut self, c: f32)

Source

pub fn get_bl_a(&self) -> f32

Source

pub fn get_bl_b(&self) -> f32

Source

pub fn get_bl_a_rms(&self) -> f32

Source

pub fn get_bl_b_rms(&self) -> f32

Source

pub fn from_random() -> TofHit

Trait Implementations§

Source§

impl Clone for TofHit

Source§

fn clone(&self) -> TofHit

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TofHit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TofHit

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for TofHit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TofHit

Source§

fn eq(&self, other: &TofHit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialization for TofHit

Source§

fn to_bytestream(&self) -> Vec<u8>

Serialize the packet

Not all fields will get serialized, only the relevant data for the flight computer **A note about protocol versions ** When we serialize (to_bytestream) we will always write the latest version. Deserialization can also read previous versions

Source§

fn from_bytestream( stream: &Vec<u8>, pos: &mut usize, ) -> Result<Self, SerializationError>

Deserialization

§Arguments:
  • bytestream :
Source§

const HEAD: u16 = 61_680u16

Source§

const TAIL: u16 = 3_855u16

Source§

const SIZE: usize = 30usize

The SIZE is the size of the serialized bytestream INCLUDING 4 bytes for head and tail bytes. In case the struct does NOT HAVE a fixed size, SIZE will be 0 (so default value of the trait
Source§

fn verify_fixed( stream: &Vec<u8>, pos: &mut usize, ) -> Result<(), SerializationError>

Verify that the serialized representation of the struct has the correct size, including header + footer. Read more
Source§

fn from_tofpacket(packet: &TofPacket) -> Result<Self, SerializationError>
where Self: Sized,

Decode a serializable directly from a TofPacket
Source§

fn from_slice( _slice: &[u8], _start_pos: usize, ) -> Result<Self, SerializationError>
where Self: Sized,

Source§

fn to_slice(&self) -> &[u8]
where Self: Sized,

Construct byte slice out of self. Read more
Source§

impl Copy for TofHit

Source§

impl StructuralPartialEq for TofHit

Auto Trait Implementations§

§

impl Freeze for TofHit

§

impl RefUnwindSafe for TofHit

§

impl Send for TofHit

§

impl Sync for TofHit

§

impl Unpin for TofHit

§

impl UnwindSafe for TofHit

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V