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

Decoding of entire "super packet" which holds multiple polarfire packets - one for each sample in an event. More...

#include <SuperPacket.h>

Public Member Functions

 SuperPacket (const uint32_t *header_ptr, int len)
 Wrap the input data array and search for the header. More...
 
int length64 () const
 Length of this packet in 64-bit words. More...
 
int length32 () const
 Length of this packet in 32-bit words. More...
 
int fpgaid () const
 Get polarfire fpga id for this super packet. More...
 
int nsamples () const
 Get the number of samples within this packet. More...
 
int formatversion () const
 Get the format version stored within this packet. More...
 
int event_tag_length () const
 Get the length of the event tag. More...
 
int spill () const
 Get the spill this packet was for. More...
 
int bxid () const
 Get the BX id this packet was for. More...
 
uint32_t time_in_spill () const
 Get the time in 5MHz counts since spill begun. More...
 
uint32_t eventid () const
 Get local event ID for this packet. More...
 
int runid () const
 Get run ID for this packet. More...
 
void run_start (int &month, int &day, int &hour, int &minute)
 Set the run start timestamp for this packet. More...
 
int length32_for_sample (int isample) const
 Get length of an individual sample in this packet. More...
 
PolarfirePacket sample (int isample) const
 Get a specific sample from this packet, wrapping with our decoding class. More...
 
int offset_to_header () const
 Get the offset between the input pointer to the constructor and the start of the packet. More...
 

Private Attributes

const uint32_t * data_
 pointer to beginning of packet
 
int length_
 length of packet
 
int version_
 format version of packet, deduced from header word
 
int offset_
 offset between input data array pointer and beginning of packet
 

Detailed Description

Decoding of entire "super packet" which holds multiple polarfire packets - one for each sample in an event.

This class handles replicating the behavior described in Appendix A and B in the HGCROC Data Formats manual.

Note
several header words (including the timestamp, local event number, local spill number, and run timestamp) were added and are not currently document in the manual linked above.

Constructor & Destructor Documentation

◆ SuperPacket()

pflib::decoding::SuperPacket::SuperPacket ( const uint32_t *  header_ptr,
int  len 
)

Wrap the input data array and search for the header.

The header word allows us to deduce the format version. Decrement the length and increment the header pointer until the header words is found so that it aligns with the index i in the Appendix tables.

Parameters
[in]header_ptrstart of data array
[in]lenlength of data array

Member Function Documentation

◆ bxid()

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

Get the BX id this packet was for.

Note
local to the polarfire
Returns
bxid, 0 if unavailable

◆ event_tag_length()

int pflib::decoding::SuperPacket::event_tag_length ( ) const

Get the length of the event tag.

Note
only availabe in v2 so we check
Returns
tag lenght, 0 if unavailable

◆ eventid()

uint32_t pflib::decoding::SuperPacket::eventid ( ) const

Get local event ID for this packet.

Returns
event id, 0 if unavailable

◆ formatversion()

int pflib::decoding::SuperPacket::formatversion ( ) const

Get the format version stored within this packet.

Returns
version, -1 if empty packet

◆ fpgaid()

int pflib::decoding::SuperPacket::fpgaid ( ) const

Get polarfire fpga id for this super packet.

Returns
id number, -1 if empty packet

◆ length32()

int pflib::decoding::SuperPacket::length32 ( ) const

Length of this packet in 32-bit words.

Returns
length, -1 if empty packet

◆ length32_for_sample()

int pflib::decoding::SuperPacket::length32_for_sample ( int  isample) const

Get length of an individual sample in this packet.

Parameters
[in]isamplesample index within this packet
Returns
length of that sample in 32-bit words, 0 if sample does not exist

◆ length64()

int pflib::decoding::SuperPacket::length64 ( ) const

Length of this packet in 64-bit words.

See also
length32 for decoding
Returns
length, 0 if empty packet

◆ nsamples()

int pflib::decoding::SuperPacket::nsamples ( ) const

Get the number of samples within this packet.

Returns
number of samples, -1 if empty packet

◆ offset_to_header()

int pflib::decoding::SuperPacket::offset_to_header ( ) const
inline

Get the offset between the input pointer to the constructor and the start of the packet.

Returns
offset

◆ run_start()

void pflib::decoding::SuperPacket::run_start ( int &  month,
int &  day,
int &  hour,
int &  minute 
)

Set the run start timestamp for this packet.

Parameters
[out]monthrun start month, unmodified if unavailable
[out]dayrun start day, unmodified if unavailable
[out]hourrun start hour, unmodified if unavailable
[out]minuterun start minute, unmodified if unavailable

◆ runid()

int pflib::decoding::SuperPacket::runid ( ) const

Get run ID for this packet.

Returns
run, 0 if unavailable

◆ sample()

PolarfirePacket pflib::decoding::SuperPacket::sample ( int  isample) const

Get a specific sample from this packet, wrapping with our decoding class.

Parameters
[in]isamplesample index within this packet
Returns
decoding polarfire packet for the input sample index, empty if not exists

◆ spill()

int pflib::decoding::SuperPacket::spill ( ) const

Get the spill this packet was for.

Note
local to the polarfire
Returns
spill number, 0 if unavailable

◆ time_in_spill()

uint32_t pflib::decoding::SuperPacket::time_in_spill ( ) const

Get the time in 5MHz counts since spill begun.

Returns
time, 0 if unavailable

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