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 ()
 

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() [1/2]

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
unsigned int timestampB() const
unsigned int fpgaTimestamp() const
std::vector< uint8_t > samples() const
uint64_t fpgaTimestamp_
std::vector< uint8_t > samples_
unsigned int cellInfo() const

◆ TotemTimingDigi() [2/2]

TotemTimingDigi::TotemTimingDigi ( )

Definition at line 25 of file TotemTimingDigi.cc.

Member Function Documentation

◆ addSample()

void TotemTimingDigi::addSample ( const uint8_t  sampleValue)
inline

Definition at line 98 of file TotemTimingDigi.h.

References samples_.

98 { samples_.emplace_back(sampleValue); }
std::vector< uint8_t > samples_

◆ cellInfo()

unsigned int TotemTimingDigi::cellInfo ( ) const
inline

◆ eventInfo()

TotemTimingEventInfo TotemTimingDigi::eventInfo ( ) const
inline

◆ fpgaTimestamp()

unsigned int TotemTimingDigi::fpgaTimestamp ( ) const
inline

Definition at line 44 of file TotemTimingDigi.h.

References fpgaTimestamp_.

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

44 { return fpgaTimestamp_; }
uint64_t fpgaTimestamp_

◆ hardwareBoardId()

unsigned int TotemTimingDigi::hardwareBoardId ( ) const
inline

◆ hardwareChannelId()

unsigned int TotemTimingDigi::hardwareChannelId ( ) const
inline

◆ hardwareId()

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 36 of file TotemTimingDigi.h.

References hwId_.

Referenced by operator<<().

36 { return hwId_; }

◆ hardwareSampicId()

unsigned int TotemTimingDigi::hardwareSampicId ( ) const
inline

◆ numberOfSamples()

unsigned int TotemTimingDigi::numberOfSamples ( ) const
inline

Definition at line 58 of file TotemTimingDigi.h.

References samples_.

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

58 { return samples_.size(); }
std::vector< uint8_t > samples_

◆ operator==()

bool TotemTimingDigi::operator== ( const TotemTimingDigi digi) const

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

Definition at line 28 of file TotemTimingDigi.cc.

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

28  {
29  if (hwId_ != digi.hwId_ || fpgaTimestamp_ != digi.fpgaTimestamp_ || timestampA_ != digi.timestampA_ ||
30  timestampB_ != digi.timestampB_ || cellInfo_ != digi.cellInfo_ || samples_ != digi.samples_)
31  return false;
32  return true;
33 }
uint64_t fpgaTimestamp_
std::vector< uint8_t > samples_

◆ sampleAt()

int TotemTimingDigi::sampleAt ( const unsigned int  i) const
inline

Definition at line 60 of file TotemTimingDigi.h.

References mps_fire::i, and samples_.

60  {
61  int sampleValue = -1;
62  if (i < samples_.size())
63  sampleValue = (int)samples_.at(i);
64  return sampleValue;
65  }
std::vector< uint8_t > samples_

◆ samples()

std::vector<uint8_t> TotemTimingDigi::samples ( ) const
inline

Definition at line 52 of file TotemTimingDigi.h.

References samples_.

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

52 { return samples_; }
std::vector< uint8_t > samples_

◆ samplesBegin()

std::vector<uint8_t>::const_iterator TotemTimingDigi::samplesBegin ( ) const
inline

Definition at line 54 of file TotemTimingDigi.h.

References samples_.

54 { return samples_.cbegin(); }
std::vector< uint8_t > samples_

◆ samplesEnd()

std::vector<uint8_t>::const_iterator TotemTimingDigi::samplesEnd ( ) const
inline

Definition at line 56 of file TotemTimingDigi.h.

References samples_.

56 { return samples_.cend(); }
std::vector< uint8_t > samples_

◆ setCellInfo()

void TotemTimingDigi::setCellInfo ( const uint16_t  cellInfo)
inline

Definition at line 94 of file TotemTimingDigi.h.

References cellInfo(), and cellInfo_.

94 { cellInfo_ = cellInfo & 0x3F; }
unsigned int cellInfo() const

◆ setEventInfo()

void TotemTimingDigi::setEventInfo ( const TotemTimingEventInfo totemTimingEventInfo)
inline

Definition at line 105 of file TotemTimingDigi.h.

References totemTimingEventInfo_.

105  {
106  totemTimingEventInfo_ = totemTimingEventInfo;
107  }
TotemTimingEventInfo totemTimingEventInfo_

◆ setFPGATimestamp()

void TotemTimingDigi::setFPGATimestamp ( const uint64_t  fpgaTimestamp)
inline

Definition at line 88 of file TotemTimingDigi.h.

References fpgaTimestamp(), and fpgaTimestamp_.

unsigned int fpgaTimestamp() const
uint64_t fpgaTimestamp_

◆ setHardwareBoardId()

void TotemTimingDigi::setHardwareBoardId ( const unsigned int  boardId)
inline

Definition at line 73 of file TotemTimingDigi.h.

References amcDumpToRaw_cfi::boardId, and hwId_.

73  {
74  hwId_ &= 0x1F; // set board bits to 0
75  hwId_ |= ((boardId & 0x07) << 5) & 0xE0;
76  }

◆ setHardwareChannelId()

void TotemTimingDigi::setHardwareChannelId ( const unsigned int  channelId)
inline

Definition at line 83 of file TotemTimingDigi.h.

References hwId_.

83  {
84  hwId_ &= 0xF0; // Set Sampic bit to 0
85  hwId_ |= (channelId & 0x0F) & 0x0F;
86  }

◆ setHardwareId()

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 71 of file TotemTimingDigi.h.

References hwId_.

71 { hwId_ = hwId; }

◆ setHardwareSampicId()

void TotemTimingDigi::setHardwareSampicId ( const unsigned int  sampicId)
inline

Definition at line 78 of file TotemTimingDigi.h.

References hwId_.

78  {
79  hwId_ &= 0xEF; // set Sampic bit to 0
80  hwId_ |= ((sampicId & 0x01) << 4) & 0x10;
81  }

◆ setSampleAt()

void TotemTimingDigi::setSampleAt ( const unsigned int  i,
const uint8_t  sampleValue 
)
inline

Definition at line 100 of file TotemTimingDigi.h.

References mps_fire::i, and samples_.

100  {
101  if (i < samples_.size())
102  samples_.at(i) = sampleValue;
103  }
std::vector< uint8_t > samples_

◆ setSamples()

void TotemTimingDigi::setSamples ( const std::vector< uint8_t > &  samples)
inline

Definition at line 96 of file TotemTimingDigi.h.

References samples(), and samples_.

96 { samples_ = samples; }
std::vector< uint8_t > samples() const
std::vector< uint8_t > samples_

◆ setTimestampA()

void TotemTimingDigi::setTimestampA ( const uint16_t  timestampA)
inline

Definition at line 90 of file TotemTimingDigi.h.

References timestampA(), and timestampA_.

unsigned int timestampA() const

◆ setTimestampB()

void TotemTimingDigi::setTimestampB ( const uint16_t  timestampB)
inline

Definition at line 92 of file TotemTimingDigi.h.

References timestampB(), and timestampB_.

unsigned int timestampB() const

◆ timestampA()

unsigned int TotemTimingDigi::timestampA ( ) const
inline

Definition at line 46 of file TotemTimingDigi.h.

References timestampA_.

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

46 { return timestampA_; }

◆ timestampB()

unsigned int TotemTimingDigi::timestampB ( ) const
inline

Definition at line 48 of file TotemTimingDigi.h.

References timestampB_.

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

48 { return timestampB_; }

Member Data Documentation

◆ cellInfo_

uint16_t TotemTimingDigi::cellInfo_
private

Definition at line 114 of file TotemTimingDigi.h.

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

◆ fpgaTimestamp_

uint64_t TotemTimingDigi::fpgaTimestamp_
private

Definition at line 111 of file TotemTimingDigi.h.

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

◆ hwId_

uint8_t TotemTimingDigi::hwId_
private

◆ samples_

std::vector<uint8_t> TotemTimingDigi::samples_
private

◆ timestampA_

uint16_t TotemTimingDigi::timestampA_
private

Definition at line 112 of file TotemTimingDigi.h.

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

◆ timestampB_

uint16_t TotemTimingDigi::timestampB_
private

Definition at line 113 of file TotemTimingDigi.h.

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

◆ totemTimingEventInfo_

TotemTimingEventInfo TotemTimingDigi::totemTimingEventInfo_
private

Definition at line 118 of file TotemTimingDigi.h.

Referenced by eventInfo(), and setEventInfo().