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
24
struct
FRDFileHeader_v1
{
25
FRDFileHeader_v1
() =
default
;
26
27
FRDFileHeader_v1
(uint16_t eventCount, uint32_t lumiSection,
uint64_t
fileSize)
28
:
id_
{
FRDFileHeader_id
},
29
version_
{
FRDFileVersion_1
},
30
headerSize_
(
sizeof
(
FRDFileHeader_v1
)),
31
eventCount_
(eventCount),
32
lumiSection_
(lumiSection),
33
fileSize_
(fileSize) {}
34
35
std::array<uint8_t, 4>
id_
;
36
std::array<uint8_t, 4>
version_
;
37
uint16_t
headerSize_
;
38
uint16_t
eventCount_
;
39
uint32_t
lumiSection_
;
40
uint64_t
fileSize_
;
41
};
42
43
inline
uint16_t
getFRDFileHeaderVersion
(
const
std::array<uint8_t, 4>&
id
,
const
std::array<uint8_t, 4>&
version
) {
44
size_t
i
;
45
for
(
i
= 0;
i
< 4;
i
++)
46
if
(
id
[
i
] !=
FRDFileHeader_id
[
i
])
47
return
0;
//not FRD file header
48
uint16_t
ret
= 0;
49
for
(
i
= 0;
i
< 4;
i
++) {
50
if
(
version
[
i
] >
'9'
||
version
[
i
] <
'0'
)
51
return
0;
//NaN sequence
52
ret
=
ret
* 10 + (uint16_t)(
version
[
i
] -
'0'
);
53
}
54
return
ret
;
55
}
56
57
#endif
getFRDFileHeaderVersion
uint16_t getFRDFileHeaderVersion(const std::array< uint8_t, 4 > &id, const std::array< uint8_t, 4 > &version)
Definition:
FRDFileHeader.h:43
mps_fire.i
i
Definition:
mps_fire.py:428
FRDFileHeader_v1::FRDFileHeader_v1
FRDFileHeader_v1()=default
FRDFileHeader_v1::eventCount_
uint16_t eventCount_
Definition:
FRDFileHeader.h:38
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition:
runTheMatrix.py:604
FRDFileHeader_v1::FRDFileHeader_v1
FRDFileHeader_v1(uint16_t eventCount, uint32_t lumiSection, uint64_t fileSize)
Definition:
FRDFileHeader.h:27
FRDFileHeader_v1::headerSize_
uint16_t headerSize_
Definition:
FRDFileHeader.h:37
FRDFileHeader_v1::id_
std::array< uint8_t, 4 > id_
Definition:
FRDFileHeader.h:35
FRDFileHeader_id
constexpr std::array< unsigned char, 4 > FRDFileHeader_id
Definition:
FRDFileHeader.h:21
BeamSplash_cfg.version
version
Definition:
BeamSplash_cfg.py:45
FRDFileHeader_v1::version_
std::array< uint8_t, 4 > version_
Definition:
FRDFileHeader.h:36
FRDFileHeader_v1
Definition:
FRDFileHeader.h:24
cond::uint64_t
unsigned long long uint64_t
Definition:
Time.h:13
FRDFileVersion_1
constexpr std::array< unsigned char, 4 > FRDFileVersion_1
Definition:
FRDFileHeader.h:22
FRDFileHeader_v1::fileSize_
uint64_t fileSize_
Definition:
FRDFileHeader.h:40
FRDFileHeader_v1::lumiSection_
uint32_t lumiSection_
Definition:
FRDFileHeader.h:39
Generated for CMSSW Reference Manual by
1.8.14