pflib v2.7.0-1-gd371ab6a
Polarfire Interaction Library
pflib::decoding::LinkPacket Class Reference

smallest formatted packet being readout by the HGCROC-Polarfire pipeline More...

#include <LinkPacket.h>

Public Member Functions

 LinkPacket (const uint32_t *header_ptr, int len)
 Wrap the input C-style array as a LinkPacket.
 
int linkid () const
 Get the link ID for this link. More...
 
int crc () const
 Get the CRC checksum for this link. More...
 
int bxid () const
 Get the BX ID as reported by the HGC ROC reading out this link. More...
 
int wadd () const
 Get the WADD as reported by the HGC ROC reading out this link. More...
 
int length () const
 Get the length of this link packet. More...
 
bool good_bxheader () const
 Check if this link has a good BX header. More...
 
bool good_idle () const
 Check if this link has a good trailing idle. More...
 
bool has_chan (int ichan) const
 Check if a channel exists by attempting to comput its offset. More...
 
int get_tot (int ichan) const
 Get the decoded TOT value for the input channel. More...
 
int get_toa (int ichan) const
 Get the decoded TOA value for the input channel. More...
 
int get_adc (int ichan) const
 Get the decoded ADC value for the input channel. More...
 
void dump () const
 Print human-readable/decoded link packet to terminal.
 

Private Member Functions

int offset_to_chan (int ichan) const
 Calculate the offset to a specific channel index by referencing the readout map for this link packet. More...
 

Private Attributes

const uint32_t * data_
 handle to zero'th entry in data array we are wrapping
 
int length_
 length of data array we have wrapped
 

Detailed Description

smallest formatted packet being readout by the HGCROC-Polarfire pipeline

Note
Confusingly, these packets correspond to 'ROC Subpackets' in the HGCROC Data Formats manual. They are detailed in Table 4 of that document.

Essentially we do live interpretations of an array of encoded 32-bit ints that are being held somewhere else. For this reason, we are a light wrapper class and so we can we constructed/desctructed freely.

Member Function Documentation

◆ bxid()

int pflib::decoding::LinkPacket::bxid ( ) const

Get the BX ID as reported by the HGC ROC reading out this link.

Returns
bx ID, -1 if link packet is empty

◆ crc()

int pflib::decoding::LinkPacket::crc ( ) const

Get the CRC checksum for this link.

Returns
crc, -1 if link packet is empty

◆ get_adc()

int pflib::decoding::LinkPacket::get_adc ( int  ichan) const

Get the decoded ADC value for the input channel.

Parameters
[in]ichanin-link channel index
Returns
ADC value in that channel

◆ get_toa()

int pflib::decoding::LinkPacket::get_toa ( int  ichan) const

Get the decoded TOA value for the input channel.

Parameters
[in]ichanin-link channel index
Returns
TOA value in that channel

◆ get_tot()

int pflib::decoding::LinkPacket::get_tot ( int  ichan) const

Get the decoded TOT value for the input channel.

Parameters
[in]ichanin-link channel index
Returns
TOT value in that channel

◆ good_bxheader()

bool pflib::decoding::LinkPacket::good_bxheader ( ) const

Check if this link has a good BX header.

If the link packet is empty, it does not have good BX header.

Returns
true if BX header matches expected pattern if link is well aligned

◆ good_idle()

bool pflib::decoding::LinkPacket::good_idle ( ) const

Check if this link has a good trailing idle.

If the link packet is not of the correct, full length, it does not have a good idle.

Returns
true if idle matches expected pattern for if link is well aligned

◆ has_chan()

bool pflib::decoding::LinkPacket::has_chan ( int  ichan) const

Check if a channel exists by attempting to comput its offset.

Note
Uses in-link channel numbering i.e. from 0 to 35.
See also
offset_to_chan for how the channel offset is calculated
Returns
true if a channel is in this link packet

◆ length()

int pflib::decoding::LinkPacket::length ( ) const

Get the length of this link packet.

Returns
length of link packet defined at construction

◆ linkid()

int pflib::decoding::LinkPacket::linkid ( ) const

Get the link ID for this link.

Returns
link id, -1 if link packet is empty

◆ offset_to_chan()

int pflib::decoding::LinkPacket::offset_to_chan ( int  ichan) const
private

Calculate the offset to a specific channel index by referencing the readout map for this link packet.

Parameters
[in]ichanin-link channel index
Returns
offset, -1 if channel was not readout or is invalid

◆ wadd()

int pflib::decoding::LinkPacket::wadd ( ) const

Get the WADD as reported by the HGC ROC reading out this link.

Returns
wadd, -1 if link packet is empty

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