pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
pflib::packing::TriggerLinkFrame Struct Reference

Without a trigger link set up, the decoding cannot be fuctionally tested. More...

#include <TriggerLinkFrame.h>

Collaboration diagram for pflib::packing::TriggerLinkFrame:
[legend]

Public Member Functions

uint8_t compressed_sum (int i_sum, int i_bx=0) const
 Get a specific compressed trigger sum from the data words.
 
uint32_t linearized_sum (int i_sum, int i_bx=0) const
 Get a specific linearized trigger sum from the data words.
 
void from (std::span< uint32_t > data)
 Parse into this link frame from a std::span over 32-bit words.
 
 TriggerLinkFrame (std::span< uint32_t > data)
 Construct from a std::span over 32-bit words.
 
 TriggerLinkFrame ()=default
 default constructor which does nothing
 

Static Public Member Functions

static uint32_t compressed_to_linearized (uint8_t cs)
 Convert a compressed trigger sum into its linearized equivalent.
 

Public Attributes

int i_link
 trigger link identification number
 
std::array< uint32_t, 4 > data_words
 Trigger words including one pre-sample and 2 following samples.
 
std::array< bool, 5 > corruption
 Checks on data format.
 
logging::logger the_log_ {logging::get("decoding")}
 handle to logging for decoding warnings
 

Static Public Attributes

static const int i_soi_ = 1
 index of data words containg sample of interest
 

Detailed Description

Without a trigger link set up, the decoding cannot be fuctionally tested.

This class is merely a skeleton of how unpacking could be done for these trigger link frames.

Constructor & Destructor Documentation

◆ TriggerLinkFrame()

pflib::packing::TriggerLinkFrame::TriggerLinkFrame ( std::span< uint32_t > data)

Construct from a std::span over 32-bit words.

Note
A std::span can be transparently constructed from a std::vector if that is what is available, but it can also be used to simply view a subslice of a larger std::vector.

Member Function Documentation

◆ compressed_sum()

uint8_t pflib::packing::TriggerLinkFrame::compressed_sum ( int i_sum,
int i_bx = 0 ) const

Get a specific compressed trigger sum from the data words.

Parameters
[in]i_sumsum index 0, 1, 2, or 3
[in]i_bxbunch index relative to i_soi_ -1, 0, 1, or 2
Returns
compressed trigger sum as determined by the chip

◆ compressed_to_linearized()

uint32_t pflib::packing::TriggerLinkFrame::compressed_to_linearized ( uint8_t cs)
static

Convert a compressed trigger sum into its linearized equivalent.

The chip lossy compresses its trigger sums into seven bits and this function decompresses the sum into our best estimate of what the on-chip trigger sum was.

Note
This function undoes the wacky compression algorithm, but the scale of the linearized sum is not quite correct. If SelTC4 = 1 on the chip (sums of 4 channels), then this result needs to be multiplied by 2 (or left-bit-shift by one). If SelTC4 = 0 on the chip (sums of 9 channels), then this result needs to be multiplied by 8 (or left-bit-shift by three)

If SelTC4 stores the setting on the chip when the data was collected and lin_val is the value returned by this function, then

lin_val << (SelTC4 ? 1 : 3)

is the integer value pertaining to the correct scale of the sums as determined on the chip.

Parameters
[in]cscompressed sum to unpack
Returns
unpacked linearized sum

◆ linearized_sum()

uint32_t pflib::packing::TriggerLinkFrame::linearized_sum ( int i_sum,
int i_bx = 0 ) const

Get a specific linearized trigger sum from the data words.

See also
compressed_sum for how accessing a specific sum within a trigger word is implemented.
compressed_to_linearized for how this compressed seven-bit sum is unpacked into the linearized form.
Parameters
[in]i_sumsum index 0, 1, 2, or 3
[in]i_bxbunch index relative to i_soi_ -1, 0, 1, or 2
Returns
linearized trigger sum as determined by the chip

Member Data Documentation

◆ corruption

std::array<bool, 5> pflib::packing::TriggerLinkFrame::corruption

Checks on data format.

Index Description
0 leading four-bits of sw header is wrong
1 leading four-bits of 0'th data word is wrong
2 leading four-bits of 1st data word is wrong
3 leading four-bits of 2nd data word is wrong
4 leading four-bits of 3rd data word is wrong

◆ data_words

std::array<uint32_t, 4> pflib::packing::TriggerLinkFrame::data_words

Trigger words including one pre-sample and 2 following samples.

A trigger word contains 4 7-bit trigger sums and a 4-bit leading header to help check for corruption and link alignment.


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