CMS 3D CMS Logo

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 
25  FRDFileHeader_v1() = default;
26 
27  FRDFileHeader_v1(uint16_t eventCount, uint32_t lumiSection, uint64_t fileSize)
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_;
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
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
FRDFileHeader_v1::lumiSection_
uint32_t lumiSection_
Definition: FRDFileHeader.h:39
mps_fire.i
i
Definition: mps_fire.py:428
getFRDFileHeaderVersion
uint16_t getFRDFileHeaderVersion(const std::array< uint8_t, 4 > &id, const std::array< uint8_t, 4 > &version)
Definition: FRDFileHeader.h:43
FRDFileHeader_v1::headerSize_
uint16_t headerSize_
Definition: FRDFileHeader.h:37
FRDFileHeader_v1::id_
std::array< uint8_t, 4 > id_
Definition: FRDFileHeader.h:35
FRDFileHeader_v1::eventCount_
uint16_t eventCount_
Definition: FRDFileHeader.h:38
FRDFileHeader_v1::FRDFileHeader_v1
FRDFileHeader_v1(uint16_t eventCount, uint32_t lumiSection, uint64_t fileSize)
Definition: FRDFileHeader.h:27
FRDFileVersion_1
constexpr std::array< unsigned char, 4 > FRDFileVersion_1
Definition: FRDFileHeader.h:22
FRDFileHeader_v1::version_
std::array< uint8_t, 4 > version_
Definition: FRDFileHeader.h:36
FRDFileHeader_v1
Definition: FRDFileHeader.h:24
FRDFileHeader_v1::FRDFileHeader_v1
FRDFileHeader_v1()=default
FRDFileHeader_v1::fileSize_
uint64_t fileSize_
Definition: FRDFileHeader.h:40
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
FRDFileHeader_id
constexpr std::array< unsigned char, 4 > FRDFileHeader_id
Definition: FRDFileHeader.h:21