LDMX Software
packing::LDMXRoRHeader Class Reference

the header that the LDMX DAQ Firmware block includes in the output data stream at the beginning of each data frame More...

#include <LDMXRoRHeader.h>

Public Member Functions

utility::Readerread (utility::Reader &r)
 read the next LDMX RoR header into memory
 
uint8_t version () const
 version of LDMX data (should be zero)
 
uint8_t subsystem () const
 ID number for subsystem originating data (compiled into firmware)
 
uint8_t contributor () const
 ID number for contributor within subsystem (configured into firmware)
 
uint64_t timestamp () const
 get timestamp of this RoR
 

Static Public Member Functions

static std::tuple< int, int > subsystem (const std::string &name)
 Get the (subsystem, contributor) pair for the input subsystem name.
 

Static Public Attributes

static const unsigned int SIZE = 16
 size of this header in bytes
 
static const std::unordered_map< std::string, int > SUBSYSTEM_ID
 The subsystem ID numbers organized by subsystem name.
 
static const std::unordered_map< std::string, int > CONTRIBUTOR_ID
 The contributor ID is a configurable parameter of the DAQ firmware.
 

Private Attributes

uint8_t version_
 version of LDMX data (should be zero)
 
uint8_t subsystem_
 ID number for subsystem originating data (compiled into firmware)
 
uint8_t contributor_
 ID number for contributor within subsystem (configured into firmware)
 
uint64_t timestamp_
 timestamp of this Readout-Request (RoR)
 

Detailed Description

the header that the LDMX DAQ Firmware block includes in the output data stream at the beginning of each data frame

This header is immediately preceeded by a RogueFrameHeader for data frames. It is separate only becuase some frames written to the file (mainly, the configuration stream) do not include this header as well as the RogueFrameHeader.

Definition at line 22 of file LDMXRoRHeader.h.

Member Function Documentation

◆ contributor()

uint8_t packing::LDMXRoRHeader::contributor ( ) const
inline

ID number for contributor within subsystem (configured into firmware)

Definition at line 72 of file LDMXRoRHeader.h.

72{ return contributor_; }
uint8_t contributor_
ID number for contributor within subsystem (configured into firmware)

References contributor_.

◆ read()

utility::Reader & packing::LDMXRoRHeader::read ( utility::Reader & r)

read the next LDMX RoR header into memory

Definition at line 27 of file LDMXRoRHeader.cxx.

27 {
28 uint8_t sentinel;
29 uint32_t zero;
30 if (!(r >> version_ >> subsystem_ >> contributor_ >> sentinel)) {
31 return r;
32 }
33
34 // sentinel should be 0xa5
35 assert(sentinel == 0xa5);
36
37 if (!(r >> zero)) {
38 return r;
39 }
40
41 // next 32b should be zero since they are unused
42 assert(zero == 0);
43
44 return (r >> timestamp_);
45}
uint64_t timestamp_
timestamp of this Readout-Request (RoR)
uint8_t version_
version of LDMX data (should be zero)
uint8_t subsystem_
ID number for subsystem originating data (compiled into firmware)

References contributor_, subsystem_, timestamp_, and version_.

◆ subsystem() [1/2]

uint8_t packing::LDMXRoRHeader::subsystem ( ) const
inline

ID number for subsystem originating data (compiled into firmware)

Definition at line 70 of file LDMXRoRHeader.h.

70{ return subsystem_; }

References subsystem_.

Referenced by packing::SingleSubsystemUnpacker::configure().

◆ subsystem() [2/2]

std::tuple< int, int > packing::LDMXRoRHeader::subsystem ( const std::string & name)
static

Get the (subsystem, contributor) pair for the input subsystem name.

Note
For the 2025 slice test at SLAC, there was only ever one contributor per subsystem (-1 means that it was not set and can be ignored). In the future, there will be more than one contributor for some subsystems and so this function will need to be rewritten.
Parameters
[in]namesubsystem name ('tdaq','ts','tracker','hcal','ecal')
Returns
2-tuple of subsystem, contributor ID numbers. Returns the pair (-1, -1) if the name is not found in our maps above.

Definition at line 13 of file LDMXRoRHeader.cxx.

13 {
14 auto subsys_it{SUBSYSTEM_ID.find(name)};
15 if (subsys_it == SUBSYSTEM_ID.end()) {
16 return std::make_tuple(-1, -1);
17 }
18
19 int subsys{subsys_it->second}, contrib{-1};
20 auto contrib_it{CONTRIBUTOR_ID.find(name)};
21 if (contrib_it != CONTRIBUTOR_ID.end()) {
22 contrib = contrib_it->second;
23 }
24 return std::make_tuple(subsys, contrib);
25}
static const std::unordered_map< std::string, int > SUBSYSTEM_ID
The subsystem ID numbers organized by subsystem name.
static const std::unordered_map< std::string, int > CONTRIBUTOR_ID
The contributor ID is a configurable parameter of the DAQ firmware.

References CONTRIBUTOR_ID, and SUBSYSTEM_ID.

◆ timestamp()

uint64_t packing::LDMXRoRHeader::timestamp ( ) const
inline

get timestamp of this RoR

Definition at line 74 of file LDMXRoRHeader.h.

74{ return timestamp_; }

References timestamp_.

◆ version()

uint8_t packing::LDMXRoRHeader::version ( ) const
inline

version of LDMX data (should be zero)

Definition at line 68 of file LDMXRoRHeader.h.

68{ return version_; }

References version_.

Member Data Documentation

◆ contributor_

uint8_t packing::LDMXRoRHeader::contributor_
private

ID number for contributor within subsystem (configured into firmware)

Definition at line 82 of file LDMXRoRHeader.h.

Referenced by contributor(), and read().

◆ CONTRIBUTOR_ID

const std::unordered_map< std::string, int > packing::LDMXRoRHeader::CONTRIBUTOR_ID
static
Initial value:
= {
{"tdaq", -1}, {"ts", 1}, {"tracker", -1}, {"ecal", 40}, {"hcal", 20}}

The contributor ID is a configurable parameter of the DAQ firmware.

For the 2025 slice test at SLAC, there was only ever one contributor per subsystem and so there is just one integer per subsystem here. (-1 means that it was not set and can be ignored).

In the future, there will be more than one contributor for some subsystems.

The subsystem names are all lower case.

Definition at line 49 of file LDMXRoRHeader.h.

Referenced by subsystem().

◆ SIZE

const unsigned int packing::LDMXRoRHeader::SIZE = 16
static

size of this header in bytes

Definition at line 25 of file LDMXRoRHeader.h.

Referenced by packing::SingleSubsystemUnpacker::produce().

◆ subsystem_

uint8_t packing::LDMXRoRHeader::subsystem_
private

ID number for subsystem originating data (compiled into firmware)

Definition at line 80 of file LDMXRoRHeader.h.

Referenced by read(), and subsystem().

◆ SUBSYSTEM_ID

const std::unordered_map< std::string, int > packing::LDMXRoRHeader::SUBSYSTEM_ID
static
Initial value:
= {
{"tdaq", 1}, {"ts", 2}, {"tracker", 4}, {"ecal", 5}, {"hcal", 5}}

The subsystem ID numbers organized by subsystem name.

These ID numbers are compiled into the DAQ firmware. Since the same firmware was used for both the ECal and HCal, they both ended up having the same subsystem ID (5).

The subsystem names are all lower case.

Definition at line 35 of file LDMXRoRHeader.h.

Referenced by subsystem().

◆ timestamp_

uint64_t packing::LDMXRoRHeader::timestamp_
private

timestamp of this Readout-Request (RoR)

It is some combination of pulseID and bunchCount, but I'm unsure on how to decompose those at this time.

Definition at line 90 of file LDMXRoRHeader.h.

Referenced by read(), and timestamp().

◆ version_

uint8_t packing::LDMXRoRHeader::version_
private

version of LDMX data (should be zero)

Definition at line 78 of file LDMXRoRHeader.h.

Referenced by read(), and version().


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