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 getCellInfo () const
 
TotemTimingEventInfo getEventInfo () const
 
unsigned int getFPGATimestamp () const
 
unsigned int getHardwareBoardId () const
 
unsigned int getHardwareChannelId () const
 
unsigned int getHardwareId () const
 Return digi values number. More...
 
unsigned int getHardwareSampicId () const
 
unsigned int getNumberOfSamples () const
 
int getSampleAt (const unsigned int i) const
 
std::vector< uint8_t > getSamples () const
 
std::vector< uint8_t >::const_iterator getSamplesBegin () const
 
std::vector< uint8_t >::const_iterator getSamplesEnd () const
 
unsigned int getTimestampA () const
 
unsigned int getTimestampB () const
 
bool operator== (const TotemTimingDigi &digi) const
 Digis are equal if they have all the same values, NOT checking the samples! More...
 
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)
 
 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.

13  :
14  hwId_( hwId ), fpgaTimestamp_( fpgaTimestamp ), timestampA_( timestampA ), timestampB_( timestampB ),
15  cellInfo_( cellInfo ), samples_( samples ), totemTimingEventInfo_( totemTimingEventInfo )
16 {}
TotemTimingEventInfo totemTimingEventInfo_
uint64_t fpgaTimestamp_
std::vector< uint8_t > samples_
TotemTimingDigi::TotemTimingDigi ( const TotemTimingDigi digi)

Definition at line 18 of file TotemTimingDigi.cc.

18  :
21 {}
TotemTimingEventInfo totemTimingEventInfo_
uint64_t fpgaTimestamp_
std::vector< uint8_t > samples_
TotemTimingDigi::TotemTimingDigi ( )

Definition at line 23 of file TotemTimingDigi.cc.

23  :
24  hwId_( 0 ), fpgaTimestamp_( 0 ), timestampA_( 0 ), timestampB_( 0 ), cellInfo_( 0 )
25 {}
uint64_t fpgaTimestamp_
TotemTimingDigi::~TotemTimingDigi ( )
inline

Definition at line 25 of file TotemTimingDigi.h.

References operator==().

25 {};

Member Function Documentation

void TotemTimingDigi::addSample ( const uint8_t  sampleValue)
inline

Definition at line 156 of file TotemTimingDigi.h.

References samples_.

157  {
158  samples_.emplace_back( sampleValue );
159  }
std::vector< uint8_t > samples_
unsigned int TotemTimingDigi::getCellInfo ( ) const
inline

Definition at line 68 of file TotemTimingDigi.h.

References cellInfo_.

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

69  {
70  return cellInfo_;
71  }
TotemTimingEventInfo TotemTimingDigi::getEventInfo ( ) const
inline

Definition at line 101 of file TotemTimingDigi.h.

References totemTimingEventInfo_.

Referenced by TotemTimingConversions::getTimeOfFirstSample(), TotemTimingConversions::getTriggerTime(), operator<(), and operator<<().

102  {
103  return totemTimingEventInfo_;
104  }
TotemTimingEventInfo totemTimingEventInfo_
unsigned int TotemTimingDigi::getFPGATimestamp ( ) const
inline

Definition at line 53 of file TotemTimingDigi.h.

References fpgaTimestamp_.

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

54  {
55  return fpgaTimestamp_;
56  }
uint64_t fpgaTimestamp_
unsigned int TotemTimingDigi::getHardwareBoardId ( ) const
inline

Definition at line 38 of file TotemTimingDigi.h.

References hwId_.

Referenced by operator<<().

39  {
40  return ( hwId_ & 0xE0 ) >> 5;
41  }
unsigned int TotemTimingDigi::getHardwareChannelId ( ) const
inline

Definition at line 48 of file TotemTimingDigi.h.

References hwId_.

Referenced by operator<<().

49  {
50  return ( hwId_ & 0x0F );
51  }
unsigned int TotemTimingDigi::getHardwareId ( ) 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 33 of file TotemTimingDigi.h.

References hwId_.

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

34  {
35  return hwId_;
36  }
unsigned int TotemTimingDigi::getHardwareSampicId ( ) const
inline

Definition at line 43 of file TotemTimingDigi.h.

References hwId_.

Referenced by operator<<().

44  {
45  return ( hwId_ & 0x10 ) >> 4;
46  }
unsigned int TotemTimingDigi::getNumberOfSamples ( ) const
inline

Definition at line 88 of file TotemTimingDigi.h.

References samples_.

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

89  {
90  return samples_.size();
91  }
std::vector< uint8_t > samples_
int TotemTimingDigi::getSampleAt ( const unsigned int  i) const
inline

Definition at line 93 of file TotemTimingDigi.h.

References samples_.

94  {
95  int sampleValue = -1;
96  if ( i < samples_.size() )
97  sampleValue = (int) samples_.at( i );
98  return sampleValue;
99  }
std::vector< uint8_t > samples_
std::vector<uint8_t> TotemTimingDigi::getSamples ( ) const
inline

Definition at line 73 of file TotemTimingDigi.h.

References samples_.

74  {
75  return samples_;
76  }
std::vector< uint8_t > samples_
std::vector<uint8_t>::const_iterator TotemTimingDigi::getSamplesBegin ( ) const
inline

Definition at line 78 of file TotemTimingDigi.h.

References samples_.

Referenced by TotemTimingConversions::getVoltSamples().

79  {
80  return samples_.cbegin();
81  }
std::vector< uint8_t > samples_
std::vector<uint8_t>::const_iterator TotemTimingDigi::getSamplesEnd ( ) const
inline

Definition at line 83 of file TotemTimingDigi.h.

References samples_.

Referenced by TotemTimingConversions::getVoltSamples().

84  {
85  return samples_.cend();
86  }
std::vector< uint8_t > samples_
unsigned int TotemTimingDigi::getTimestampA ( ) const
inline

Definition at line 58 of file TotemTimingDigi.h.

References timestampA_.

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

59  {
60  return timestampA_;
61  }
unsigned int TotemTimingDigi::getTimestampB ( ) const
inline

Definition at line 63 of file TotemTimingDigi.h.

References timestampB_.

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

64  {
65  return timestampB_;
66  }
bool TotemTimingDigi::operator== ( const TotemTimingDigi digi) const

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

Definition at line 29 of file TotemTimingDigi.cc.

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

Referenced by ~TotemTimingDigi().

30 {
31  if ( hwId_ != digi.hwId_
33  || timestampA_ != digi.timestampA_
34  || timestampB_ != digi.timestampB_
35  || cellInfo_ != digi.cellInfo_
36  || samples_ != digi.samples_
37  ) return false;
38  return true;
39 }
uint64_t fpgaTimestamp_
std::vector< uint8_t > samples_
void TotemTimingDigi::setCellInfo ( const uint16_t  cellInfo)
inline

Definition at line 146 of file TotemTimingDigi.h.

References cellInfo_.

147  {
148  cellInfo_ = cellInfo & 0x3F;
149  }
void TotemTimingDigi::setEventInfo ( const TotemTimingEventInfo totemTimingEventInfo)
inline

Definition at line 167 of file TotemTimingDigi.h.

References totemTimingEventInfo_.

168  {
169  totemTimingEventInfo_ = totemTimingEventInfo;
170  }
TotemTimingEventInfo totemTimingEventInfo_
void TotemTimingDigi::setFPGATimestamp ( const uint64_t  fpgaTimestamp)
inline

Definition at line 131 of file TotemTimingDigi.h.

References fpgaTimestamp_.

132  {
133  fpgaTimestamp_ = fpgaTimestamp;
134  }
uint64_t fpgaTimestamp_
void TotemTimingDigi::setHardwareBoardId ( const unsigned int  boardId)
inline

Definition at line 113 of file TotemTimingDigi.h.

References hwId_.

114  {
115  hwId_ &= 0x1F; // set board bits to 0
116  hwId_ |= ( ( boardId & 0x07 ) << 5 ) & 0xE0;
117  }
void TotemTimingDigi::setHardwareChannelId ( const unsigned int  channelId)
inline

Definition at line 125 of file TotemTimingDigi.h.

References hwId_.

126  {
127  hwId_ &= 0xF0; // Set Sampic bit to 0
128  hwId_ |= ( channelId & 0x0F ) & 0x0F;
129  }
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 108 of file TotemTimingDigi.h.

References hwId_.

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

Definition at line 119 of file TotemTimingDigi.h.

References hwId_.

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

Definition at line 161 of file TotemTimingDigi.h.

References samples_.

162  {
163  if ( i < samples_.size() )
164  samples_.at(i) = sampleValue;
165  }
std::vector< uint8_t > samples_
void TotemTimingDigi::setSamples ( const std::vector< uint8_t > &  samples)
inline

Definition at line 151 of file TotemTimingDigi.h.

References hcalTTPDigis_cfi::samples, and samples_.

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

Definition at line 136 of file TotemTimingDigi.h.

References timestampA_.

137  {
138  timestampA_ = timestampA;
139  }
void TotemTimingDigi::setTimestampB ( const uint16_t  timestampB)
inline

Definition at line 141 of file TotemTimingDigi.h.

References timestampB_.

142  {
143  timestampB_ = timestampB;
144  }

Member Data Documentation

uint16_t TotemTimingDigi::cellInfo_
private

Definition at line 177 of file TotemTimingDigi.h.

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

uint64_t TotemTimingDigi::fpgaTimestamp_
private

Definition at line 174 of file TotemTimingDigi.h.

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

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

Definition at line 175 of file TotemTimingDigi.h.

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

uint16_t TotemTimingDigi::timestampB_
private

Definition at line 176 of file TotemTimingDigi.h.

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

TotemTimingEventInfo TotemTimingDigi::totemTimingEventInfo_
private

Definition at line 181 of file TotemTimingDigi.h.

Referenced by getEventInfo(), and setEventInfo().