CMS 3D CMS Logo

Phase2TrackerFEDDAQHeader.cc
Go to the documentation of this file.
1 #include <iomanip>
2 #include <ostream>
4 
5 namespace Phase2Tracker {
6 
7  std::ostream& operator<<(std::ostream& os, const FEDDAQEventType& value) {
8  switch (value) {
10  os << "Physics trigger";
11  break;
13  os << "Calibration trigger";
14  break;
16  os << "Test trigger";
17  break;
19  os << "Technical trigger";
20  break;
22  os << "Simulated event";
23  break;
25  os << "Traced event";
26  break;
28  os << "Error";
29  break;
31  os << "Unknown";
32  break;
33  default:
34  os << "Unrecognized";
35  os << " (";
36  printHexValue(value, os);
37  os << ")";
38  break;
39  }
40  return os;
41  }
42 
44  switch (eventTypeNibble()) {
53  default:
55  }
56  }
57 
58  void FEDDAQHeader::setEventType(const FEDDAQEventType evtType) { header_[7] = ((header_[7] & 0xF0) | evtType); }
59 
60  void FEDDAQHeader::setL1ID(const uint32_t l1ID) {
61  header_[4] = (l1ID & 0x000000FF);
62  header_[5] = ((l1ID & 0x0000FF00) >> 8);
63  header_[6] = ((l1ID & 0x00FF0000) >> 16);
64  }
65 
66  void FEDDAQHeader::setBXID(const uint16_t bxID) {
67  header_[3] = ((bxID & 0x0FF0) >> 4);
68  header_[2] = ((header_[2] & 0x0F) | ((bxID & 0x000F) << 4));
69  }
70 
71  void FEDDAQHeader::setSourceID(const uint16_t sourceID) {
72  header_[2] = ((header_[2] & 0xF0) | ((sourceID & 0x0F00) >> 8));
73  header_[1] = (sourceID & 0x00FF);
74  }
75 
76  FEDDAQHeader::FEDDAQHeader(const uint32_t l1ID,
77  const uint16_t bxID,
78  const uint16_t sourceID,
79  const FEDDAQEventType evtType) {
80  //clear everything (FOV,H,x,$ all set to 0)
81  memset(header_, 0x0, 8);
82  //set the BoE nibble to indicate this is the last fragment
83  header_[7] = 0x50;
84  //set variable fields vith values supplied
85  setEventType(evtType);
86  setL1ID(l1ID);
87  setBXID(bxID);
89  }
90 
91 } // namespace Phase2Tracker
std::ostream & operator<<(std::ostream &os, const FEDDAQEventType &value)
void setBXID(const uint16_t bxID)
void setSourceID(const uint16_t sourceID)
Definition: value.py:1
void printHexValue(const uint8_t value, std::ostream &os)
Definition: utils.h:43
void setEventType(const FEDDAQEventType evtType)
void setL1ID(const uint32_t l1ID)