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
27namespace o2
28{
29namespace 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
50
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
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};
82static_assert(sizeof(HeartbeatHeader) == 8, "Heartbeat header must be 64bit");
83
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};
110static_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
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
136 // time tick when this statistics was created
138 // difference to the previous time tick
140
142};
143
144}; // namespace header
145}; // namespace o2
146#endif
Class for time synchronization of RawReader instances.
const o2::header::DataDescription gDataDescriptionHeartbeatFrame
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
the base header struct Every header type must begin (i.e. derive) with this. Don't use this struct di...
Definition DataHeader.h:351
HeartbeatFrameEnvelope(const HeartbeatHeader &h, const HeartbeatTrailer &t)
static const o2::header::SerializationMethod sSerializationMethod
static const o2::header::HeaderType sHeaderType
bool operator<(const HeartbeatHeader &other) const
VectorOfTObjectPtrs other