Project
Loading...
Searching...
No Matches
test_RAWDataHeader.cxx
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#define BOOST_TEST_MODULE Test RAWDataHeader
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
16#include <array>
18
20{
22 static_assert(sizeof(RDH) == 64, "RAWDataHeader v5 is supposed to be 512 bit");
23
24 // check the defaults
25 RDH defaultRDH;
26 BOOST_CHECK(defaultRDH.version == 4);
27 BOOST_CHECK(defaultRDH.blockLength == 0);
28 BOOST_CHECK(defaultRDH.feeId == 0xffff);
29 //BOOST_CHECK(defaultRDH.linkId == 0xff);
30 BOOST_CHECK(defaultRDH.headerSize == 64); // header size in 64 bytes = 8*64 bit words
31
32 using byte = unsigned char;
33 std::array<byte, sizeof(RDH)> buffer;
34 buffer.fill(0);
35
36 buffer[0] = 0x3; // set version 3
37 buffer[1] = 0x08; // header size 8 64 bit words
38 buffer[2] = 0x6;
39 buffer[3] = 0x1;
40 buffer[4] = 0xad;
41 buffer[5] = 0xde;
42 buffer[6] = 0;
43 buffer[7] = 0;
44
45 // do not set anything in words 1,2, and 3
46
47 buffer[32] = 0xdc;
48 buffer[33] = 0x0e;
49 buffer[34] = 0x12;
50 buffer[35] = 0x0a;
51 buffer[36] = 0x23;
52 buffer[37] = 0x71;
53 buffer[38] = 0x98;
54 buffer[39] = 0xba;
55
56 // do not set anything in word 5
57
58 buffer[48] = 0xad;
59 buffer[49] = 0xde;
60 buffer[50] = 0;
61 buffer[51] = 0;
62 buffer[52] = 0x00;
63 buffer[53] = 0x0f;
64 buffer[54] = 0xd0;
65 buffer[55] = 0x00;
66
67 // do not set anything in word 7
68
69 auto rdh = reinterpret_cast<RDH*>(buffer.data());
70
71 // if the tests fail, we are probbaly on a big endian architecture or
72 // there are alignment issues
73 BOOST_CHECK(rdh->version == 3);
74 BOOST_CHECK(rdh->blockLength == 262);
75 BOOST_CHECK(rdh->feeId == 0xdead);
76 //BOOST_CHECK(rdh->linkId == 0xaf);
77 BOOST_CHECK(rdh->headerSize == 8);
78 BOOST_CHECK(rdh->priority == 0);
79 BOOST_CHECK(rdh->zero0 == 0);
80 BOOST_CHECK(rdh->word1 == 0);
81 BOOST_CHECK(rdh->word2 == 0);
82 BOOST_CHECK(rdh->word3 == 0);
83 BOOST_CHECK(rdh->triggerOrbit == 0);
84 BOOST_CHECK(rdh->heartbeatOrbit == 0);
85 BOOST_CHECK(rdh->triggerType == 0xba987123);
86 BOOST_CHECK(rdh->triggerBC == 0xedc);
87 BOOST_CHECK(rdh->heartbeatBC == 0xa12);
88 BOOST_CHECK(rdh->zero41 == 0);
89 BOOST_CHECK(rdh->zero42 == 0);
90 BOOST_CHECK(rdh->word5 == 0);
91 BOOST_CHECK(rdh->pageCnt == 0xd00f);
92 BOOST_CHECK(rdh->stop == 0);
93 BOOST_CHECK(rdh->detectorField == 0xdead);
94 BOOST_CHECK(rdh->par == 0);
95 BOOST_CHECK(rdh->zero6 == 0);
96 BOOST_CHECK(rdh->word7 == 0);
97}
98
100{
102 static_assert(sizeof(RDH) == 64, "RAWDataHeader v5 is supposed to be 512 bit");
103
104 // check the defaults
105 RDH defaultRDH;
106 BOOST_CHECK(defaultRDH.version == 5);
107 BOOST_CHECK(defaultRDH.feeId == 0xffff);
108 BOOST_CHECK(defaultRDH.headerSize == 64); // header size in 64 bytes = 8*64 bit words
109}
110
112{
114 static_assert(sizeof(RDH) == 64, "RAWDataHeader v6 is supposed to be 512 bit");
115
116 // check the defaults
117 RDH defaultRDH;
118 uint64_t dummySrc = 0xcd;
119 defaultRDH.sourceID = dummySrc; // only lowes byte should be assigned
120 BOOST_CHECK(defaultRDH.version == 6);
121 BOOST_CHECK(defaultRDH.feeId == 0xffff);
122 BOOST_CHECK(defaultRDH.headerSize == 64); // header size in 64 bytes = 8*64 bit words
123 BOOST_CHECK(defaultRDH.sourceID == dummySrc);
124}
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
Definition of the RAW Data Header.
uint64_t sourceID
bit 32 to 39: priority bit
uint64_t headerSize
bit 0 to 7: header version
uint64_t feeId
bit 8 to 15: header size
BOOST_AUTO_TEST_CASE(test_rdh_v4)
BOOST_CHECK(tree)