test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  {
9  switch (value) {
11  os << "Physics trigger";
12  break;
14  os << "Calibration trigger";
15  break;
17  os << "Test trigger";
18  break;
20  os << "Technical trigger";
21  break;
23  os << "Simulated event";
24  break;
26  os << "Traced event";
27  break;
29  os << "Error";
30  break;
32  os << "Unknown";
33  break;
34  default:
35  os << "Unrecognized";
36  os << " (";
37  printHexValue(value,os);
38  os << ")";
39  break;
40  }
41  return os;
42  }
43 
45  {
46  switch(eventTypeNibble()) {
55  default:
57  }
58  }
59 
61  {
62  header_[7] = ((header_[7] & 0xF0) | evtType);
63  }
64 
65  void FEDDAQHeader::setL1ID(const uint32_t l1ID)
66  {
67  header_[4] = (l1ID & 0x000000FF);
68  header_[5] = ( (l1ID & 0x0000FF00) >> 8);
69  header_[6] = ( (l1ID & 0x00FF0000) >> 16);
70  }
71 
72  void FEDDAQHeader::setBXID(const uint16_t bxID)
73  {
74  header_[3] = ( (bxID & 0x0FF0) >> 4);
75  header_[2] = ( (header_[2] & 0x0F) | ( (bxID & 0x000F) << 4) );
76  }
77 
78  void FEDDAQHeader::setSourceID(const uint16_t sourceID)
79  {
80  header_[2] = ( (header_[2] & 0xF0) | ( (sourceID & 0x0F00) >> 8) );
81  header_[1] = (sourceID & 0x00FF);
82  }
83 
84  FEDDAQHeader::FEDDAQHeader(const uint32_t l1ID, const uint16_t bxID, const uint16_t sourceID, const FEDDAQEventType evtType)
85  {
86  //clear everything (FOV,H,x,$ all set to 0)
87  memset(header_,0x0,8);
88  //set the BoE nibble to indicate this is the last fragment
89  header_[7] = 0x50;
90  //set variable fields vith values supplied
91  setEventType(evtType);
92  setL1ID(l1ID);
93  setBXID(bxID);
94  setSourceID(sourceID);
95  }
96 
97 } // end of Phase2Tracker namespace
98 
std::ostream & operator<<(std::ostream &os, const FEDDAQEventType &value)
void setBXID(const uint16_t bxID)
void setSourceID(const uint16_t sourceID)
FEDDAQEventType eventType() const
void printHexValue(const uint8_t value, std::ostream &os)
Definition: utils.h:43
void setEventType(const FEDDAQEventType evtType)
void setL1ID(const uint32_t l1ID)