Project
Loading...
Searching...
No Matches
SAC.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
15
16#ifndef ALICEO2_DATAFORMATSTPC_SAC_H
17#define ALICEO2_DATAFORMATSTPC_SAC_H
18
19#include <cstdint>
20#include <string_view>
21
22namespace o2::tpc::sac
23{
24
25static constexpr uint32_t FEsPerInstance = 9;
26
28struct headerDef {
29 static constexpr uint32_t MagicWord = 0xabcd;
30
31 union {
33 struct {
39 };
40 };
42 union {
44 struct {
48 };
49 };
51 union {
53 };
55 union {
57 struct {
61 };
62 };
63
64 bool check() const { return magicWord == MagicWord; }
65};
66
67struct dataDef {
68 static constexpr uint32_t HeaderWord = 0xdeadbeef;
69 static constexpr uint32_t TrailerWord = 0xbeefdead;
70 static constexpr uint32_t PacketSize = 1024;
71 static constexpr uint32_t DataSize = 1000;
72
75 union {
77 struct {
80 };
81 };
88
89 bool check() const
90 {
91 return (header == HeaderWord) && (trailer == TrailerWord) && (pktSize == PacketSize);
92 }
93};
94
95struct packet {
98
100 {
101 return header.instance;
102 }
103
108 {
109 return data.feid - 1 + header.instance * FEsPerInstance;
110 }
111
112 std::string_view getDataWords()
113 {
114 return std::string_view(data.dataWords, dataDef::DataSize);
115 }
116
117 bool check() const
118 {
119 return header.check() && data.check();
120 }
121
122 int getCheckMask() const
123 {
124 return (header.check() << 1) | data.check();
125 }
126};
127
128} // namespace o2::tpc::sac
129
130#endif
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
uint32_t header
Definition SAC.h:73
uint32_t pktNumber
packet number of this front end card. Should always increase by 1
Definition SAC.h:83
uint32_t crc32
CRC32 checksum.
Definition SAC.h:86
uint32_t pktSize
total size of the packet in bytes, should always be 1024
Definition SAC.h:79
static constexpr uint32_t TrailerWord
Definition SAC.h:69
uint32_t feid
front end ID (card number in rack): 1 - 9
Definition SAC.h:78
uint32_t trailer
trailer magic word, should always be TrailerWord
Definition SAC.h:87
uint32_t timeStamp
time stamp
Definition SAC.h:84
static constexpr uint32_t DataSize
Definition SAC.h:71
static constexpr uint32_t PacketSize
Definition SAC.h:70
uint32_t sizeFE
Definition SAC.h:76
static constexpr uint32_t HeaderWord
Definition SAC.h:68
bool check() const
Definition SAC.h:89
char dataWords[DataSize]
ASCI encoded SAC data.
Definition SAC.h:85
256bit CRU header word of SACs
Definition SAC.h:28
uint64_t word2
bits 128 - 191
Definition SAC.h:52
bool check() const
Definition SAC.h:64
uint32_t version
header version number
Definition SAC.h:34
uint32_t bunchCrossing
bunch crossing when SAC packet was received
Definition SAC.h:37
uint32_t orbit
orbit when SAC packet was received
Definition SAC.h:38
uint32_t empty1_0
not used
Definition SAC.h:46
uint32_t pktCount
<
Definition SAC.h:45
uint32_t instance
0: TPC A (slave), 1: TPC C (master), 2/3: TRD
Definition SAC.h:35
uint32_t empty3_0
Definition SAC.h:58
uint32_t empty1_1
not used
Definition SAC.h:47
uint64_t word0
bits 0 - 63
Definition SAC.h:32
uint32_t empty3_1
Definition SAC.h:59
uint64_t word1
bits 64 - 127
Definition SAC.h:43
uint32_t magicWord
magic word should always correspond to MagicWord
Definition SAC.h:60
static constexpr uint32_t MagicWord
magic word
Definition SAC.h:29
uint32_t empty0
not used
Definition SAC.h:36
uint64_t word3
bits 192 - 255
Definition SAC.h:56
bool check() const
Definition SAC.h:117
uint32_t getInstance() const
Definition SAC.h:99
int getCheckMask() const
Definition SAC.h:122
dataDef data
Definition SAC.h:97
std::string_view getDataWords()
Definition SAC.h:112
headerDef header
Definition SAC.h:96
uint32_t getFEIndex() const
Definition SAC.h:107