artdaq_core_demo  v1_07_01
demo::ToyFragment Class Reference

An artdaq::Fragment overlay class used for pedagogical purposes. More...

#include <artdaq-core-demo/Overlays/ToyFragment.hh>

Classes

struct  Header
 The "Header" struct is used to interpret the header information that is created by the hardware and is part of the data blob that is read from the hardware for each event. Not to be confused with the Fragment::Header or the ToyFragment::Metadata objects. More...
 
struct  Metadata
 The ToyFragment::Metadata struct holds data about the readout that may not be present in the primary data stream. More...
 

Public Types

typedef uint16_t adc_t
 ToyFragment is intended to represent/interpret data that has an inherent size of 16 bits (unsigned). This is represented by the adc_t type that is declared here.
 

Public Member Functions

 ToyFragment (artdaq::Fragment const &f)
 The ToyFragment constructor. More...
 
Header::event_size_t hdr_event_size () const
 Gets the event_size from the ToyFragment::Header. More...
 
Header::trigger_number_t hdr_trigger_number () const
 Gets the trigger_number from the ToyFragment::Header. More...
 
uint8_t hdr_distribution_type () const
 Returns the distribution_type field from the ToyFragment::Header. More...
 
size_t total_adc_values () const
 Get the number of ADC values describing data beyond the header. More...
 
adc_t adc_value (uint32_t index)
 Retrieve the given ADC value from the Fragment. More...
 
adc_t const * dataBeginADCs () const
 Start of the ADC values, returned as a const pointer to the ADC type. More...
 
adc_t const * dataEndADCs () const
 End of the ADC values, returned as a const pointer to the ADC type. More...
 
adc_t const * findBadADC (int daq_adc_bits) const
 Look through stored ADC values and determine if any are out-of-range. More...
 
bool fastVerify (int daq_adc_bits) const
 Do any ADC values in the ToyFragment appear to be out-of-range? More...
 
void checkADCData (int daq_adc_bits) const
 Throw if any ADC value appears corrupt. More...
 

Static Public Member Functions

static constexpr size_t hdr_size_words ()
 Gets the size_words variable from the artdaq::Header. More...
 
static size_t adc_range (int daq_adc_bits)
 Get the largest ADC value possible for a given number of ADC bits. More...
 

Protected Member Functions

Header const * header_ () const
 Get a pointer to the ToyFragment::Header object. More...
 

Static Protected Member Functions

static constexpr size_t adcs_per_word_ ()
 Translates between the size of an ADC and the size in Header::data_t words. More...
 

Detailed Description

An artdaq::Fragment overlay class used for pedagogical purposes.

The intention of this class is to provide an example of how an Overlay can be constructed for a hypothetical 16-bit ADC module. In this example, the ADC data can have either 12 or 14 bits of meaningful information per 16-bit word. (This is just a characteristic of this example. Separate classes could certainly be used to overlay the two types of ADC data.)

Definition at line 25 of file ToyFragment.hh.

Constructor & Destructor Documentation

demo::ToyFragment::ToyFragment ( artdaq::Fragment const &  f)
inlineexplicit

The ToyFragment constructor.

Parameters
fThe raw artdaq::Fragment object to overlay

The constructor simply sets its const private member "artdaq_Fragment_" to refer to the artdaq::Fragment object

Definition at line 111 of file ToyFragment.hh.

Member Function Documentation

static size_t demo::ToyFragment::adc_range ( int  daq_adc_bits)
inlinestatic

Get the largest ADC value possible for a given number of ADC bits.

Parameters
daq_adc_bitsNumber of bits in the ADC field
Returns
Largest value possible with the given number of ADC bits

Definition at line 211 of file ToyFragment.hh.

adc_t demo::ToyFragment::adc_value ( uint32_t  index)
inline

Retrieve the given ADC value from the Fragment.

Parameters
indexIndex of the ADC value
Returns
ADC value at given index, or 0xFFFF if out-of-bounds

Definition at line 148 of file ToyFragment.hh.

static constexpr size_t demo::ToyFragment::adcs_per_word_ ( )
inlinestaticprotected

Translates between the size of an ADC and the size in Header::data_t words.

Returns
Number of adc_t counts per Header::data_t word

Definition at line 218 of file ToyFragment.hh.

void demo::ToyFragment::checkADCData ( int  daq_adc_bits) const

Throw if any ADC value appears corrupt.

Parameters
daq_adc_bitsNumber of bits for ADC values
Exceptions
cet::exceptionif any ADC value is out-of-range

Definition at line 15 of file ToyFragment.cc.

adc_t const* demo::ToyFragment::dataBeginADCs ( ) const
inline

Start of the ADC values, returned as a const pointer to the ADC type.

Returns
const adc_t pointer to the start of the payload

Definition at line 162 of file ToyFragment.hh.

adc_t const* demo::ToyFragment::dataEndADCs ( ) const
inline

End of the ADC values, returned as a const pointer to the ADC type.

Returns
const adc_t pointer to the end of the payload

Definition at line 171 of file ToyFragment.hh.

bool demo::ToyFragment::fastVerify ( int  daq_adc_bits) const
inline

Do any ADC values in the ToyFragment appear to be out-of-range?

Parameters
daq_adc_bitsNumber of bits for ADC values
Returns
Whether any of the ADC values in the ToyFragment are out-of-range

Definition at line 197 of file ToyFragment.hh.

adc_t const* demo::ToyFragment::findBadADC ( int  daq_adc_bits) const
inline

Look through stored ADC values and determine if any are out-of-range.

Parameters
daq_adc_bitsNumber of bits for ADC values
Returns
const adc_t pointer to first bad ADC value (if any), or dataEndADCs otherwise

findBadADC() checks to make sure that the ADC type (adc_t) variable holding the ADC value doesn't contain bits beyond the expected range, i.e., can't be evaluated to a larger value than the max permitted ADC value

Definition at line 187 of file ToyFragment.hh.

uint8_t demo::ToyFragment::hdr_distribution_type ( ) const
inline

Returns the distribution_type field from the ToyFragment::Header.

Returns
The distribution_type field from the ToyFragment::Header

Definition at line 129 of file ToyFragment.hh.

Header::event_size_t demo::ToyFragment::hdr_event_size ( ) const
inline

Gets the event_size from the ToyFragment::Header.

Returns
The number of Header::data_t words in the ToyFragment

Definition at line 118 of file ToyFragment.hh.

static constexpr size_t demo::ToyFragment::hdr_size_words ( )
inlinestatic

Gets the size_words variable from the artdaq::Header.

Returns
The size of the Fragment payload

Definition at line 135 of file ToyFragment.hh.

Header::trigger_number_t demo::ToyFragment::hdr_trigger_number ( ) const
inline

Gets the trigger_number from the ToyFragment::Header.

Returns
The "trigger number" of the ToyFragment::Header

Definition at line 123 of file ToyFragment.hh.

Header const* demo::ToyFragment::header_ ( ) const
inlineprotected

Get a pointer to the ToyFragment::Header object.

Returns
Const pointer to the ToyFragment::Header object

header_() simply takes the address of the start of this overlay's data (i.e., where the ToyFragment::Header object begins) and casts it as a const pointer to ToyFragment::Header

Definition at line 228 of file ToyFragment.hh.

size_t demo::ToyFragment::total_adc_values ( ) const
inline

Get the number of ADC values describing data beyond the header.

Returns
The number of ADC values describing data beyond the header

Definition at line 141 of file ToyFragment.hh.


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