CMS 3D CMS Logo

FRDEventMessage.cc
Go to the documentation of this file.
1 
13 
18  : buf_((uint8*)buf),
19  payload_(0),
20  size_(0),
21  version_(0),
22  run_(0),
23  lumi_(0),
24  event_(0),
25  eventSize_(0),
26  paddingSize_(0),
27  adler32_(0),
28  crc32c_(0)
29 {
30  uint32* bufPtr = static_cast<uint32*>(buf);
31  version_ = *bufPtr;
32  // if the version number is rather large, then we assume that the true
33  // version number is one. (In version one of the format, there was
34  // no version number in the data, and the run number appeared first.)
35  if (version_ >= 32) {
36  version_ = 1;
37  }
38 
39  size_ = 0;
40 
41  // version number
42  if (version_ >= 2) {
43  size_ += sizeof(uint32);
44  ++bufPtr;
45  }
46 
47  // run number
48  run_ = *bufPtr;
49  size_ += sizeof(uint32);
50  ++bufPtr;
51 
52  // lumi number
53  if (version_ >= 2) {
54  lumi_ = *bufPtr;
55  size_ += sizeof(uint32);
56  ++bufPtr;
57  }
58 
59  // event number
60  if (version_ == 4) {
61  uint64 eventLow = *bufPtr;
62  size_ += sizeof(uint32);
63  ++bufPtr;
64 
65  uint64 eventHigh = *bufPtr;
66  size_ += sizeof(uint32);
67  ++bufPtr;
68 
69  event_ = (eventHigh << 32) | eventLow;
70 
71  } else {
72  event_ = *bufPtr;
73  size_ += sizeof(uint32);
74  ++bufPtr;
75  }
76 
77  if (version_ >= 3) {
78  // event size
79  eventSize_ = *bufPtr;
80  size_ += sizeof(uint32) + eventSize_;
81  ++bufPtr;
82 
83  if (version_ >= 5) {
84  crc32c_ = *bufPtr;
85  size_ += sizeof(uint32);
86  ++bufPtr;
87  }
88  else {
89  // padding size up to V4
90  paddingSize_ = *bufPtr;
91  size_ += sizeof(uint32) + paddingSize_;
92  ++bufPtr;
93 
94  adler32_ = *bufPtr;
95  size_ += sizeof(uint32);
96  ++bufPtr;
97  }
98  }
99  else {
100  for (int idx = 0; idx < 1024; idx++) {
101  size_ += sizeof(uint32); // FED N size
102  size_ += *bufPtr; // FED N data
103  eventSize_ += *bufPtr;
104  ++bufPtr;
105  }
106  }
107 
108  payload_ = (void*)bufPtr;
109 }
FRDEventMsgView(void *buf)
unsigned int uint32
Definition: MsgTools.h:13
unsigned long long uint64
Definition: MsgTools.h:14
unsigned char uint8
Definition: MsgTools.h:11
void event_()