LDMX Software
Packing
include
Packing
LDMXRoRHeader.h
1
#pragma once
2
#ifndef PACKING_LDMXRORHEADER_H
3
#define PACKING_LDMXRORHEADER_H
4
5
#include <cstdint>
6
#include <unordered_map>
7
8
#include "Packing/Utility/Reader.h"
9
10
namespace
packing {
11
21
class
LDMXRoRHeader
{
22
public
:
24
static
const
unsigned
int
SIZE
= 16;
34
static
const
std::unordered_map<std::string, int>
SUBSYSTEM_ID
;
35
48
static
const
std::unordered_map<std::string, int>
CONTRIBUTOR_ID
;
49
62
static
std::tuple<int, int>
subsystem
(
const
std::string& name);
63
79
static
std::string
getSubsystemName
(uint8_t subsystem_id,
80
uint8_t contributor_id);
81
83
utility::Reader
&
read
(
utility::Reader
& r);
86
bool
valid
()
const
{
return
valid_
; }
96
uint32_t
flags
()
const
{
return
flags_
; }
98
static
constexpr
uint32_t
FLAG_DATA_DROPPED
{0x1};
100
bool
dataDropped
()
const
{
return
flags_
&
FLAG_DATA_DROPPED
; }
102
uint8_t
lostBefore
()
const
{
return
(
flags_
>> 8) & 0xff; }
104
uint8_t
version
()
const
{
return
version_
; }
106
uint8_t
subsystem
()
const
{
return
subsystem_
; }
108
uint8_t
contributor
()
const
{
return
contributor_
; }
110
uint64_t
timestamp
()
const
{
return
timestamp_
; }
111
112
private
:
114
bool
valid_
{
false
};
116
uint8_t
version_
;
118
uint8_t
subsystem_
;
120
uint8_t
contributor_
;
122
uint32_t
flags_
{0};
124
static
constexpr
uint32_t
FLAG_MASK
{0xff07};
132
uint64_t
timestamp_
;
133
};
134
135
}
// namespace packing
136
137
#endif
packing::LDMXRoRHeader
the header that the LDMX DAQ Firmware block includes in the output data stream at the beginning of ea...
Definition
LDMXRoRHeader.h:21
packing::LDMXRoRHeader::timestamp_
uint64_t timestamp_
timestamp of this Readout-Request (RoR)
Definition
LDMXRoRHeader.h:132
packing::LDMXRoRHeader::subsystem
uint8_t subsystem() const
ID number for subsystem originating data (compiled into firmware)
Definition
LDMXRoRHeader.h:106
packing::LDMXRoRHeader::FLAG_MASK
static constexpr uint32_t FLAG_MASK
flag bits in use, the others must be zero
Definition
LDMXRoRHeader.h:124
packing::LDMXRoRHeader::valid_
bool valid_
set to true only when all validity checks pass during read()
Definition
LDMXRoRHeader.h:114
packing::LDMXRoRHeader::FLAG_DATA_DROPPED
static constexpr uint32_t FLAG_DATA_DROPPED
header-only fragment, see flags()
Definition
LDMXRoRHeader.h:98
packing::LDMXRoRHeader::contributor
uint8_t contributor() const
ID number for contributor within subsystem (configured into firmware)
Definition
LDMXRoRHeader.h:108
packing::LDMXRoRHeader::getSubsystemName
static std::string getSubsystemName(uint8_t subsystem_id, uint8_t contributor_id)
Get the subsystem name from subsystem and contributor IDs.
Definition
LDMXRoRHeader.cxx:29
packing::LDMXRoRHeader::version
uint8_t version() const
version of LDMX data (should be zero)
Definition
LDMXRoRHeader.h:104
packing::LDMXRoRHeader::lostBefore
uint8_t lostBefore() const
number of readout requests lost before this one, saturates at 255
Definition
LDMXRoRHeader.h:102
packing::LDMXRoRHeader::valid
bool valid() const
true if the header was parsed successfully (sentinel matched and the unused flag bits are zero)
Definition
LDMXRoRHeader.h:86
packing::LDMXRoRHeader::flags
uint32_t flags() const
flags set by the DAQ event formatter
Definition
LDMXRoRHeader.h:96
packing::LDMXRoRHeader::contributor_
uint8_t contributor_
ID number for contributor within subsystem (configured into firmware)
Definition
LDMXRoRHeader.h:120
packing::LDMXRoRHeader::flags_
uint32_t flags_
formatter flags, see flags()
Definition
LDMXRoRHeader.h:122
packing::LDMXRoRHeader::SUBSYSTEM_ID
static const std::unordered_map< std::string, int > SUBSYSTEM_ID
The subsystem ID numbers organized by subsystem name.
Definition
LDMXRoRHeader.h:34
packing::LDMXRoRHeader::timestamp
uint64_t timestamp() const
get timestamp of this RoR
Definition
LDMXRoRHeader.h:110
packing::LDMXRoRHeader::version_
uint8_t version_
version of LDMX data (should be zero)
Definition
LDMXRoRHeader.h:116
packing::LDMXRoRHeader::read
utility::Reader & read(utility::Reader &r)
read the next LDMX RoR header into memory
Definition
LDMXRoRHeader.cxx:64
packing::LDMXRoRHeader::subsystem_
uint8_t subsystem_
ID number for subsystem originating data (compiled into firmware)
Definition
LDMXRoRHeader.h:118
packing::LDMXRoRHeader::CONTRIBUTOR_ID
static const std::unordered_map< std::string, int > CONTRIBUTOR_ID
The contributor ID is a configurable parameter of the DAQ firmware.
Definition
LDMXRoRHeader.h:48
packing::LDMXRoRHeader::dataDropped
bool dataDropped() const
true if the formatter dropped this fragment's data (header only)
Definition
LDMXRoRHeader.h:100
packing::LDMXRoRHeader::SIZE
static const unsigned int SIZE
size of this header in bytes
Definition
LDMXRoRHeader.h:24
packing::utility::Reader
Reading a raw data file.
Definition
Reader.h:20
Generated by
1.12.0