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
impl TofHit
pub fn new() -> Self
pub fn set_paddle(&mut self, paddle: &Paddle)
Sourcepub fn get_pid(paddle_end_id: u16) -> u8
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?
pub fn add_peak(&mut self, peak: &Peak)
Sourcepub fn get_pos(&self) -> f32
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
Sourcepub fn get_t0(&self) -> f32
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
pub fn get_time_a(&self) -> f32
pub fn set_time_a(&mut self, t: f32)
pub fn get_time_b(&self) -> f32
pub fn set_time_b(&mut self, t: f32)
pub fn get_peak_a(&self) -> f32
pub fn set_peak_a(&mut self, p: f32)
pub fn get_peak_b(&self) -> f32
pub fn set_peak_b(&mut self, p: f32)
pub fn get_charge_a(&self) -> f32
pub fn set_charge_a(&mut self, c: f32)
pub fn get_charge_b(&self) -> f32
pub fn set_charge_b(&mut self, c: f32)
pub fn get_bl_a(&self) -> f32
pub fn get_bl_b(&self) -> f32
pub fn get_bl_a_rms(&self) -> f32
pub fn get_bl_b_rms(&self) -> f32
pub fn from_random() -> TofHit
Trait Implementations§
Source§impl Serialization for TofHit
impl Serialization for TofHit
Source§fn to_bytestream(&self) -> Vec<u8>
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>
fn from_bytestream( stream: &Vec<u8>, pos: &mut usize, ) -> Result<Self, SerializationError>
const HEAD: u16 = 61_680u16
const TAIL: u16 = 3_855u16
Source§const SIZE: usize = 30usize
const SIZE: usize = 30usize
Source§fn verify_fixed(
stream: &Vec<u8>,
pos: &mut usize,
) -> Result<(), SerializationError>
fn verify_fixed( stream: &Vec<u8>, pos: &mut usize, ) -> Result<(), SerializationError>
Source§fn from_tofpacket(packet: &TofPacket) -> Result<Self, SerializationError>where
Self: Sized,
fn from_tofpacket(packet: &TofPacket) -> Result<Self, SerializationError>where
Self: Sized,
fn from_slice(
_slice: &[u8],
_start_pos: usize,
) -> Result<Self, SerializationError>where
Self: Sized,
impl Copy for TofHit
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> 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self
to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self
to an expression for Diesel’s query builder. Read more