CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Phase2Tracker::Phase2TrackerFEDHeader Class Reference

#include <Phase2TrackerFEDHeader.h>

Public Member Functions

std::vector< uint8_t > CBCStatus () const
 
std::vector< bool > frontendStatus () const
 
uint8_t getConditionData () const
 
uint8_t getDataFormatVersion () const
 
uint8_t getDataType () const
 
READ_MODE getDebugMode () const
 
uint8_t getEventType () const
 
uint64_t getGlibStatusCode () const
 
uint16_t getNumberOfCBC () const
 
const uint8_t * getPointerToData () const
 
FEDReadoutMode getReadoutMode () const
 
uint8_t getTrackerHeaderSize () const
 
 Phase2TrackerFEDHeader ()
 
 Phase2TrackerFEDHeader (const uint8_t *headerPointer)
 

Private Member Functions

uint8_t conditionData () const
 
uint8_t dataFormatVersion () const
 
uint8_t dataType () const
 
READ_MODE debugMode () const
 
uint8_t eventType () const
 
uint64_t glibStatusCode () const
 
void init ()
 
uint16_t numberOfCBC () const
 
const uint8_t * pointerToData ()
 
FEDReadoutMode readoutMode () const
 

Private Attributes

uint8_t conditionData_
 
uint8_t dataFormatVersion_
 
uint8_t dataType_
 
READ_MODE debugMode_
 
uint8_t eventType_
 
uint64_t glibStatusCode_
 
uint64_t header_first_word_
 
uint64_t header_second_word_
 
uint16_t numberOfCBC_
 
const uint8_t * pointerToData_
 
FEDReadoutMode readoutMode_
 
const uint8_t * trackerHeader_
 
uint8_t trackerHeaderSize_
 

Detailed Description

Definition at line 12 of file Phase2TrackerFEDHeader.h.

Constructor & Destructor Documentation

Phase2Tracker::Phase2TrackerFEDHeader::Phase2TrackerFEDHeader ( )
inline

Definition at line 15 of file Phase2TrackerFEDHeader.h.

15 {}
Phase2Tracker::Phase2TrackerFEDHeader::Phase2TrackerFEDHeader ( const uint8_t *  headerPointer)
explicit

Definition at line 9 of file Phase2TrackerFEDHeader.cc.

References header_first_word_, header_second_word_, init(), Phase2Tracker::read64(), and trackerHeader_.

10  : trackerHeader_(headerPointer)
11  {
14  // decode the Tracker Header and store info
15  init();
16  }
uint64_t read64(int offset, const uint8_t *buffer)
Definition: utils.h:197

Member Function Documentation

std::vector< uint8_t > Phase2Tracker::Phase2TrackerFEDHeader::CBCStatus ( ) const

Definition at line 150 of file Phase2TrackerFEDHeader.cc.

References Phase2Tracker::CBC_ERROR, debugMode_, Phase2Tracker::FULL_DEBUG, header_second_word_, numberOfCBC(), hltrates_dqm_sourceclient-live_cfg::offset, Phase2Tracker::read64(), and trackerHeader_.

Referenced by Phase2Tracker::Phase2TrackerDigiProducer::produce().

151  {
152  // set offset and data to begining of second header 64 bit word
153  int offset = 8;
154  uint64_t data64 = header_second_word_;
155  // number of CBC:
156  uint16_t cbc_num = numberOfCBC();
157  // size of data per CBC (in bits)
158  int status_size = 0;
159  if (debugMode_==FULL_DEBUG)
160  {
161  status_size = 8;
162  }
163  else if (debugMode_==CBC_ERROR)
164  {
165  status_size = 1;
166  }
167  // starting byte for CBC status bits
168  std::vector<uint8_t> cbc_status;
169  if (status_size==8)
170  {
171  int num_bytes = cbc_num;
172  int current_byte = 5;
173  while(num_bytes>0)
174  {
175  cbc_status.push_back(static_cast<uint8_t>((data64>>current_byte*8)&0xFF));
176  if(current_byte==0)
177  {
178  current_byte = 8;
179  offset += 8;
180  data64 = read64(offset,trackerHeader_);
181  }
182  current_byte--;
183  num_bytes--;
184  }
185  }
186  else if (status_size==1)
187  {
188  int current_bit = 47;
189  int num_bits = cbc_num;
190  while(num_bits>0)
191  {
192  cbc_status.push_back(static_cast<uint8_t>((data64>>current_bit)&0x1));
193  if(current_bit==0) {
194  current_bit = 64;
195  offset += 8;
196  data64 = read64(offset,trackerHeader_);
197  }
198  current_bit--;
199  num_bits--;
200  }
201  }
202 
203  return cbc_status;
204  }
unsigned long long uint64_t
Definition: Time.h:15
uint64_t read64(int offset, const uint8_t *buffer)
Definition: utils.h:197
uint8_t Phase2Tracker::Phase2TrackerFEDHeader::conditionData ( ) const
private

Definition at line 111 of file Phase2TrackerFEDHeader.cc.

References eventType_.

Referenced by init().

112  {
113  return static_cast<uint8_t> (eventType_ >>1) & 0x1;
114  }
uint8_t Phase2Tracker::Phase2TrackerFEDHeader::dataFormatVersion ( ) const
private

Definition at line 47 of file Phase2TrackerFEDHeader.cc.

References Exception, Phase2Tracker::extract64(), header_first_word_, Phase2Tracker::printHex(), contentValuesCheck::ss, Phase2Tracker::VERSION_M, and Phase2Tracker::VERSION_S.

Referenced by init().

48  {
49  uint8_t Version = static_cast<uint8_t>(extract64(VERSION_M, VERSION_S, header_first_word_));
50  if (Version != 1)
51  {
52  std::ostringstream ss;
53  ss << "[Phase2Tracker::Phase2TrackerFEDHeader::"<<__func__<<"] ";
54  ss << "Invalid Data Format Version in Traker Header : ";
56  throw cms::Exception("Phase2TrackerFEDBuffer") << ss.str();
57  }
58  return Version;
59  }
void printHex(const void *pointer, const size_t lengthInBytes, std::ostream &os)
Definition: utils.h:60
uint64_t extract64(trackerHeader_m mask, trackerHeader_s shift, uint64_t data)
Definition: utils.h:203
uint8_t Phase2Tracker::Phase2TrackerFEDHeader::dataType ( ) const
private

Definition at line 116 of file Phase2TrackerFEDHeader.cc.

References eventType_.

Referenced by init().

117  {
118  return static_cast<uint8_t> (eventType_) & 0x1;
119  }
READ_MODE Phase2Tracker::Phase2TrackerFEDHeader::debugMode ( ) const
private

Definition at line 61 of file Phase2TrackerFEDHeader.cc.

References Phase2Tracker::CBC_ERROR, Exception, Phase2Tracker::extract64(), Phase2Tracker::FULL_DEBUG, header_first_word_, Phase2Tracker::HEADER_FORMAT_M, Phase2Tracker::HEADER_FORMAT_S, alignBH_cfg::mode, Phase2Tracker::printHex(), Phase2Tracker::READ_MODE_INVALID, contentValuesCheck::ss, and Phase2Tracker::SUMMARY.

Referenced by init().

62  {
63  // Read debugMode in Tracker Header
64  uint8_t mode = static_cast<uint8_t>(extract64(HEADER_FORMAT_M, HEADER_FORMAT_S, header_first_word_));
65 
66  switch (mode)
67  { // check if it is one of correct modes
68  case SUMMARY:
69  return READ_MODE(SUMMARY);
70  case FULL_DEBUG:
71  return READ_MODE(FULL_DEBUG);
72  case CBC_ERROR:
73  return READ_MODE(CBC_ERROR);
74  default: // else create Exception
75  std::ostringstream ss;
76  ss << "[Phase2Tracker::Phase2TrackerFEDHeader::"<<__func__<<"] ";
77  ss << "Invalid Header Format in Traker Header : ";
79  throw cms::Exception("Phase2TrackerFEDBuffer") << ss.str();
80  }
81 
83  }
void printHex(const void *pointer, const size_t lengthInBytes, std::ostream &os)
Definition: utils.h:60
uint64_t extract64(trackerHeader_m mask, trackerHeader_s shift, uint64_t data)
Definition: utils.h:203
uint8_t Phase2Tracker::Phase2TrackerFEDHeader::eventType ( ) const
private

Definition at line 85 of file Phase2TrackerFEDHeader.cc.

References Phase2Tracker::EVENT_TYPE_M, Phase2Tracker::EVENT_TYPE_S, Phase2Tracker::extract64(), and header_first_word_.

Referenced by init().

86  {
87  return static_cast<uint8_t>(extract64(EVENT_TYPE_M, EVENT_TYPE_S, header_first_word_));
88  }
uint64_t extract64(trackerHeader_m mask, trackerHeader_s shift, uint64_t data)
Definition: utils.h:203
std::vector< bool > Phase2Tracker::Phase2TrackerFEDHeader::frontendStatus ( ) const

Definition at line 126 of file Phase2TrackerFEDHeader.cc.

References Phase2Tracker::extract64(), Phase2Tracker::FRONTEND_STAT_M, Phase2Tracker::FRONTEND_STAT_S, header_first_word_, i, and mps_update::status.

Referenced by Phase2Tracker::Phase2TrackerFEDBuffer::findChannels(), and Phase2Tracker::Phase2TrackerDigiProducer::produce().

127  {
128  uint16_t FE_status = static_cast<uint16_t>(extract64(FRONTEND_STAT_M, FRONTEND_STAT_S, header_first_word_));
129  std::vector<bool> status(16,false);
130  for(int i = 0; i < 16; i++)
131  {
132  status[i] = (FE_status>>i)&0x1;
133  }
134  return status;
135  }
int i
Definition: DBlmapReader.cc:9
uint64_t extract64(trackerHeader_m mask, trackerHeader_s shift, uint64_t data)
Definition: utils.h:203
tuple status
Definition: mps_update.py:57
uint8_t Phase2Tracker::Phase2TrackerFEDHeader::getConditionData ( ) const
inline
uint8_t Phase2Tracker::Phase2TrackerFEDHeader::getDataFormatVersion ( ) const
inline
uint8_t Phase2Tracker::Phase2TrackerFEDHeader::getDataType ( ) const
inline
READ_MODE Phase2Tracker::Phase2TrackerFEDHeader::getDebugMode ( ) const
inline
uint8_t Phase2Tracker::Phase2TrackerFEDHeader::getEventType ( ) const
inline
uint64_t Phase2Tracker::Phase2TrackerFEDHeader::getGlibStatusCode ( ) const
inline
uint16_t Phase2Tracker::Phase2TrackerFEDHeader::getNumberOfCBC ( ) const
inline
const uint8_t* Phase2Tracker::Phase2TrackerFEDHeader::getPointerToData ( ) const
inline
FEDReadoutMode Phase2Tracker::Phase2TrackerFEDHeader::getReadoutMode ( ) const
inline
uint8_t Phase2Tracker::Phase2TrackerFEDHeader::getTrackerHeaderSize ( ) const
inline
uint64_t Phase2Tracker::Phase2TrackerFEDHeader::glibStatusCode ( ) const
private

Definition at line 121 of file Phase2TrackerFEDHeader.cc.

References Phase2Tracker::extract64(), Phase2Tracker::GLIB_STATUS_M, Phase2Tracker::GLIB_STATUS_S, and header_first_word_.

Referenced by init().

122  {
124  }
uint64_t extract64(trackerHeader_m mask, trackerHeader_s shift, uint64_t data)
Definition: utils.h:203
void Phase2Tracker::Phase2TrackerFEDHeader::init ( void  )
private

Definition at line 18 of file Phase2TrackerFEDHeader.cc.

References conditionData(), conditionData_, dataFormatVersion(), dataFormatVersion_, dataType(), dataType_, debugMode(), debugMode_, TauDecayModes::dec, eventType(), eventType_, glibStatusCode(), glibStatusCode_, LogTrace, numberOfCBC(), numberOfCBC_, pointerToData(), pointerToData_, readoutMode(), and readoutMode_.

Referenced by Phase2TrackerFEDHeader().

19  {
22  // WARNING: eventType must be called before
23  // readoutMode, conditionData and dataType
24  // as this info is stored in eventType
28  dataType_ = dataType();
29 
31  // numberOfCBC must be called before pointerToData
34 
35  LogTrace("Phase2TrackerFEDBuffer")
36  << "[Phase2Tracker::Phase2TrackerFEDHeader::"<<__func__<<"]: \n"
37  <<" Tracker Header contents:\n"
38  <<" -- Data Format Version : " << uint32_t(dataFormatVersion_) << "\n"
39  <<" -- Debug Level : " << debugMode_ << "\n"
40  <<" -- Operating Mode : " << readoutMode_ << "\n"
41  <<" -- Condition Data : " << ( conditionData_ ? "Present" : "Absent") << "\n"
42  <<" -- Data Type : " << ( dataType_ ? "Real" : "Fake" ) << "\n"
43  <<" -- Glib Stat registers : " << std::hex << std::setw(16) << glibStatusCode_ << "\n"
44  <<" -- connected CBC : " << std::dec << numberOfCBC_ << "\n";
45  }
#define LogTrace(id)
uint16_t Phase2Tracker::Phase2TrackerFEDHeader::numberOfCBC ( ) const
private

Definition at line 137 of file Phase2TrackerFEDHeader.cc.

References Phase2Tracker::CBC_NUMBER_M, Phase2Tracker::CBC_NUMBER_S, debugMode_, Phase2Tracker::extract64(), header_second_word_, and Phase2Tracker::SUMMARY.

Referenced by CBCStatus(), init(), and pointerToData().

138  {
139  if(debugMode_!=SUMMARY)
140  {
141  return static_cast<uint16_t>(extract64(CBC_NUMBER_M, CBC_NUMBER_S, header_second_word_));
142  }
143  else
144  {
145  return 0;
146  }
147  }
uint64_t extract64(trackerHeader_m mask, trackerHeader_s shift, uint64_t data)
Definition: utils.h:203
const uint8_t * Phase2Tracker::Phase2TrackerFEDHeader::pointerToData ( )
private

Definition at line 206 of file Phase2TrackerFEDHeader.cc.

References Phase2Tracker::CBC_ERROR, debugMode_, Phase2Tracker::FULL_DEBUG, numberOfCBC(), trackerHeader_, and trackerHeaderSize_.

Referenced by init().

207  {
208  int status_size = 0;
209  int cbc_num = numberOfCBC();
210  // CAUTION: we express all sizes in bits here
211  if (debugMode_==FULL_DEBUG)
212  {
213  status_size = 8;
214  }
215  else if (debugMode_==CBC_ERROR)
216  {
217  status_size = 1;
218  }
219  // compute number of additional 64 bit words before payload
220  int num_add_words64 = (cbc_num * status_size - 48 + 64 - 1) / 64 ;
221  // back to bytes
222  trackerHeaderSize_ = (2 + num_add_words64) * 8;
224  }
FEDReadoutMode Phase2Tracker::Phase2TrackerFEDHeader::readoutMode ( ) const
private

Definition at line 91 of file Phase2TrackerFEDHeader.cc.

References eventType_, Exception, header_first_word_, alignBH_cfg::mode, Phase2Tracker::printHex(), Phase2Tracker::READOUT_MODE_PROC_RAW, Phase2Tracker::READOUT_MODE_ZERO_SUPPRESSED, and contentValuesCheck::ss.

Referenced by init().

92  {
93  // readout mode is first bit of event type
94  uint8_t mode = static_cast<uint8_t> (eventType_ >> 2) & 0x3;
95 
96  switch (mode)
97  { // check if it is one of correct modes
98  case 2:
100  case 1:
102  default: // else create Exception
103  std::ostringstream ss;
104  ss << "[Phase2Tracker::Phase2TrackerFEDHeader::"<<__func__<<"] ";
105  ss << "Invalid Readout Mode in Traker Header : ";
107  throw cms::Exception("Phase2TrackerFEDBuffer") << ss.str();
108  }
109  }
FEDReadoutMode
Definition: utils.h:98
void printHex(const void *pointer, const size_t lengthInBytes, std::ostream &os)
Definition: utils.h:60

Member Data Documentation

uint8_t Phase2Tracker::Phase2TrackerFEDHeader::conditionData_
private

Definition at line 75 of file Phase2TrackerFEDHeader.h.

Referenced by getConditionData(), and init().

uint8_t Phase2Tracker::Phase2TrackerFEDHeader::dataFormatVersion_
private

Definition at line 71 of file Phase2TrackerFEDHeader.h.

Referenced by getDataFormatVersion(), and init().

uint8_t Phase2Tracker::Phase2TrackerFEDHeader::dataType_
private

Definition at line 76 of file Phase2TrackerFEDHeader.h.

Referenced by getDataType(), and init().

READ_MODE Phase2Tracker::Phase2TrackerFEDHeader::debugMode_
private

Definition at line 72 of file Phase2TrackerFEDHeader.h.

Referenced by CBCStatus(), getDebugMode(), init(), numberOfCBC(), and pointerToData().

uint8_t Phase2Tracker::Phase2TrackerFEDHeader::eventType_
private

Definition at line 73 of file Phase2TrackerFEDHeader.h.

Referenced by conditionData(), dataType(), getEventType(), init(), and readoutMode().

uint64_t Phase2Tracker::Phase2TrackerFEDHeader::glibStatusCode_
private

Definition at line 77 of file Phase2TrackerFEDHeader.h.

Referenced by getGlibStatusCode(), and init().

uint64_t Phase2Tracker::Phase2TrackerFEDHeader::header_first_word_
private
uint64_t Phase2Tracker::Phase2TrackerFEDHeader::header_second_word_
private

Definition at line 70 of file Phase2TrackerFEDHeader.h.

Referenced by CBCStatus(), numberOfCBC(), and Phase2TrackerFEDHeader().

uint16_t Phase2Tracker::Phase2TrackerFEDHeader::numberOfCBC_
private

Definition at line 78 of file Phase2TrackerFEDHeader.h.

Referenced by getNumberOfCBC(), and init().

const uint8_t* Phase2Tracker::Phase2TrackerFEDHeader::pointerToData_
private

Definition at line 67 of file Phase2TrackerFEDHeader.h.

Referenced by getPointerToData(), and init().

FEDReadoutMode Phase2Tracker::Phase2TrackerFEDHeader::readoutMode_
private

Definition at line 74 of file Phase2TrackerFEDHeader.h.

Referenced by getReadoutMode(), and init().

const uint8_t* Phase2Tracker::Phase2TrackerFEDHeader::trackerHeader_
private

Definition at line 66 of file Phase2TrackerFEDHeader.h.

Referenced by CBCStatus(), Phase2TrackerFEDHeader(), and pointerToData().

uint8_t Phase2Tracker::Phase2TrackerFEDHeader::trackerHeaderSize_
private

Definition at line 68 of file Phase2TrackerFEDHeader.h.

Referenced by getTrackerHeaderSize(), and pointerToData().