src
IOPool
Streamer
interface
FRDFileHeader.h
Go to the documentation of this file.
1
#ifndef IOPool_Streamer_FRDFileHeader_h
2
#define IOPool_Streamer_FRDFileHeader_h
3
4
#include <array>
5
#include <cstddef>
6
#include <cstdint>
7
8
/*
9
* FRD File Header optionally found at the beginning of the FRD RAW file
10
*
11
* Version 1 Format:
12
* uint8_t [4] - id contanining 4 characters: 0x52, 0x41, 0x57, 0x5f "RAW_"
13
* uint8_t [4] - version string 4 characters: 0x30, 0x30, 0x30, 0x31 "0001"
14
* uint16_t - header size: 24
15
* uint16_t - number of events in the RAW file
16
* uint32_t - lumisection
17
* uint64_t - total size of the raw file (including header)
18
*
19
* */
20
21
constexpr
std::array<unsigned char, 4>
FRDFileHeader_id
{{0x52, 0x41, 0x57, 0x5f}};
22
constexpr
std::array<unsigned char, 4>
FRDFileVersion_1
{{0x30, 0x30, 0x30, 0x31}};
23
constexpr
std::array<unsigned char, 4>
FRDFileVersion_2
{{0x30, 0x30, 0x30, 0x32}};
24
25
struct
FRDFileHeaderIdentifier
{
26
FRDFileHeaderIdentifier
(
const
std::array<uint8_t, 4>&
id
,
const
std::array<uint8_t, 4>&
version
)
27
:
id_
(
id
),
version_
(
version
) {}
28
29
std::array<uint8_t, 4>
id_
;
30
std::array<uint8_t, 4>
version_
;
31
};
32
33
struct
FRDFileHeaderContent_v1
{
34
FRDFileHeaderContent_v1
(uint16_t eventCount, uint32_t lumiSection,
uint64_t
fileSize)
35
:
headerSize_
(sizeof(
FRDFileHeaderContent_v1
) + sizeof(
FRDFileHeaderIdentifier
)),
36
eventCount_
(eventCount),
37
lumiSection_
(lumiSection),
38
fileSize_
(fileSize) {}
39
40
uint16_t
headerSize_
;
41
uint16_t
eventCount_
;
42
uint32_t
lumiSection_
;
43
uint64_t
fileSize_
;
44
};
45
46
struct
FRDFileHeader_v1
{
47
FRDFileHeader_v1
(uint16_t eventCount, uint32_t lumiSection,
uint64_t
fileSize)
48
:
id_
(
FRDFileHeader_id
,
FRDFileVersion_1
),
c_
(eventCount, lumiSection, fileSize) {}
49
50
FRDFileHeaderIdentifier
id_
;
51
FRDFileHeaderContent_v1
c_
;
52
};
53
54
struct
FRDFileHeaderContent_v2
{
55
FRDFileHeaderContent_v2
(
56
uint16_t
dataType
, uint16_t eventCount, uint32_t
runNumber
, uint32_t lumiSection,
uint64_t
fileSize)
57
:
headerSize_
(sizeof(
FRDFileHeaderContent_v2
) + sizeof(
FRDFileHeaderIdentifier
)),
58
dataType_
(
dataType
),
59
eventCount_
(eventCount),
60
runNumber_
(
runNumber
),
61
lumiSection_
(lumiSection),
62
fileSize_
(fileSize) {}
63
64
uint16_t
headerSize_
;
65
uint16_t
dataType_
;
66
uint32_t
eventCount_
;
67
uint32_t
runNumber_
;
68
uint32_t
lumiSection_
;
69
uint64_t
fileSize_
;
70
};
71
72
struct
FRDFileHeader_v2
{
73
FRDFileHeader_v2
(uint16_t
dataType
, uint16_t eventCount, uint32_t
runNumber
, uint32_t lumiSection,
uint64_t
fileSize)
74
:
id_
(
FRDFileHeader_id
,
FRDFileVersion_2
),
c_
(
dataType
, eventCount,
runNumber
, lumiSection, fileSize) {}
75
76
FRDFileHeaderIdentifier
id_
;
77
FRDFileHeaderContent_v2
c_
;
78
};
79
80
inline
uint16_t
getFRDFileHeaderVersion
(
const
std::array<uint8_t, 4>&
id
,
const
std::array<uint8_t, 4>&
version
) {
81
size_t
i
;
82
for
(
i
= 0;
i
< 4;
i
++)
83
if
(
id
[
i
] !=
FRDFileHeader_id
[
i
])
84
return
0;
//not FRD file header
85
uint16_t
ret
= 0;
86
for
(
i
= 0;
i
< 4;
i
++) {
87
if
(
version
[
i
] >
'9'
||
version
[
i
] <
'0'
)
88
return
0;
//NaN sequence
89
ret
=
ret
* 10 + (uint16_t)(
version
[
i
] -
'0'
);
90
}
91
return
ret
;
92
}
93
94
#endif
getFRDFileHeaderVersion
uint16_t getFRDFileHeaderVersion(const std::array< uint8_t, 4 > &id, const std::array< uint8_t, 4 > &version)
Definition:
FRDFileHeader.h:80
FRDFileHeader_v1::id_
FRDFileHeaderIdentifier id_
Definition:
FRDFileHeader.h:50
mps_fire.i
i
Definition:
mps_fire.py:429
FRDFileHeaderContent_v2::runNumber_
uint32_t runNumber_
Definition:
FRDFileHeader.h:67
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition:
runTheMatrix.py:759
FRDFileHeader_v1::FRDFileHeader_v1
FRDFileHeader_v1(uint16_t eventCount, uint32_t lumiSection, uint64_t fileSize)
Definition:
FRDFileHeader.h:47
FRDFileHeaderContent_v2
Definition:
FRDFileHeader.h:54
l1ctLayer2EG_cff.id
id
Definition:
l1ctLayer2EG_cff.py:85
ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr
if constexpr(n > 3)
Definition:
BrokenLine.h:164
FRDFileHeaderIdentifier::FRDFileHeaderIdentifier
FRDFileHeaderIdentifier(const std::array< uint8_t, 4 > &id, const std::array< uint8_t, 4 > &version)
Definition:
FRDFileHeader.h:26
FRDFileHeaderContent_v1::FRDFileHeaderContent_v1
FRDFileHeaderContent_v1(uint16_t eventCount, uint32_t lumiSection, uint64_t fileSize)
Definition:
FRDFileHeader.h:34
FRDFileHeaderContent_v1::fileSize_
uint64_t fileSize_
Definition:
FRDFileHeader.h:43
FRDFileHeaderIdentifier::id_
std::array< uint8_t, 4 > id_
Definition:
FRDFileHeader.h:29
FRDFileHeader_v2::FRDFileHeader_v2
FRDFileHeader_v2(uint16_t dataType, uint16_t eventCount, uint32_t runNumber, uint32_t lumiSection, uint64_t fileSize)
Definition:
FRDFileHeader.h:73
FRDFileHeader_v2
Definition:
FRDFileHeader.h:72
FRDFileHeaderContent_v2::lumiSection_
uint32_t lumiSection_
Definition:
FRDFileHeader.h:68
FRDFileHeaderContent_v1::headerSize_
uint16_t headerSize_
Definition:
FRDFileHeader.h:40
FRDFileHeaderIdentifier
Definition:
FRDFileHeader.h:25
FRDFileVersion_2
constexpr std::array< unsigned char, 4 > FRDFileVersion_2
Definition:
FRDFileHeader.h:23
FRDFileHeader_id
constexpr std::array< unsigned char, 4 > FRDFileHeader_id
Definition:
FRDFileHeader.h:21
BeamSplash_cfg.version
version
Definition:
BeamSplash_cfg.py:45
FRDFileHeaderIdentifier::version_
std::array< uint8_t, 4 > version_
Definition:
FRDFileHeader.h:30
convertSQLiteXML.runNumber
runNumber
Definition:
convertSQLiteXML.py:91
FRDFileHeader_v1
Definition:
FRDFileHeader.h:46
FRDFileHeader_v2::c_
FRDFileHeaderContent_v2 c_
Definition:
FRDFileHeader.h:77
cond::uint64_t
unsigned long long uint64_t
Definition:
Time.h:13
FRDFileHeaderContent_v1::eventCount_
uint16_t eventCount_
Definition:
FRDFileHeader.h:41
DTskim_cfg.dataType
dataType
Definition:
DTskim_cfg.py:56
FRDFileHeaderContent_v2::headerSize_
uint16_t headerSize_
Definition:
FRDFileHeader.h:64
FRDFileHeaderContent_v2::dataType_
uint16_t dataType_
Definition:
FRDFileHeader.h:65
FRDFileHeaderContent_v2::fileSize_
uint64_t fileSize_
Definition:
FRDFileHeader.h:69
FRDFileVersion_1
constexpr std::array< unsigned char, 4 > FRDFileVersion_1
Definition:
FRDFileHeader.h:22
FRDFileHeader_v2::id_
FRDFileHeaderIdentifier id_
Definition:
FRDFileHeader.h:76
FRDFileHeader_v1::c_
FRDFileHeaderContent_v1 c_
Definition:
FRDFileHeader.h:51
FRDFileHeaderContent_v2::eventCount_
uint32_t eventCount_
Definition:
FRDFileHeader.h:66
FRDFileHeaderContent_v1
Definition:
FRDFileHeader.h:33
FRDFileHeaderContent_v2::FRDFileHeaderContent_v2
FRDFileHeaderContent_v2(uint16_t dataType, uint16_t eventCount, uint32_t runNumber, uint32_t lumiSection, uint64_t fileSize)
Definition:
FRDFileHeader.h:55
FRDFileHeaderContent_v1::lumiSection_
uint32_t lumiSection_
Definition:
FRDFileHeader.h:42
Generated for CMSSW Reference Manual by
1.8.14