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 ()
 
 TotemTimingDigi (const TotemTimingDigi &digi)
 
 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/3]

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) {}

◆ TotemTimingDigi() [2/3]

TotemTimingDigi::TotemTimingDigi ( const TotemTimingDigi digi)

Definition at line 25 of file TotemTimingDigi.cc.

◆ TotemTimingDigi() [3/3]

TotemTimingDigi::TotemTimingDigi ( )

Definition at line 34 of file TotemTimingDigi.cc.

◆ ~TotemTimingDigi()

TotemTimingDigi::~TotemTimingDigi ( )
inline

Definition at line 30 of file TotemTimingDigi.h.

30 {};

Member Function Documentation

◆ addSample()

void TotemTimingDigi::addSample ( const uint8_t  sampleValue)
inline

Definition at line 100 of file TotemTimingDigi.h.

100 { samples_.emplace_back(sampleValue); }

References samples_.

◆ cellInfo()

unsigned int TotemTimingDigi::cellInfo ( ) const
inline

◆ eventInfo()

TotemTimingEventInfo TotemTimingDigi::eventInfo ( ) const
inline

◆ fpgaTimestamp()

unsigned int TotemTimingDigi::fpgaTimestamp ( ) const
inline

Definition at line 46 of file TotemTimingDigi.h.

46 { return fpgaTimestamp_; }

References fpgaTimestamp_.

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

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

38 { return hwId_; }

References hwId_.

Referenced by operator<<().

◆ hardwareSampicId()

unsigned int TotemTimingDigi::hardwareSampicId ( ) const
inline

◆ numberOfSamples()

unsigned int TotemTimingDigi::numberOfSamples ( ) const
inline

Definition at line 60 of file TotemTimingDigi.h.

60 { return samples_.size(); }

References samples_.

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

◆ 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 37 of file TotemTimingDigi.cc.

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 }

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

◆ sampleAt()

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

Definition at line 62 of file TotemTimingDigi.h.

62  {
63  int sampleValue = -1;
64  if (i < samples_.size())
65  sampleValue = (int)samples_.at(i);
66  return sampleValue;
67  }

References mps_fire::i, and samples_.

◆ samples()

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

Definition at line 54 of file TotemTimingDigi.h.

54 { return samples_; }

References samples_.

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

◆ samplesBegin()

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

Definition at line 56 of file TotemTimingDigi.h.

56 { return samples_.cbegin(); }

References samples_.

◆ samplesEnd()

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

Definition at line 58 of file TotemTimingDigi.h.

58 { return samples_.cend(); }

References samples_.

◆ setCellInfo()

void TotemTimingDigi::setCellInfo ( const uint16_t  cellInfo)
inline

Definition at line 96 of file TotemTimingDigi.h.

96 { cellInfo_ = cellInfo & 0x3F; }

References cellInfo(), and cellInfo_.

◆ setEventInfo()

void TotemTimingDigi::setEventInfo ( const TotemTimingEventInfo totemTimingEventInfo)
inline

Definition at line 107 of file TotemTimingDigi.h.

107  {
108  totemTimingEventInfo_ = totemTimingEventInfo;
109  }

References totemTimingEventInfo_.

◆ setFPGATimestamp()

void TotemTimingDigi::setFPGATimestamp ( const uint64_t  fpgaTimestamp)
inline

Definition at line 90 of file TotemTimingDigi.h.

References fpgaTimestamp(), and fpgaTimestamp_.

◆ setHardwareBoardId()

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

Definition at line 75 of file TotemTimingDigi.h.

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

References amcDumpToRaw_cfi::boardId, and hwId_.

◆ setHardwareChannelId()

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

Definition at line 85 of file TotemTimingDigi.h.

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

References hwId_.

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

73 { hwId_ = hwId; }

References hwId_.

◆ setHardwareSampicId()

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

Definition at line 80 of file TotemTimingDigi.h.

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

References hwId_.

◆ setSampleAt()

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

Definition at line 102 of file TotemTimingDigi.h.

102  {
103  if (i < samples_.size())
104  samples_.at(i) = sampleValue;
105  }

References mps_fire::i, and samples_.

◆ setSamples()

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

Definition at line 98 of file TotemTimingDigi.h.

98 { samples_ = samples; }

References samples(), and samples_.

◆ setTimestampA()

void TotemTimingDigi::setTimestampA ( const uint16_t  timestampA)
inline

Definition at line 92 of file TotemTimingDigi.h.

References timestampA(), and timestampA_.

◆ setTimestampB()

void TotemTimingDigi::setTimestampB ( const uint16_t  timestampB)
inline

Definition at line 94 of file TotemTimingDigi.h.

References timestampB(), and timestampB_.

◆ timestampA()

unsigned int TotemTimingDigi::timestampA ( ) const
inline

Definition at line 48 of file TotemTimingDigi.h.

48 { return timestampA_; }

References timestampA_.

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

◆ timestampB()

unsigned int TotemTimingDigi::timestampB ( ) const
inline

Definition at line 50 of file TotemTimingDigi.h.

50 { return timestampB_; }

References timestampB_.

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

Member Data Documentation

◆ cellInfo_

uint16_t TotemTimingDigi::cellInfo_
private

Definition at line 116 of file TotemTimingDigi.h.

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

◆ fpgaTimestamp_

uint64_t TotemTimingDigi::fpgaTimestamp_
private

Definition at line 113 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 114 of file TotemTimingDigi.h.

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

◆ timestampB_

uint16_t TotemTimingDigi::timestampB_
private

Definition at line 115 of file TotemTimingDigi.h.

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

◆ totemTimingEventInfo_

TotemTimingEventInfo TotemTimingDigi::totemTimingEventInfo_
private

Definition at line 120 of file TotemTimingDigi.h.

Referenced by eventInfo(), and setEventInfo().

TotemTimingDigi::hwId_
uint8_t hwId_
Definition: TotemTimingDigi.h:112
mps_fire.i
i
Definition: mps_fire.py:428
amcDumpToRaw_cfi.boardId
boardId
Definition: amcDumpToRaw_cfi.py:9
TotemTimingDigi::timestampA
unsigned int timestampA() const
Definition: TotemTimingDigi.h:48
TotemTimingDigi::totemTimingEventInfo_
TotemTimingEventInfo totemTimingEventInfo_
Definition: TotemTimingDigi.h:120
TotemTimingDigi::timestampB_
uint16_t timestampB_
Definition: TotemTimingDigi.h:115
TotemTimingDigi::fpgaTimestamp
unsigned int fpgaTimestamp() const
Definition: TotemTimingDigi.h:46
TotemTimingDigi::cellInfo
unsigned int cellInfo() const
Definition: TotemTimingDigi.h:52
TotemTimingDigi::timestampA_
uint16_t timestampA_
Definition: TotemTimingDigi.h:114
TotemTimingDigi::samples_
std::vector< uint8_t > samples_
Definition: TotemTimingDigi.h:118
TotemTimingDigi::cellInfo_
uint16_t cellInfo_
Definition: TotemTimingDigi.h:116
TotemTimingDigi::timestampB
unsigned int timestampB() const
Definition: TotemTimingDigi.h:50
TotemTimingDigi::fpgaTimestamp_
uint64_t fpgaTimestamp_
Definition: TotemTimingDigi.h:113
TotemTimingDigi::samples
std::vector< uint8_t > samples() const
Definition: TotemTimingDigi.h:54