Project
Loading...
Searching...
No Matches
CompressedHeader.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//#include "TRDBase/TRDGeometryBase.h"
13//#include "DetectorsCommonDataFormats/DetMatrixCache.h"
14//#include "DetectorsCommonDataFormats/DetID.h"
15
16#ifndef O2_TRD_COMPRESSEDHEADER_H
17#define O2_TRD_COMPRESSEDHEADER_H
18
20// //
21// TRD Compressed Header //
22// struct to hold the header for the raw compressed data of tracklet64
23// when compression happens on the flp
24// Authors //
25// Sean Murray (murrays@cern.ch) //
26//
28#include "Rtypes.h" // for ClassDef
29#include "fairlogger/Logger.h"
30
31namespace o2
32{
33namespace trd
34{
35/* |63|62|61|60|59|58|57|56|55|54|53|52|51|50|49|48|47|46|45|44|43|42|41|40|39|38|37|36|35|34|33|32|
36 -------------------------------------------------------------------------------------------------
37Word 0 | Format | time since frame start |
38 -------------------------------------------------------------------------------------------------
39 |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00|
40 -------------------------------------------------------------------------------------------------
41Word 0 | length of data block |
42 -------------------------------------------------------------------------------------------------
43This is chosen to be a 64 bit word as this is essentially a fake tracklet64 posing as a header.
44This then explains the sizes.
45Format is 4 bits, we only need 3 formats for now.
46*/
48 union {
49 uint64_t word0;
50 struct {
51 uint64_t size : 32; // size of curent block, including this header in 64bit words.
52 uint64_t eventtime : 28; // time from beginning of the time frame
53 uint8_t format : 4; // format of data 1=tracklets,2=digits, 3=config.
54 } __attribute__((__packed__));
55 uint64_t word1; // stores the information that will end up in the triggerrecord.
56 struct {
57 uint16_t bc : 16; // bunch crossing coming from rdh
58 uint32_t orbit : 32; // orbit of lhc
59 uint16_t padding : 16; // 0xeeee
60 } __attribute__((__packed__));
61 };
62};
63//This is simply 64bits of e to mark the end and enable some form of error checking.
64//this appears at the end of tracklets.
65//i.e. start pointer + header.size -1 == Compressed Trailer position.
67 union {
68 uint64_t word; //0xeeeeeexxxxeeeeeeLL where xxxx is the number of digits to follow, max digits on a link is 15*8*16*21 (links*rob*mcm*adc)
69 //TODO I think is off by a factor of 2 but does not matter, the first 'x' is padded in anycase, so would not save in the hex definition above.
70 struct {
71 uint32_t pad2 : 24; // padding e as a marker
72 uint16_t digitcount : 16; // count of digits to come
73 uint32_t pad1 : 24; // padding e as marker
74 } __attribute__((__packed__));
75 };
76};
77
78/* |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00|
79 -------------------------------------------------------------------------------------------------
80Word | detector | rob | mcm | ???????????? |
81 -------------------------------------------------------------------------------------------------
82time is supplied by the compressedrawheader of the tracklets which is always there.
83detector [0-540] 9 bits , rob [0-8] 3 bits , mcm [0-16] 4
84= 15 bits ... what to do with the other 17 bits ?
85Word of caution, tracklets word size is 64 bit digit word size is 32.
86So the raw data has 2 *different* word sizes!
87TODO ignoring config data of course.
88digits are padded at end with a digit end marker (32 bits of 0xe) and then padded to 64 bits.
89i.e. possibly 64 bits of 0xe
90TODO in real data are the digits sent in zero suppresed?
91*/
92
94 union {
95 uint64_t word;
96 struct {
97 uint32_t padding : 16; // padding e as a marker
98 uint16_t mcm : 4; // count of digits to come
99 uint16_t rob : 3; // count of digits to come
100 uint32_t dector : 9; // detector number
101 } __attribute__((__packed__));
102 };
103};
104
106 uint32_t word; // 0xeeeeeeee can be doubled up to pad to 64bit wide data.
107};
108
109//For now we ignore config data.
110//TODO add config data ....
111//
112} //namespace trd
113} //namespace o2
114#endif
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
union o2::trd::CompressedRawDigitHeader::@98 __attribute__
union o2::trd::CompressedRawTrackletDigitSeperator::@96 __attribute__