Project
Loading...
Searching...
No Matches
DAQID.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
// @brief Class for mapping between DAQ sourceIDs and O2 DataOrigins
13
// @author ruben.shahoyan@cern.ch
14
15
#ifndef DETECTOR_BASE_RAWDAQID_H
16
#define DETECTOR_BASE_RAWDAQID_H
17
18
#include "
Headers/DataHeader.h
"
19
20
namespace
o2
21
{
22
namespace
header
23
{
25
26
constexpr
o2::header::DataOrigin
gDataOriginUnloaded
{
"UNL"
};
27
28
class
DAQID
29
{
30
31
public
:
32
typedef
std::uint8_t
ID
;
33
34
static
constexpr
ID
TPC
= 3;
35
static
constexpr
ID
TRD
= 4;
36
static
constexpr
ID
TOF
= 5;
37
static
constexpr
ID
HMP
= 6;
38
static
constexpr
ID
PHS
= 7;
39
static
constexpr
ID
CPV
= 8;
40
static
constexpr
ID
INVALID
= 9;
// 1st invalid slot starting from meaningful values
41
static
constexpr
ID
MCH
= 10;
42
static
constexpr
ID
ZDC
= 15;
43
static
constexpr
ID
TRG
= 17;
// == CTP
44
static
constexpr
ID
EMC
= 18;
45
static
constexpr
ID
TST
= 19;
46
static
constexpr
ID
ITS
= 32;
47
static
constexpr
ID
FDD
= 33;
48
static
constexpr
ID
FT0
= 34;
49
static
constexpr
ID
FV0
= 35;
50
static
constexpr
ID
MFT
= 36;
51
static
constexpr
ID
MID
= 37;
52
static
constexpr
ID
DCS
= 38;
53
static
constexpr
ID
FOC
= 39;
54
static
constexpr
ID
UNLOADED
= 255;
55
static
constexpr
ID
MINDAQ
=
TPC
;
56
static
constexpr
ID
MAXDAQ
=
FOC
;
57
58
DAQID
() : mID(
INVALID
) {}
59
DAQID
(
ID
i
) : mID(
i
) {}
60
operator
ID
()
const
{
return
static_cast<
ID
>
(mID); }
61
62
ID
getID
()
const
{
return
mID; }
63
constexpr
o2::header::DataOrigin
getO2Origin
() {
return
DAQtoO2
(mID); }
64
65
static
constexpr
o2::header::DataOrigin
DAQtoO2
(
ID
daq)
66
{
67
return
(daq <
MAXDAQ
+ 1) ? MAP_DAQtoO2[daq] : (daq ==
UNLOADED
?
gDataOriginUnloaded
: MAP_DAQtoO2[
INVALID
]);
68
}
69
70
static
constexpr
ID
O2toDAQ
(
o2::header::DataOrigin
o2orig)
71
{
72
return
or2daq(o2orig,
MINDAQ
);
73
}
74
75
private
:
76
ID
mID =
INVALID
;
77
78
static
constexpr
o2::header::DataOrigin
MAP_DAQtoO2[0xff + 1] = {
79
"NIL"
,
"NIL"
,
"NIL"
,
80
"TPC"
,
"TRD"
,
"TOF"
,
"HMP"
,
"PHS"
,
"CPV"
,
81
"NIL"
,
82
"MCH"
,
83
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
84
"ZDC"
,
85
"NIL"
,
86
"CTP"
,
"EMC"
,
"TST"
,
87
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
88
"ITS"
,
"FDD"
,
"FT0"
,
"FV0"
,
"MFT"
,
"MID"
,
"DCS"
,
"FOC"
,
// 39
89
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
// 49
90
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
// 59
91
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"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
,
"NIL"
,
// 189
104
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
// 199
105
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
// 209
106
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
// 219
107
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
// 229
108
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
// 239
109
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
// 249
110
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"NIL"
,
"UNL"
// 255
111
};
112
113
static
constexpr
bool
isSameOrigin(
o2::header::DataOrigin
origin,
ID
id
)
114
{
115
for
(
auto
i
=
sizeof
(
o2::header::DataOrigin
);
i
--;) {
116
if
(MAP_DAQtoO2[
id
].
str
[
i
] != origin.
str
[
i
]) {
117
return
false
;
118
}
119
}
120
return
true
;
121
}
122
123
static
constexpr
ID
or2daq(
o2::header::DataOrigin
origin,
ID
id
)
124
{
125
return
(
id
>
MAXDAQ
) ? (isSameOrigin(origin,
UNLOADED
) ?
UNLOADED
:
INVALID
) : (isSameOrigin(
origin
,
id
) ?
id
: or2daq(
origin
,
id
+ 1));
126
}
127
};
128
129
}
// namespace header
130
}
// namespace o2
131
132
#endif
DataHeader.h
i
int32_t i
Definition
GPUCommonAlgorithm.h:443
o2::header::DAQID
Definition
DAQID.h:29
o2::header::DAQID::MINDAQ
static constexpr ID MINDAQ
Definition
DAQID.h:55
o2::header::DAQID::HMP
static constexpr ID HMP
Definition
DAQID.h:37
o2::header::DAQID::FV0
static constexpr ID FV0
Definition
DAQID.h:49
o2::header::DAQID::DAQtoO2
static constexpr o2::header::DataOrigin DAQtoO2(ID daq)
Definition
DAQID.h:65
o2::header::DAQID::ITS
static constexpr ID ITS
Definition
DAQID.h:46
o2::header::DAQID::PHS
static constexpr ID PHS
Definition
DAQID.h:38
o2::header::DAQID::CPV
static constexpr ID CPV
Definition
DAQID.h:39
o2::header::DAQID::TPC
static constexpr ID TPC
Definition
DAQID.h:34
o2::header::DAQID::INVALID
static constexpr ID INVALID
Definition
DAQID.h:40
o2::header::DAQID::MAXDAQ
static constexpr ID MAXDAQ
Definition
DAQID.h:56
o2::header::DAQID::TRG
static constexpr ID TRG
Definition
DAQID.h:43
o2::header::DAQID::FOC
static constexpr ID FOC
Definition
DAQID.h:53
o2::header::DAQID::MID
static constexpr ID MID
Definition
DAQID.h:51
o2::header::DAQID::TRD
static constexpr ID TRD
Definition
DAQID.h:35
o2::header::DAQID::DAQID
DAQID(ID i)
Definition
DAQID.h:59
o2::header::DAQID::FDD
static constexpr ID FDD
Definition
DAQID.h:47
o2::header::DAQID::TOF
static constexpr ID TOF
Definition
DAQID.h:36
o2::header::DAQID::ZDC
static constexpr ID ZDC
Definition
DAQID.h:42
o2::header::DAQID::EMC
static constexpr ID EMC
Definition
DAQID.h:44
o2::header::DAQID::FT0
static constexpr ID FT0
Definition
DAQID.h:48
o2::header::DAQID::DCS
static constexpr ID DCS
Definition
DAQID.h:52
o2::header::DAQID::UNLOADED
static constexpr ID UNLOADED
Definition
DAQID.h:54
o2::header::DAQID::ID
std::uint8_t ID
Definition
DAQID.h:32
o2::header::DAQID::O2toDAQ
static constexpr ID O2toDAQ(o2::header::DataOrigin o2orig)
Definition
DAQID.h:70
o2::header::DAQID::MCH
static constexpr ID MCH
Definition
DAQID.h:41
o2::header::DAQID::TST
static constexpr ID TST
Definition
DAQID.h:45
o2::header::DAQID::MFT
static constexpr ID MFT
Definition
DAQID.h:50
o2::header::DAQID::getID
ID getID() const
Definition
DAQID.h:62
o2::header::DAQID::getO2Origin
constexpr o2::header::DataOrigin getO2Origin()
Definition
DAQID.h:63
o2::header::DAQID::DAQID
DAQID()
Definition
DAQID.h:58
id
GLuint id
Definition
glcorearb.h:650
o2::aod::origin
consteval header::DataOrigin origin()
Definition
ASoA.h:345
o2::header::gDataOriginUnloaded
constexpr o2::header::DataOrigin gDataOriginUnloaded
Source IDs used by DAQ.
Definition
DAQID.h:26
o2
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Definition
BitstreamReader.h:24
o2::header::Descriptor< gSizeDataOriginString >
o2::header::Descriptor::str
char str[N]
Definition
DataHeader.h:217
str
const std::string str
Definition
test_ransEncodeDecode.cxx:37
DataFormats
Headers
include
Headers
DAQID.h
Generated on Tue Feb 25 2025 17:02:53 for Project by
1.9.8