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 
6 /*
7  * FRD File Header optionally found at the beginning of the FRD RAW file
8  *
9  * Version 1 Format:
10  * uint8_t [4] - id contanining 4 characters: 0x52, 0x41, 0x57, 0x5f "RAW_"
11  * uint8_t [4] - version string 4 characters: 0x30, 0x30, 0x30, 0x31 "0001"
12  * uint16_t - header size: 24
13  * uint16_t - number of events in the RAW file
14  * uint32_t - lumisection
15  * uint64_t - total size of the raw file (including header)
16  *
17  * */
18 
19 constexpr std::array<unsigned char, 4> FRDFileHeader_id{{0x52, 0x41, 0x57, 0x5f}};
20 constexpr std::array<unsigned char, 4> FRDFileVersion_1{{0x30, 0x30, 0x30, 0x31}};
21 
23  FRDFileHeader_v1() = default;
24 
25  FRDFileHeader_v1(uint16_t eventCount, uint32_t lumiSection, uint64_t fileSize)
29  eventCount_(eventCount),
30  lumiSection_(lumiSection),
31  fileSize_(fileSize) {}
32 
33  std::array<uint8_t, 4> id_;
34  std::array<uint8_t, 4> version_;
35  uint16_t headerSize_;
36  uint16_t eventCount_;
37  uint32_t lumiSection_;
39 };
40 
41 inline uint16_t getFRDFileHeaderVersion(const std::array<uint8_t, 4>& id, const std::array<uint8_t, 4>& version) {
42  size_t i;
43  for (i = 0; i < 4; i++)
44  if (id[i] != FRDFileHeader_id[i])
45  return 0; //not FRD file header
46  uint16_t ret = 0;
47  for (i = 0; i < 4; i++) {
48  if (version[i] > '9' || version[i] < '0')
49  return 0; //NaN sequence
50  ret = ret * 10 + (uint16_t)(version[i] - '0');
51  }
52  return ret;
53 }
54 
55 #endif
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
FRDFileHeader_v1::lumiSection_
uint32_t lumiSection_
Definition: FRDFileHeader.h:37
mps_fire.i
i
Definition: mps_fire.py:355
getFRDFileHeaderVersion
uint16_t getFRDFileHeaderVersion(const std::array< uint8_t, 4 > &id, const std::array< uint8_t, 4 > &version)
Definition: FRDFileHeader.h:41
FRDFileHeader_v1::headerSize_
uint16_t headerSize_
Definition: FRDFileHeader.h:35
FRDFileHeader_v1::id_
std::array< uint8_t, 4 > id_
Definition: FRDFileHeader.h:33
FRDFileHeader_v1::eventCount_
uint16_t eventCount_
Definition: FRDFileHeader.h:36
FRDFileHeader_v1::FRDFileHeader_v1
FRDFileHeader_v1(uint16_t eventCount, uint32_t lumiSection, uint64_t fileSize)
Definition: FRDFileHeader.h:25
FRDFileVersion_1
constexpr std::array< unsigned char, 4 > FRDFileVersion_1
Definition: FRDFileHeader.h:20
FRDFileHeader_v1::version_
std::array< uint8_t, 4 > version_
Definition: FRDFileHeader.h:34
FRDFileHeader_v1
Definition: FRDFileHeader.h:22
FRDFileHeader_v1::FRDFileHeader_v1
FRDFileHeader_v1()=default
FRDFileHeader_v1::fileSize_
uint64_t fileSize_
Definition: FRDFileHeader.h:38
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:19