CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TotemTimingDigi Class Reference

#include <TotemTimingDigi.h>

Public Member Functions

void addSample (const uint8_t sampleValue)
 
unsigned int cellInfo () const
 
TotemTimingEventInfo eventInfo () const
 
unsigned int fpgaTimestamp () const
 
unsigned int hardwareBoardId () const
 
unsigned int hardwareChannelId () const
 
unsigned int hardwareId () const
 Return digi values number. More...
 
unsigned int hardwareSampicId () const
 
unsigned int numberOfSamples () const
 
bool operator== (const TotemTimingDigi &digi) const
 Digis are equal if they have all the same values, NOT checking the samples! More...
 
int sampleAt (const unsigned int i) const
 
std::vector< uint8_t > samples () const
 
std::vector< uint8_t >::const_iterator samplesBegin () const
 
std::vector< uint8_t >::const_iterator samplesEnd () const
 
void setCellInfo (const uint16_t cellInfo)
 
void setEventInfo (const TotemTimingEventInfo &totemTimingEventInfo)
 
void setFPGATimestamp (const uint64_t fpgaTimestamp)
 
void setHardwareBoardId (const unsigned int boardId)
 
void setHardwareChannelId (const unsigned int channelId)
 
void setHardwareId (const uint8_t hwId)
 
void setHardwareSampicId (const unsigned int sampicId)
 
void setSampleAt (const unsigned int i, const uint8_t sampleValue)
 
void setSamples (const std::vector< uint8_t > &samples)
 
void setTimestampA (const uint16_t timestampA)
 
void setTimestampB (const uint16_t timestampB)
 
unsigned int timestampA () const
 
unsigned int timestampB () const
 
 TotemTimingDigi (const uint8_t hwId, const uint64_t fpgaTimestamp, const uint16_t timestampA, const uint16_t timestampB, const uint16_t cellInfo, const std::vector< uint8_t > &samples, const TotemTimingEventInfo &totemTimingEventInfo)
 
 TotemTimingDigi (const TotemTimingDigi &digi)
 
 TotemTimingDigi ()
 
 ~TotemTimingDigi ()
 

Private Attributes

uint16_t cellInfo_
 
uint64_t fpgaTimestamp_
 
uint8_t hwId_
 
std::vector< uint8_t > samples_
 
uint16_t timestampA_
 
uint16_t timestampB_
 
TotemTimingEventInfo totemTimingEventInfo_
 

Detailed Description

Digi Class for CTPPS Timing Detector

Author
Mirko Berretti
Nicola Minafra
Laurent Forthomme March 2018

Definition at line 19 of file TotemTimingDigi.h.

Constructor & Destructor Documentation

TotemTimingDigi::TotemTimingDigi ( const uint8_t  hwId,
const uint64_t  fpgaTimestamp,
const uint16_t  timestampA,
const uint16_t  timestampB,
const uint16_t  cellInfo,
const std::vector< uint8_t > &  samples,
const TotemTimingEventInfo totemTimingEventInfo 
)

Definition at line 10 of file TotemTimingDigi.cc.

17  : hwId_(hwId),
23  totemTimingEventInfo_(totemTimingEventInfo) {}
TotemTimingEventInfo totemTimingEventInfo_
unsigned int timestampA() const
std::vector< uint8_t > samples() const
unsigned int cellInfo() const
unsigned int fpgaTimestamp() const
uint64_t fpgaTimestamp_
std::vector< uint8_t > samples_
unsigned int timestampB() const
TotemTimingDigi::TotemTimingDigi ( const TotemTimingDigi digi)

Definition at line 25 of file TotemTimingDigi.cc.

26  : hwId_(digi.hwId_),
30  cellInfo_(digi.cellInfo_),
31  samples_(digi.samples_),
TotemTimingEventInfo totemTimingEventInfo_
uint64_t fpgaTimestamp_
std::vector< uint8_t > samples_
TotemTimingDigi::TotemTimingDigi ( )

Definition at line 34 of file TotemTimingDigi.cc.

TotemTimingDigi::~TotemTimingDigi ( )
inline

Definition at line 30 of file TotemTimingDigi.h.

References operator==().

30 {};

Member Function Documentation

void TotemTimingDigi::addSample ( const uint8_t  sampleValue)
inline

Definition at line 100 of file TotemTimingDigi.h.

References samples_.

100 { samples_.emplace_back(sampleValue); }
std::vector< uint8_t > samples_
unsigned int TotemTimingDigi::cellInfo ( ) const
inline
TotemTimingEventInfo TotemTimingDigi::eventInfo ( ) const
inline
unsigned int TotemTimingDigi::fpgaTimestamp ( ) const
inline

Definition at line 46 of file TotemTimingDigi.h.

References fpgaTimestamp_.

Referenced by operator<<(), setFPGATimestamp(), and TotemTimingConversions::timeOfFirstSample().

46 { return fpgaTimestamp_; }
uint64_t fpgaTimestamp_
unsigned int TotemTimingDigi::hardwareBoardId ( ) const
inline
unsigned int TotemTimingDigi::hardwareChannelId ( ) const
inline
unsigned int TotemTimingDigi::hardwareId ( ) const
inline

Return digi values number.

Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id

Definition at line 38 of file TotemTimingDigi.h.

References hwId_.

Referenced by operator<(), and operator<<().

38 { return hwId_; }
unsigned int TotemTimingDigi::hardwareSampicId ( ) const
inline
unsigned int TotemTimingDigi::numberOfSamples ( ) const
inline

Definition at line 60 of file TotemTimingDigi.h.

References samples_.

Referenced by operator<<(), and TotemTimingConversions::timeSamples().

60 { return samples_.size(); }
std::vector< uint8_t > samples_
bool TotemTimingDigi::operator== ( const TotemTimingDigi digi) const

Digis are equal if they have all the same values, NOT checking the samples!

Definition at line 37 of file TotemTimingDigi.cc.

References cellInfo_, fpgaTimestamp_, hwId_, samples_, timestampA_, and timestampB_.

Referenced by ~TotemTimingDigi().

37  {
38  if (hwId_ != digi.hwId_ || fpgaTimestamp_ != digi.fpgaTimestamp_ || timestampA_ != digi.timestampA_ ||
39  timestampB_ != digi.timestampB_ || cellInfo_ != digi.cellInfo_ || samples_ != digi.samples_)
40  return false;
41  return true;
42 }
uint64_t fpgaTimestamp_
std::vector< uint8_t > samples_
int TotemTimingDigi::sampleAt ( const unsigned int  i) const
inline

Definition at line 62 of file TotemTimingDigi.h.

References samples_.

62  {
63  int sampleValue = -1;
64  if (i < samples_.size())
65  sampleValue = (int)samples_.at(i);
66  return sampleValue;
67  }
std::vector< uint8_t > samples_
std::vector<uint8_t> TotemTimingDigi::samples ( ) const
inline

Definition at line 54 of file TotemTimingDigi.h.

References samples_.

Referenced by setSamples(), and TotemTimingConversions::voltSamples().

54 { return samples_; }
std::vector< uint8_t > samples_
std::vector<uint8_t>::const_iterator TotemTimingDigi::samplesBegin ( ) const
inline

Definition at line 56 of file TotemTimingDigi.h.

References samples_.

56 { return samples_.cbegin(); }
std::vector< uint8_t > samples_
std::vector<uint8_t>::const_iterator TotemTimingDigi::samplesEnd ( ) const
inline

Definition at line 58 of file TotemTimingDigi.h.

References samples_.

58 { return samples_.cend(); }
std::vector< uint8_t > samples_
void TotemTimingDigi::setCellInfo ( const uint16_t  cellInfo)
inline

Definition at line 96 of file TotemTimingDigi.h.

References cellInfo_.

96 { cellInfo_ = cellInfo & 0x3F; }
unsigned int cellInfo() const
void TotemTimingDigi::setEventInfo ( const TotemTimingEventInfo totemTimingEventInfo)
inline

Definition at line 107 of file TotemTimingDigi.h.

References totemTimingEventInfo_.

107  {
108  totemTimingEventInfo_ = totemTimingEventInfo;
109  }
TotemTimingEventInfo totemTimingEventInfo_
void TotemTimingDigi::setFPGATimestamp ( const uint64_t  fpgaTimestamp)
inline

Definition at line 90 of file TotemTimingDigi.h.

References fpgaTimestamp(), and fpgaTimestamp_.

unsigned int fpgaTimestamp() const
uint64_t fpgaTimestamp_
void TotemTimingDigi::setHardwareBoardId ( const unsigned int  boardId)
inline

Definition at line 75 of file TotemTimingDigi.h.

References hwId_.

75  {
76  hwId_ &= 0x1F; // set board bits to 0
77  hwId_ |= ((boardId & 0x07) << 5) & 0xE0;
78  }
void TotemTimingDigi::setHardwareChannelId ( const unsigned int  channelId)
inline

Definition at line 85 of file TotemTimingDigi.h.

References hwId_.

85  {
86  hwId_ &= 0xF0; // Set Sampic bit to 0
87  hwId_ |= (channelId & 0x0F) & 0x0F;
88  }
void TotemTimingDigi::setHardwareId ( const uint8_t  hwId)
inline

Set digi values Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id

Definition at line 73 of file TotemTimingDigi.h.

References hwId_.

73 { hwId_ = hwId; }
void TotemTimingDigi::setHardwareSampicId ( const unsigned int  sampicId)
inline

Definition at line 80 of file TotemTimingDigi.h.

References hwId_.

80  {
81  hwId_ &= 0xEF; // set Sampic bit to 0
82  hwId_ |= ((sampicId & 0x01) << 4) & 0x10;
83  }
void TotemTimingDigi::setSampleAt ( const unsigned int  i,
const uint8_t  sampleValue 
)
inline

Definition at line 102 of file TotemTimingDigi.h.

References samples_.

102  {
103  if (i < samples_.size())
104  samples_.at(i) = sampleValue;
105  }
std::vector< uint8_t > samples_
void TotemTimingDigi::setSamples ( const std::vector< uint8_t > &  samples)
inline

Definition at line 98 of file TotemTimingDigi.h.

References samples(), and samples_.

98 { samples_ = samples; }
std::vector< uint8_t > samples() const
std::vector< uint8_t > samples_
void TotemTimingDigi::setTimestampA ( const uint16_t  timestampA)
inline

Definition at line 92 of file TotemTimingDigi.h.

References timestampA(), and timestampA_.

unsigned int timestampA() const
void TotemTimingDigi::setTimestampB ( const uint16_t  timestampB)
inline

Definition at line 94 of file TotemTimingDigi.h.

References timestampB(), and timestampB_.

unsigned int timestampB() const
unsigned int TotemTimingDigi::timestampA ( ) const
inline

Definition at line 48 of file TotemTimingDigi.h.

References timestampA_.

Referenced by operator<<(), setTimestampA(), and TotemTimingConversions::timeOfFirstSample().

48 { return timestampA_; }
unsigned int TotemTimingDigi::timestampB ( ) const
inline

Definition at line 50 of file TotemTimingDigi.h.

References timestampB_.

Referenced by operator<<(), setTimestampB(), and TotemTimingConversions::timeOfFirstSample().

50 { return timestampB_; }

Member Data Documentation

uint16_t TotemTimingDigi::cellInfo_
private

Definition at line 116 of file TotemTimingDigi.h.

Referenced by cellInfo(), operator==(), and setCellInfo().

uint64_t TotemTimingDigi::fpgaTimestamp_
private

Definition at line 113 of file TotemTimingDigi.h.

Referenced by fpgaTimestamp(), operator==(), and setFPGATimestamp().

uint8_t TotemTimingDigi::hwId_
private
std::vector<uint8_t> TotemTimingDigi::samples_
private
uint16_t TotemTimingDigi::timestampA_
private

Definition at line 114 of file TotemTimingDigi.h.

Referenced by operator==(), setTimestampA(), and timestampA().

uint16_t TotemTimingDigi::timestampB_
private

Definition at line 115 of file TotemTimingDigi.h.

Referenced by operator==(), setTimestampB(), and timestampB().

TotemTimingEventInfo TotemTimingDigi::totemTimingEventInfo_
private

Definition at line 120 of file TotemTimingDigi.h.

Referenced by eventInfo(), and setEventInfo().