CMS 3D CMS Logo

FRDEventMessage.cc
Go to the documentation of this file.
1 
14 
19  : buf_((uint8*)buf),
20  payload_(nullptr),
21  size_(0),
22  version_(0),
23  flags_(0),
24  run_(0),
25  lumi_(0),
26  event_(0),
27  eventSize_(0),
28  paddingSize_(0),
29  adler32_(0),
30  crc32c_(0) {
31  uint32* bufPtr = static_cast<uint32*>(buf);
32 
33  // In version one of the format, there was no version number in the data,
34  // and the run number (32-bit) appeared first.
35  // This format is no longer supported
36  version_ = *(uint16*)bufPtr;
37 
38  if (version_ < 2 || version_ > 6) {
39  throw cms::Exception("FRDEventMsgView") << "FRD version " << version_ << " is not supported";
40  }
41 
42  // Version 6 repurposes unused high 16-bits of 32-bit version
43  // assuming we no longer need version 1 support
44  flags_ = *((uint16*)bufPtr + 1);
45 
46  if (version_ < 6 && flags_) {
47  throw cms::Exception("FRDEventMsgView") << "FRD flags can not be used in version " << version_;
48  }
49 
50  size_ = sizeof(uint32);
51  ++bufPtr;
52 
53  // run number
54  run_ = *bufPtr;
55  size_ += sizeof(uint32);
56  ++bufPtr;
57 
58  // lumi number
59  if (version_ >= 2) {
60  lumi_ = *bufPtr;
61  size_ += sizeof(uint32);
62  ++bufPtr;
63  }
64 
65  // event number
66  if (version_ == 4) {
67  uint64 eventLow = *bufPtr;
68  size_ += sizeof(uint32);
69  ++bufPtr;
70 
71  uint64 eventHigh = *bufPtr;
72  size_ += sizeof(uint32);
73  ++bufPtr;
74 
75  event_ = (eventHigh << 32) | eventLow;
76 
77  } else {
78  event_ = *bufPtr;
79  size_ += sizeof(uint32);
80  ++bufPtr;
81  }
82 
83  if (version_ >= 3) {
84  // event size
85  eventSize_ = *bufPtr;
86  size_ += sizeof(uint32) + eventSize_;
87  ++bufPtr;
88 
89  if (version_ >= 5) {
90  crc32c_ = *bufPtr;
91  size_ += sizeof(uint32);
92  ++bufPtr;
93  } else {
94  // padding size up to V4
95  paddingSize_ = *bufPtr;
96  size_ += sizeof(uint32) + paddingSize_;
97  ++bufPtr;
98 
99  adler32_ = *bufPtr;
100  size_ += sizeof(uint32);
101  ++bufPtr;
102  }
103  } else {
104  for (int idx = 0; idx < 1024; idx++) {
105  size_ += sizeof(uint32); // FED N size
106  size_ += *bufPtr; // FED N data
107  eventSize_ += *bufPtr;
108  ++bufPtr;
109  }
110  }
111 
112  payload_ = (void*)bufPtr;
113 }
FRDEventMsgView::flags_
uint16 flags_
Definition: FRDEventMessage.h:162
uint8
unsigned char uint8
Definition: MsgTools.h:11
FRDEventMsgView::run_
uint32 run_
Definition: FRDEventMessage.h:163
FRDEventMsgView::paddingSize_
uint32 paddingSize_
Definition: FRDEventMessage.h:167
FRDEventMessage.h
uint32
unsigned int uint32
Definition: MsgTools.h:13
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
FRDEventMsgView::event_
uint64 event_
Definition: FRDEventMessage.h:165
uint16
unsigned short uint16
Definition: MsgTools.h:12
FRDEventMsgView::version_
uint16 version_
Definition: FRDEventMessage.h:161
event_
void event_()
FRDEventMsgView::FRDEventMsgView
FRDEventMsgView(void *buf)
Definition: FRDEventMessage.cc:18
FRDEventMsgView::payload_
void * payload_
Definition: FRDEventMessage.h:159
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
FRDEventMsgView::lumi_
uint32 lumi_
Definition: FRDEventMessage.h:164
FRDEventMsgView::crc32c_
uint32 crc32c_
Definition: FRDEventMessage.h:169
Exception
Definition: hltDiff.cc:246
uint64
unsigned long long uint64
Definition: MsgTools.h:14
FRDEventMsgView::size_
uint32 size_
Definition: FRDEventMessage.h:160
Exception.h
FRDEventMsgView::adler32_
uint32 adler32_
Definition: FRDEventMessage.h:168
FRDEventMsgView::eventSize_
uint32 eventSize_
Definition: FRDEventMessage.h:166