Project
Loading...
Searching...
No Matches
HeartbeatFrame.h
Go to the documentation of this file.
1
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
12
//-*- Mode: C++ -*-
13
14
#ifndef ALICEO2_HEADER_HEARTBEATFRAME_H
15
#define ALICEO2_HEADER_HEARTBEATFRAME_H
16
17
// @file Heartbeatframe.h
18
// @author Matthias Richter
19
// @since 2017-02-02
20
// @brief Definition of the heartbeat frame layout
21
22
#include "
Headers/DataHeader.h
"
23
#include <functional>
24
#include <map>
25
#include <vector>
26
27
namespace
o2
28
{
29
namespace
header
30
{
31
32
// The Heartbeat frame layout is specified in
33
// http://svnweb.cern.ch/world/wsvn/alicetdrrun3/Notes/Run34SystemNote/detector-read-alice/ALICErun34_readout.pdf
34
// TODO: replace citation with correct ALICE note reference when published
35
36
// general remark:
37
// at the moment its not clear how the heartbeat frame is transmitted in AliceO2.
38
// Current understanding is that the heartbeat header and trailer embed some detector
39
// data and form the heartbeat frame. The detector data is the payload which is going
40
// to be sent as the payload of the O2 data packet. The HBH and HBT must be stripped
41
// from the payload and probably be added to the header stack and later on be stripped
42
// from there as well during the accumulation of subtimeframes and timeframes as the
43
// HB information should be identical in the (sub)timeframes
44
45
// define the data type id for the heartbeat frame
46
// check if this is the correct term, we probably won't send what is referred to be
47
// the heartbeat frame (composition of HBH - detector payload - HBT); instead, the
48
// HBH and HBT can be added to the header stack
49
extern
const
o2::header::DataDescription
gDataDescriptionHeartbeatFrame
;
50
51
struct
HeartbeatHeader
{
52
union
{
53
// the complete 64 bit header word, initialize with blockType 1 and size 1
54
uint64_t
headerWord
= 0x1100000000000000;
55
struct
{
56
// bit 0 to 31: orbit number
57
uint32_t
orbit
;
58
// bit 32 to 43: bunch crossing id
59
uint16_t
bcid
: 12;
60
// bit 44 to 47: reserved
61
uint16_t
reserved
: 4;
62
// bit 48 to 51: trigger type
63
uint8_t
triggerType
: 4;
64
// bit 52 to 55: reserved
65
uint8_t
reservedTriggerType
: 4;
66
// bit 56 to 59: header length
67
uint8_t
headerLength
: 4;
68
// bit 60 to 63: block type (=1 HBF/trigger Header)
69
uint8_t
blockType
: 4;
70
};
71
};
// end union
72
73
operator
bool()
const
{
return
headerWord
!= 0 &&
blockType
== 0x1; }
74
75
bool
operator<
(
const
HeartbeatHeader
&
other
)
const
76
{
77
return
this->
orbit
< other.
orbit
;
78
}
79
80
operator
uint64_t()
const
{
return
headerWord
; }
81
};
82
static_assert
(
sizeof
(
HeartbeatHeader
) == 8,
"Heartbeat header must be 64bit"
);
83
84
struct
HeartbeatTrailer
{
85
union
{
86
// the complete 64 bit trailer word, initialize with blockType 5 and size 1
87
uint64_t
trailerWord
= 0x5100000000000000;
88
struct
{
89
// bit 0 to 31: data length in words
90
uint32_t
dataLength
;
91
// bit 32 to 52: detector specific status words
92
uint32_t
status
: 21;
93
// bit 53: =1 in case a new physics trigger arrived within read-out period
94
uint16_t
hbfTruncated
: 1;
95
// bit 54: =0 HBF correctly transmitted
96
uint16_t
hbfStatus
: 1;
97
// bit 55: =1 HBa/0 HBr received
98
uint16_t
hbAccept
: 1;
99
// bit 56 to 59: trailer length
100
uint16_t
trailerLength
: 4;
101
// bit 60 to 63: block type (=5 HBF Trailer)
102
uint8_t
blockType
: 4;
103
};
104
};
// end union
105
106
operator
bool()
const
{
return
trailerWord
!= 0 &&
blockType
== 0x5; }
107
108
operator
uint64_t()
const
{
return
trailerWord
; }
109
};
110
static_assert
(
sizeof
(
HeartbeatTrailer
) == 8,
"Heartbeat trailer must be 64bit"
);
111
112
// composite struct for the HBH and HBT which are the envelope for the payload
113
// in the heartbeat frame
114
// TODO: check if the copying of header and trailer can be avoided if references
115
// are used in a temporary object inserted to the header stack
116
struct
HeartbeatFrameEnvelope
:
public
BaseHeader
{
117
//static data for this header type/version
118
static
const
uint32_t
sVersion
;
119
static
const
o2::header::HeaderType
sHeaderType
;
120
static
const
o2::header::SerializationMethod
sSerializationMethod
;
121
122
HeartbeatHeader
header
;
123
HeartbeatTrailer
trailer
;
124
125
HeartbeatFrameEnvelope
()
126
:
BaseHeader
(sizeof(
HeartbeatFrameEnvelope
),
sHeaderType
,
sSerializationMethod
,
sVersion
),
header
(),
trailer
() {}
127
128
HeartbeatFrameEnvelope
(
const
HeartbeatHeader
&
h
,
const
HeartbeatTrailer
& t)
129
:
BaseHeader
(sizeof(
HeartbeatFrameEnvelope
),
sHeaderType
,
sSerializationMethod
,
sVersion
),
header
(
h
),
trailer
(t) {}
130
};
131
132
// a statistics data block for heartbeat frames
133
// it transmits real time as the payload of the HB frame in AliceO2
134
// eventually to be dropped later, its intended for the first experimental work
135
struct
HeartbeatStatistics
{
136
// time tick when this statistics was created
137
uint64_t
timeTickNanoSeconds
;
138
// difference to the previous time tick
139
uint64_t
durationNanoSeconds
;
140
141
HeartbeatStatistics
() :
timeTickNanoSeconds
(0),
durationNanoSeconds
(0) {}
142
};
143
144
};
// namespace header
145
};
// namespace o2
146
#endif
DataHeader.h
h
Class for time synchronization of RawReader instances.
o2::header::gDataDescriptionHeartbeatFrame
const o2::header::DataDescription gDataDescriptionHeartbeatFrame
o2
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Definition
BitstreamReader.h:24
o2::header::BaseHeader
the base header struct Every header type must begin (i.e. derive) with this. Don't use this struct di...
Definition
DataHeader.h:351
o2::header::Descriptor< gSizeDataDescriptionString >
o2::header::HeartbeatFrameEnvelope
Definition
HeartbeatFrame.h:116
o2::header::HeartbeatFrameEnvelope::HeartbeatFrameEnvelope
HeartbeatFrameEnvelope(const HeartbeatHeader &h, const HeartbeatTrailer &t)
Definition
HeartbeatFrame.h:128
o2::header::HeartbeatFrameEnvelope::sSerializationMethod
static const o2::header::SerializationMethod sSerializationMethod
Definition
HeartbeatFrame.h:120
o2::header::HeartbeatFrameEnvelope::HeartbeatFrameEnvelope
HeartbeatFrameEnvelope()
Definition
HeartbeatFrame.h:125
o2::header::HeartbeatFrameEnvelope::trailer
HeartbeatTrailer trailer
Definition
HeartbeatFrame.h:123
o2::header::HeartbeatFrameEnvelope::sHeaderType
static const o2::header::HeaderType sHeaderType
Definition
HeartbeatFrame.h:119
o2::header::HeartbeatFrameEnvelope::sVersion
static const uint32_t sVersion
Definition
HeartbeatFrame.h:118
o2::header::HeartbeatFrameEnvelope::header
HeartbeatHeader header
Definition
HeartbeatFrame.h:122
o2::header::HeartbeatHeader
Definition
HeartbeatFrame.h:51
o2::header::HeartbeatHeader::headerWord
uint64_t headerWord
Definition
HeartbeatFrame.h:54
o2::header::HeartbeatHeader::headerLength
uint8_t headerLength
Definition
HeartbeatFrame.h:67
o2::header::HeartbeatHeader::blockType
uint8_t blockType
Definition
HeartbeatFrame.h:69
o2::header::HeartbeatHeader::reserved
uint16_t reserved
Definition
HeartbeatFrame.h:61
o2::header::HeartbeatHeader::bcid
uint16_t bcid
Definition
HeartbeatFrame.h:59
o2::header::HeartbeatHeader::operator<
bool operator<(const HeartbeatHeader &other) const
Definition
HeartbeatFrame.h:75
o2::header::HeartbeatHeader::triggerType
uint8_t triggerType
Definition
HeartbeatFrame.h:63
o2::header::HeartbeatHeader::reservedTriggerType
uint8_t reservedTriggerType
Definition
HeartbeatFrame.h:65
o2::header::HeartbeatHeader::orbit
uint32_t orbit
Definition
HeartbeatFrame.h:57
o2::header::HeartbeatStatistics
Definition
HeartbeatFrame.h:135
o2::header::HeartbeatStatistics::timeTickNanoSeconds
uint64_t timeTickNanoSeconds
Definition
HeartbeatFrame.h:137
o2::header::HeartbeatStatistics::durationNanoSeconds
uint64_t durationNanoSeconds
Definition
HeartbeatFrame.h:139
o2::header::HeartbeatStatistics::HeartbeatStatistics
HeartbeatStatistics()
Definition
HeartbeatFrame.h:141
o2::header::HeartbeatTrailer
Definition
HeartbeatFrame.h:84
o2::header::HeartbeatTrailer::dataLength
uint32_t dataLength
Definition
HeartbeatFrame.h:90
o2::header::HeartbeatTrailer::hbAccept
uint16_t hbAccept
Definition
HeartbeatFrame.h:98
o2::header::HeartbeatTrailer::hbfStatus
uint16_t hbfStatus
Definition
HeartbeatFrame.h:96
o2::header::HeartbeatTrailer::hbfTruncated
uint16_t hbfTruncated
Definition
HeartbeatFrame.h:94
o2::header::HeartbeatTrailer::trailerWord
uint64_t trailerWord
Definition
HeartbeatFrame.h:87
o2::header::HeartbeatTrailer::blockType
uint8_t blockType
Definition
HeartbeatFrame.h:102
o2::header::HeartbeatTrailer::status
uint32_t status
Definition
HeartbeatFrame.h:92
o2::header::HeartbeatTrailer::trailerLength
uint16_t trailerLength
Definition
HeartbeatFrame.h:100
other
VectorOfTObjectPtrs other
Definition
test_Algorithm.cxx:501
DataFormats
Headers
include
Headers
HeartbeatFrame.h
Generated on Tue Feb 25 2025 23:16:11 for Project by
1.9.8