CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
TotemSampicFrame Class Reference

#include <TotemSampicFrame.h>

Public Member Functions

template<class T >
T extractDataFromBytesLSB (const uint8_t *array, int start, int size) const
 
uint16_t getBunchNumber () const
 
uint16_t getCellInfo () const
 
uint16_t getChannelMap () const
 
int getDetChannel () const
 
int getDetPlane () const
 
uint8_t getEventHardwareId () const
 
uint32_t getEventNumber () const
 
uint64_t getFPGATimestamp () const
 
uint8_t getFWVersion () const
 
uint8_t getHardwareId () const
 
uint16_t getL1ALatency () const
 
uint64_t getL1ATimestamp () const
 
unsigned int getNumberOfSamples () const
 
uint8_t getNumberOfSentSamples () const
 
uint8_t getOffsetOfSamples () const
 
uint32_t getOrbitNumber () const
 
uint8_t getPLLInfo () const
 
const std::vector< uint8_t > getSamples () const
 
uint16_t getTimestampA () const
 
uint16_t getTimestampB () const
 
void print () const
 
void printRaw (bool binary=false) const
 
 TotemSampicFrame (const uint8_t *chInfoPtr, const uint8_t *chDataPtr, const uint8_t *eventInfoPtr)
 
bool valid () const
 
 ~TotemSampicFrame ()
 

Protected Member Functions

void printRawBuffer (const uint16_t *buffer, const bool binary=false, const unsigned int size=12) const
 

Protected Attributes

int status_
 
const uint8_t * totemSampicDataPtr_
 
const uint8_t * totemSampicEventInfoPtr_
 
const uint8_t * totemSampicInfoPtr_
 

Detailed Description

This class is intended to handle the timing infromation of SAMPIC in the TOTEM implementation

Definition at line 80 of file TotemSampicFrame.h.

Constructor & Destructor Documentation

◆ TotemSampicFrame()

TotemSampicFrame::TotemSampicFrame ( const uint8_t *  chInfoPtr,
const uint8_t *  chDataPtr,
const uint8_t *  eventInfoPtr 
)
inline

Definition at line 82 of file TotemSampicFrame.h.

References controlBits3, controlBits3_Position, status_, and totemSampicInfoPtr_.

83  : totemSampicInfoPtr_(chInfoPtr),
84  totemSampicDataPtr_(chDataPtr),
85  totemSampicEventInfoPtr_(eventInfoPtr),
86  status_(0) {
87  if (chInfoPtr != nullptr && chDataPtr != nullptr && eventInfoPtr != nullptr &&
89  status_ = 1;
90  }
const uint8_t * totemSampicInfoPtr_
const uint8_t * totemSampicEventInfoPtr_
const uint8_t * totemSampicDataPtr_

◆ ~TotemSampicFrame()

TotemSampicFrame::~TotemSampicFrame ( )
inline

Definition at line 91 of file TotemSampicFrame.h.

91 {}

Member Function Documentation

◆ extractDataFromBytesLSB()

template<class T >
T TotemSampicFrame::extractDataFromBytesLSB ( const uint8_t *  array,
int  start,
int  size 
) const
inline

Definition at line 136 of file TotemSampicFrame.h.

References mps_check::array, mps_fire::i, mps_fire::result, findQualityFiles::size, and isotrackNtupler::start.

136  {
137  T result = 0;
138  for (int i = start + size - 1; i >= start; i--)
139  result = (result << 8) | array[i];
140  return result;
141  }
size
Write out results.
Definition: start.py:1
long double T

◆ getBunchNumber()

uint16_t TotemSampicFrame::getBunchNumber ( ) const
inline

Definition at line 218 of file TotemSampicFrame.h.

References bunchNumber_Position, bunchNumber_Size, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

218  {
219  uint16_t tmp = 0;
220  if (status_)
221  tmp = extractDataFromBytesLSB<uint16_t>(
223  return tmp;
224  }
const uint8_t * totemSampicEventInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getCellInfo()

uint16_t TotemSampicFrame::getCellInfo ( ) const
inline

Definition at line 168 of file TotemSampicFrame.h.

References cellInfo_Mask, cellInfo_Position, cellInfo_Size, status_, createJobs::tmp, and totemSampicInfoPtr_.

Referenced by print().

168  {
169  uint16_t tmp = 0;
170  if (status_)
171  tmp =
172  extractDataFromBytesLSB<uint16_t>(totemSampicInfoPtr_, TotemSampicConstant::cellInfo_Position, cellInfo_Size);
174  }
const uint8_t * totemSampicInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getChannelMap()

uint16_t TotemSampicFrame::getChannelMap ( ) const
inline

Definition at line 242 of file TotemSampicFrame.h.

References channelMap_Position, channelMap_Size, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

242  {
243  uint16_t tmp = 0;
244  if (status_)
245  tmp = extractDataFromBytesLSB<uint16_t>(
247  return tmp;
248  }
const uint8_t * totemSampicEventInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getDetChannel()

int TotemSampicFrame::getDetChannel ( ) const
inline

Definition at line 183 of file TotemSampicFrame.h.

References planeChannelId_Position, status_, createJobs::tmp, and totemSampicInfoPtr_.

Referenced by print().

183  {
184  int tmp = 0;
185  if (status_)
187  return tmp;
188  }
const uint8_t * totemSampicInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getDetPlane()

int TotemSampicFrame::getDetPlane ( ) const
inline

Definition at line 176 of file TotemSampicFrame.h.

References planeChannelId_Position, status_, createJobs::tmp, and totemSampicInfoPtr_.

Referenced by print().

176  {
177  int tmp = 0;
178  if (status_)
180  return tmp;
181  }
const uint8_t * totemSampicInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getEventHardwareId()

uint8_t TotemSampicFrame::getEventHardwareId ( ) const
inline

Definition at line 203 of file TotemSampicFrame.h.

References boardId_Position, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

203  {
204  uint8_t tmp = 0;
205  if (status_)
207  return tmp;
208  }
const uint8_t * totemSampicEventInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getEventNumber()

uint32_t TotemSampicFrame::getEventNumber ( ) const
inline

Definition at line 234 of file TotemSampicFrame.h.

References eventNumber_Position, eventNumber_Size, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

234  {
235  uint32_t tmp = 0;
236  if (status_)
237  tmp = extractDataFromBytesLSB<uint32_t>(
239  return tmp;
240  }
const uint8_t * totemSampicEventInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getFPGATimestamp()

uint64_t TotemSampicFrame::getFPGATimestamp ( ) const
inline

Definition at line 143 of file TotemSampicFrame.h.

References fpgaTime_Position, fpgaTime_Size, status_, createJobs::tmp, and totemSampicInfoPtr_.

Referenced by print().

143  {
144  uint64_t tmp = 0;
145  if (status_)
146  tmp =
147  extractDataFromBytesLSB<uint64_t>(totemSampicInfoPtr_, TotemSampicConstant::fpgaTime_Position, fpgaTime_Size);
148  return tmp;
149  }
const uint8_t * totemSampicInfoPtr_
unsigned long long uint64_t
Definition: Time.h:13
tmp
align.sh
Definition: createJobs.py:716

◆ getFWVersion()

uint8_t TotemSampicFrame::getFWVersion ( ) const
inline

Definition at line 279 of file TotemSampicFrame.h.

References fwVersion_Position, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

279  {
280  uint8_t tmp = 0;
281  if (status_)
283  return tmp;
284  }
const uint8_t * totemSampicEventInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getHardwareId()

uint8_t TotemSampicFrame::getHardwareId ( ) const
inline

Definition at line 128 of file TotemSampicFrame.h.

References hwId_Position, status_, createJobs::tmp, and totemSampicInfoPtr_.

Referenced by print().

128  {
129  uint8_t tmp = 0;
130  if (status_)
132  return tmp;
133  }
const uint8_t * totemSampicInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getL1ALatency()

uint16_t TotemSampicFrame::getL1ALatency ( ) const
inline

Definition at line 250 of file TotemSampicFrame.h.

References l1ALatency_Position, l1ALatency_Size, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

250  {
251  uint16_t tmp = 0;
252  if (status_)
253  tmp = extractDataFromBytesLSB<uint16_t>(
255  return tmp;
256  }
const uint8_t * totemSampicEventInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getL1ATimestamp()

uint64_t TotemSampicFrame::getL1ATimestamp ( ) const
inline

Definition at line 210 of file TotemSampicFrame.h.

References l1ATimestamp_Position, l1ATimestamp_Size, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

210  {
211  uint64_t tmp = 0;
212  if (status_)
213  tmp = extractDataFromBytesLSB<uint64_t>(
215  return tmp;
216  }
const uint8_t * totemSampicEventInfoPtr_
unsigned long long uint64_t
Definition: Time.h:13
tmp
align.sh
Definition: createJobs.py:716

◆ getNumberOfSamples()

unsigned int TotemSampicFrame::getNumberOfSamples ( ) const
inline

◆ getNumberOfSentSamples()

uint8_t TotemSampicFrame::getNumberOfSentSamples ( ) const
inline

Definition at line 258 of file TotemSampicFrame.h.

References numberOfSamples_Position, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

258  {
259  uint8_t tmp = 0;
260  if (status_)
262  return tmp;
263  }
const uint8_t * totemSampicEventInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getOffsetOfSamples()

uint8_t TotemSampicFrame::getOffsetOfSamples ( ) const
inline

Definition at line 265 of file TotemSampicFrame.h.

References offsetOfSamples_Position, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

265  {
266  uint8_t tmp = 0;
267  if (status_)
269  return tmp;
270  }
const uint8_t * totemSampicEventInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getOrbitNumber()

uint32_t TotemSampicFrame::getOrbitNumber ( ) const
inline

Definition at line 226 of file TotemSampicFrame.h.

References orbitNumber_Position, orbitNumber_Size, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

226  {
227  uint32_t tmp = 0;
228  if (status_)
229  tmp = extractDataFromBytesLSB<uint32_t>(
231  return tmp;
232  }
const uint8_t * totemSampicEventInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getPLLInfo()

uint8_t TotemSampicFrame::getPLLInfo ( ) const
inline

Definition at line 272 of file TotemSampicFrame.h.

References pllInfo_Position, status_, createJobs::tmp, and totemSampicEventInfoPtr_.

Referenced by print().

272  {
273  uint8_t tmp = 0;
274  if (status_)
276  return tmp;
277  }
const uint8_t * totemSampicEventInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getSamples()

const std::vector<uint8_t> TotemSampicFrame::getSamples ( ) const
inline

Definition at line 190 of file TotemSampicFrame.h.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, numberOfSamples, EgammaValidation_cff::samples, status_, and totemSampicDataPtr_.

190  {
191  std::vector<uint8_t> samples;
192  if (status_) {
194  for (auto it = samples.begin(); it != samples.end(); ++it)
195  *it = grayToBinary<uint8_t>(*it);
196  }
197  return samples;
198  }
const uint8_t * totemSampicDataPtr_

◆ getTimestampA()

uint16_t TotemSampicFrame::getTimestampA ( ) const
inline

Definition at line 151 of file TotemSampicFrame.h.

References status_, timestampA_Position, timestampA_Size, createJobs::tmp, and totemSampicInfoPtr_.

Referenced by print().

151  {
152  uint16_t tmp = 0;
153  if (status_)
154  tmp = extractDataFromBytesLSB<uint16_t>(
156  tmp = 0xFFF - tmp;
157  return grayToBinary<uint16_t>(tmp);
158  }
const uint8_t * totemSampicInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ getTimestampB()

uint16_t TotemSampicFrame::getTimestampB ( ) const
inline

Definition at line 160 of file TotemSampicFrame.h.

References status_, timestampB_Position, timestampB_Size, createJobs::tmp, and totemSampicInfoPtr_.

Referenced by print().

160  {
161  uint16_t tmp = 0;
162  if (status_)
163  tmp = extractDataFromBytesLSB<uint16_t>(
165  return grayToBinary<uint16_t>(tmp);
166  }
const uint8_t * totemSampicInfoPtr_
tmp
align.sh
Definition: createJobs.py:716

◆ print()

void TotemSampicFrame::print ( void  ) const
inline

Definition at line 106 of file TotemSampicFrame.h.

References TauDecayModes::dec, getBunchNumber(), getCellInfo(), getChannelMap(), getDetChannel(), getDetPlane(), getEventHardwareId(), getEventNumber(), getFPGATimestamp(), getFWVersion(), getHardwareId(), getL1ALatency(), getL1ATimestamp(), getNumberOfSentSamples(), getOffsetOfSamples(), getOrbitNumber(), getPLLInfo(), getTimestampA(), getTimestampB(), and createfilelist::int.

106  {
107  std::bitset<16> bitsChannelMap(getChannelMap());
108  std::bitset<16> bitsPLLInfo(getPLLInfo());
109  edm::LogInfo("TotemSampicFrame") << "\nEvent:"
110  << "\nHardwareId (Event):\t" << std::hex << (unsigned int)getEventHardwareId()
111  << "\nL1A Timestamp:\t" << std::dec << getL1ATimestamp() << "\nL1A Latency:\t"
112  << std::dec << getL1ALatency() << "\nBunch Number:\t" << std::dec
113  << getBunchNumber() << "\nOrbit Number:\t" << std::dec << getOrbitNumber()
114  << "\nEvent Number:\t" << std::dec << getEventNumber() << "\nChannels fired:\t"
115  << std::hex << bitsChannelMap.to_string() << "\nNumber of Samples:\t" << std::dec
116  << getNumberOfSentSamples() << "\nOffset of Samples:\t" << std::dec
117  << (int)getOffsetOfSamples() << "\nFW Version:\t" << std::hex
118  << (int)getFWVersion() << "\nChannel:\nHardwareId:\t" << std::hex
119  << (unsigned int)getHardwareId() << "\nFPGATimestamp:\t" << std::dec
120  << getFPGATimestamp() << "\nTimestampA:\t" << std::dec << getTimestampA()
121  << "\nTimestampB:\t" << std::dec << getTimestampB() << "\nCellInfo:\t" << std::dec
122  << getCellInfo() << "\nPlane:\t" << std::dec << getDetPlane() << "\nChannel:\t"
123  << std::dec << getDetChannel() << "\nPLL Info:\t" << bitsPLLInfo.to_string()
124  << "\n\n";
125  }
uint8_t getFWVersion() const
uint32_t getEventNumber() const
uint64_t getL1ATimestamp() const
uint8_t getEventHardwareId() const
uint16_t getBunchNumber() const
int getDetChannel() const
int getDetPlane() const
uint16_t getL1ALatency() const
uint32_t getOrbitNumber() const
uint16_t getCellInfo() const
uint16_t getChannelMap() const
uint8_t getOffsetOfSamples() const
Log< level::Info, false > LogInfo
uint16_t getTimestampB() const
uint8_t getPLLInfo() const
uint8_t getNumberOfSentSamples() const
uint16_t getTimestampA() const
uint64_t getFPGATimestamp() const
uint8_t getHardwareId() const

◆ printRaw()

void TotemSampicFrame::printRaw ( bool  binary = false) const
inline

Prints the frame. If binary is true, binary format is used.

Definition at line 95 of file TotemSampicFrame.h.

References printRawBuffer(), totemSampicDataPtr_, totemSampicEventInfoPtr_, and totemSampicInfoPtr_.

95  {
96  edm::LogInfo("TotemSampicFrame") << "Event Info: \n";
98 
99  edm::LogInfo("TotemSampicFrame") << "Channel Info: \n";
101 
102  edm::LogInfo("TotemSampicFrame") << "Channel Data: \n";
104  }
const uint8_t * totemSampicInfoPtr_
const uint8_t * totemSampicEventInfoPtr_
const uint8_t * totemSampicDataPtr_
void printRawBuffer(const uint16_t *buffer, const bool binary=false, const unsigned int size=12) const
Log< level::Info, false > LogInfo

◆ printRawBuffer()

void TotemSampicFrame::printRawBuffer ( const uint16_t *  buffer,
const bool  binary = false,
const unsigned int  size = 12 
) const
inlineprotected

Definition at line 295 of file TotemSampicFrame.h.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, edmScanValgrind::buffer, mps_fire::i, and findQualityFiles::size.

Referenced by printRaw().

295  {
296  for (unsigned int i = 0; i < size; i++) {
297  if (binary) {
298  std::bitset<16> bits(*(buffer++));
299  edm::LogInfo("TotemSampicFrame") << bits.to_string() << "\n";
300  } else
301  edm::LogInfo("TotemSampicFrame") << std::setfill('0') << std::setw(4) << std::hex << *(buffer++) << "\n";
302  }
303  }
size
Write out results.
Log< level::Info, false > LogInfo

◆ valid()

bool TotemSampicFrame::valid ( ) const
inline

Definition at line 286 of file TotemSampicFrame.h.

References status_.

286 { return status_ != 0; }

Member Data Documentation

◆ status_

int TotemSampicFrame::status_
protected

◆ totemSampicDataPtr_

const uint8_t* TotemSampicFrame::totemSampicDataPtr_
protected

Definition at line 290 of file TotemSampicFrame.h.

Referenced by getSamples(), and printRaw().

◆ totemSampicEventInfoPtr_

const uint8_t* TotemSampicFrame::totemSampicEventInfoPtr_
protected

◆ totemSampicInfoPtr_

const uint8_t* TotemSampicFrame::totemSampicInfoPtr_
protected