CMS 3D CMS Logo

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

#include <CSCCFEBTimeSlice.h>

Public Member Functions

unsigned calcCRC () const
 
bool check () const
 
bool checkCRC () const
 
 CSCCFEBTimeSlice ()
 
unsigned get_buffer_count () const
 
unsigned get_buffer_warning () const
 
unsigned get_crc () const
 accessors for words 97, 98 and 99 More...
 
unsigned get_L1A_number () const
 
unsigned get_l1pipe_empty () const
 
unsigned get_l1pipe_full () const
 
unsigned get_lctpipe_count () const
 
unsigned get_lctpipe_empty () const
 
unsigned get_lctpipe_full () const
 
unsigned get_n_free_sca_blocks () const
 
CSCCFEBSCAControllerWord scaControllerWord (int layer) const
 unpacked from the controller words for each channel in the layer More...
 
void set_L1Anumber (unsigned l1a)
 
void setControllerWord (const CSCCFEBSCAControllerWord &controllerWord)
 
void setCRC ()
 =VB= Set calculated CRC value for simulated CFEB Time Slice data More...
 
bool sixteenSamples () const
 whether we keep 8 or 16 time samples More...
 
unsigned sizeInWords () const
 
CSCCFEBDataWordtimeSample (int index) const
 input from 0 to 95 More...
 
CSCCFEBDataWordtimeSample (int layer, int channel, bool isDCFEB=false) const
 layer and element count from one More...
 

Private Attributes

unsigned blank_space_1: 4
 
unsigned blank_space_3: 4
 
unsigned buffer_count: 5
 
unsigned buffer_warning: 1
 WORD 99. More...
 
unsigned crc: 16
 WORD 97. More...
 
unsigned dummy: 16
 WORD 100. More...
 
unsigned L1A_number: 6
 
unsigned l1pipe_empty: 1
 
unsigned l1pipe_full: 1
 
unsigned lctpipe_count: 4
 
unsigned lctpipe_empty: 1
 
unsigned lctpipe_full: 1
 
unsigned n_free_sca_blocks: 4
 WORD 98. More...
 
unsigned short theSamples [96]
 

Friends

std::ostream & operator<< (std::ostream &os, const CSCCFEBTimeSlice &)
 

Detailed Description

Definition at line 52 of file CSCCFEBTimeSlice.h.

Constructor & Destructor Documentation

◆ CSCCFEBTimeSlice()

CSCCFEBTimeSlice::CSCCFEBTimeSlice ( )

Definition at line 14 of file CSCCFEBTimeSlice.cc.

References blank_space_1, and blank_space_3.

14  {
15  bzero(this, 99 * 2);
16  dummy = 0x7FFF;
17  blank_space_1 = 0x7;
18  blank_space_3 = 0x7;
19 }

Member Function Documentation

◆ calcCRC()

unsigned CSCCFEBTimeSlice::calcCRC ( ) const

Definition at line 63 of file CSCCFEBTimeSlice.cc.

References RawDataTask_cfi::CRC, and theSamples.

Referenced by checkCRC(), and setCRC().

63  {
64  unsigned CRC = 0;
65  for (uint16_t pos = 0; pos < 96; ++pos)
66  CRC = (theSamples[pos] & 0x1fff) ^ ((theSamples[pos] & 0x1fff) << 1) ^
67  (((CRC & 0x7ffc) >> 2) | ((0x0003 & CRC) << 13)) ^ ((CRC & 0x7ffc) >> 1);
68  return CRC;
69 }
unsigned short theSamples[96]

◆ check()

bool CSCCFEBTimeSlice::check ( ) const
inline

Old CFEB format: dummy word 100 should be 0x7FFF New CFEB format: the sum of word 97 and 100 should be 0x7FFF (word 100 is inverted word 97)

Definition at line 79 of file CSCCFEBTimeSlice.h.

References crc.

Referenced by CSCCFEBData::CSCCFEBData().

79 { return ((dummy == 0x7FFF) || ((dummy + crc) == 0x7FFF)); }
unsigned crc
WORD 97.

◆ checkCRC()

bool CSCCFEBTimeSlice::checkCRC ( ) const
inline

Definition at line 81 of file CSCCFEBTimeSlice.h.

References calcCRC(), and crc.

81 { return crc == calcCRC(); }
unsigned calcCRC() const
unsigned crc
WORD 97.

◆ get_buffer_count()

unsigned CSCCFEBTimeSlice::get_buffer_count ( ) const
inline

Definition at line 102 of file CSCCFEBTimeSlice.h.

References buffer_count.

Referenced by cscdqm::EventProcessor::processCSC().

102 { return buffer_count; }

◆ get_buffer_warning()

unsigned CSCCFEBTimeSlice::get_buffer_warning ( ) const
inline

Definition at line 101 of file CSCCFEBTimeSlice.h.

References buffer_warning.

101 { return buffer_warning; }
unsigned buffer_warning
WORD 99.

◆ get_crc()

unsigned CSCCFEBTimeSlice::get_crc ( ) const
inline

accessors for words 97, 98 and 99

Definition at line 94 of file CSCCFEBTimeSlice.h.

References crc.

94 { return crc; }
unsigned crc
WORD 97.

◆ get_L1A_number()

unsigned CSCCFEBTimeSlice::get_L1A_number ( ) const
inline

Definition at line 103 of file CSCCFEBTimeSlice.h.

References L1A_number.

103 { return L1A_number; }

◆ get_l1pipe_empty()

unsigned CSCCFEBTimeSlice::get_l1pipe_empty ( ) const
inline

Definition at line 100 of file CSCCFEBTimeSlice.h.

References l1pipe_empty.

Referenced by cscdqm::EventProcessor::processCSC().

100 { return l1pipe_empty; }

◆ get_l1pipe_full()

unsigned CSCCFEBTimeSlice::get_l1pipe_full ( ) const
inline

Definition at line 98 of file CSCCFEBTimeSlice.h.

References l1pipe_full.

Referenced by cscdqm::EventProcessor::processCSC().

98 { return l1pipe_full; }

◆ get_lctpipe_count()

unsigned CSCCFEBTimeSlice::get_lctpipe_count ( ) const
inline

Definition at line 96 of file CSCCFEBTimeSlice.h.

References lctpipe_count.

Referenced by cscdqm::EventProcessor::processCSC().

96 { return lctpipe_count; }

◆ get_lctpipe_empty()

unsigned CSCCFEBTimeSlice::get_lctpipe_empty ( ) const
inline

Definition at line 99 of file CSCCFEBTimeSlice.h.

References lctpipe_empty.

Referenced by cscdqm::EventProcessor::processCSC().

99 { return lctpipe_empty; }

◆ get_lctpipe_full()

unsigned CSCCFEBTimeSlice::get_lctpipe_full ( ) const
inline

Definition at line 97 of file CSCCFEBTimeSlice.h.

References lctpipe_full.

Referenced by cscdqm::EventProcessor::processCSC().

97 { return lctpipe_full; }

◆ get_n_free_sca_blocks()

unsigned CSCCFEBTimeSlice::get_n_free_sca_blocks ( ) const
inline

Definition at line 95 of file CSCCFEBTimeSlice.h.

References n_free_sca_blocks.

Referenced by cscdqm::EventProcessor::processCSC().

95 { return n_free_sca_blocks; }
unsigned n_free_sca_blocks
WORD 98.

◆ scaControllerWord()

CSCCFEBSCAControllerWord CSCCFEBTimeSlice::scaControllerWord ( int  layer) const

unpacked from the controller words for each channel in the layer

Definition at line 46 of file CSCCFEBTimeSlice.cc.

References CSCCFEBDataWord::controllerData, mps_fire::i, phase1PixelTopology::layer, mps_fire::result, and timeSample().

Referenced by cscdqm::EventProcessor::processCSC().

46  {
47  unsigned int result = 0;
48  for (unsigned i = 0; i < 16; ++i) {
49  result |= timeSample(i * 6 + layer - 1)->controllerData << i;
50  }
52 }
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned short controllerData
combined from all 16 strips to make a word

◆ set_L1Anumber()

void CSCCFEBTimeSlice::set_L1Anumber ( unsigned  l1a)
inline

Definition at line 105 of file CSCCFEBTimeSlice.h.

References L1A_number.

105 { L1A_number = l1a & 0x3F; }

◆ setControllerWord()

void CSCCFEBTimeSlice::setControllerWord ( const CSCCFEBSCAControllerWord controllerWord)

Definition at line 54 of file CSCCFEBTimeSlice.cc.

References CSCCFEBDataWord::controllerData, phase1PixelTopology::layer, CSCDetId::maxLayerId(), CSCDetId::minLayerId(), and timeSample().

54  {
56  for (int channel = 1; channel <= 16; ++channel) {
57  const unsigned short *shortWord = reinterpret_cast<const unsigned short *>(&controllerWord);
58  timeSample(layer, channel)->controllerData = (*shortWord >> (channel - 1)) & 1;
59  }
60  }
61 }
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned short controllerData
combined from all 16 strips to make a word
static int minLayerId()
Definition: CSCDetId.h:242
static int maxLayerId()
Definition: CSCDetId.h:243

◆ setCRC()

void CSCCFEBTimeSlice::setCRC ( )
inline

=VB= Set calculated CRC value for simulated CFEB Time Slice data

Definition at line 86 of file CSCCFEBTimeSlice.h.

References calcCRC(), and crc.

86  {
87  crc = calcCRC();
88  dummy = 0x7FFF - crc;
89  }
unsigned calcCRC() const
unsigned crc
WORD 97.

◆ sixteenSamples()

bool CSCCFEBTimeSlice::sixteenSamples ( ) const
inline

whether we keep 8 or 16 time samples

Definition at line 67 of file CSCCFEBTimeSlice.h.

References CSCCFEBDataWord::controllerData, and timeSample().

Referenced by CSCCFEBData::CSCCFEBData().

67  { /*return scaControllerWord(1).ts_flag;i*/
68  return timeSample(95)->controllerData;
69  }
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short controllerData
combined from all 16 strips to make a word

◆ sizeInWords()

unsigned CSCCFEBTimeSlice::sizeInWords ( ) const
inline

Definition at line 70 of file CSCCFEBTimeSlice.h.

Referenced by CSCCFEBData::CSCCFEBData().

70 { return 100; }

◆ timeSample() [1/2]

CSCCFEBDataWord* CSCCFEBTimeSlice::timeSample ( int  index) const
inline

input from 0 to 95

Definition at line 57 of file CSCCFEBTimeSlice.h.

References theSamples.

Referenced by scaControllerWord(), setControllerWord(), sixteenSamples(), and timeSample().

◆ timeSample() [2/2]

CSCCFEBDataWord * CSCCFEBTimeSlice::timeSample ( int  layer,
int  channel,
bool  isDCFEB = false 
) const

layer and element count from one

!!! Important change. Use isDCFEB flag in user code to distinguish between CFEB and DCFEB !!! Use CSCCFEBData::isDCFEB() function to get this flag from CSCCFEBData object

!! New DCFEBs don't use gray coding for channels

Definition at line 32 of file CSCCFEBTimeSlice.cc.

References cms::cuda::assert(), channelInverseGrayCode, phase1PixelTopology::layer, layerInverseGrayCode, CSCDetId::maxLayerId(), CSCDetId::minLayerId(), timeSample(), and mitigatedMETSequence_cff::U.

32  {
35  assert(channel >= 1 && channel <= 16);
36  int layerIndex = layerInverseGrayCode[layer - 1];
37 
38  unsigned channelIndex = channelInverseGrayCode[channel - 1];
39  if (isDCFEB)
40  channelIndex = channel - 1;
41  unsigned scaBin = channelIndex * 6 + layerIndex;
42  assert(scaBin < 96U); // scaBin >= 0, since scaBin is unsigned
43  return timeSample(scaBin);
44 }
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
const unsigned channelInverseGrayCode[]
assert(be >=bs)
constexpr std::array< uint8_t, layerIndexSize > layer
static int minLayerId()
Definition: CSCDetId.h:242
const unsigned layerInverseGrayCode[]
static int maxLayerId()
Definition: CSCDetId.h:243

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const CSCCFEBTimeSlice slice 
)
friend

Definition at line 71 of file CSCCFEBTimeSlice.cc.

71  {
72  for (int ichannel = 1; ichannel <= 16; ++ichannel) {
73  for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ++ilayer) {
74  //unsigned index = (ilayer-1) + (ichannel-1)*6;
75  //int value = (slice.timeSample(index))->adcCounts - 560;
76  int value = (slice.timeSample(ilayer, ichannel))->adcCounts - 560;
77  os << " " << std::setw(5) << std::dec << value;
78  }
79  os << std::endl;
80  }
81  return os;
82 }
Definition: value.py:1
static int minLayerId()
Definition: CSCDetId.h:242
static int maxLayerId()
Definition: CSCDetId.h:243

Member Data Documentation

◆ blank_space_1

unsigned CSCCFEBTimeSlice::blank_space_1
private

Definition at line 120 of file CSCCFEBTimeSlice.h.

Referenced by CSCCFEBTimeSlice().

◆ blank_space_3

unsigned CSCCFEBTimeSlice::blank_space_3
private

Definition at line 126 of file CSCCFEBTimeSlice.h.

Referenced by CSCCFEBTimeSlice().

◆ buffer_count

unsigned CSCCFEBTimeSlice::buffer_count
private

Definition at line 124 of file CSCCFEBTimeSlice.h.

Referenced by get_buffer_count().

◆ buffer_warning

unsigned CSCCFEBTimeSlice::buffer_warning
private

WORD 99.

Definition at line 123 of file CSCCFEBTimeSlice.h.

Referenced by get_buffer_warning().

◆ crc

unsigned CSCCFEBTimeSlice::crc
private

WORD 97.

Definition at line 111 of file CSCCFEBTimeSlice.h.

Referenced by check(), checkCRC(), get_crc(), and setCRC().

◆ dummy

unsigned CSCCFEBTimeSlice::dummy
private

WORD 100.

Definition at line 129 of file CSCCFEBTimeSlice.h.

◆ L1A_number

unsigned CSCCFEBTimeSlice::L1A_number
private

Definition at line 125 of file CSCCFEBTimeSlice.h.

Referenced by get_L1A_number(), and set_L1Anumber().

◆ l1pipe_empty

unsigned CSCCFEBTimeSlice::l1pipe_empty
private

Definition at line 119 of file CSCCFEBTimeSlice.h.

Referenced by get_l1pipe_empty().

◆ l1pipe_full

unsigned CSCCFEBTimeSlice::l1pipe_full
private

Definition at line 117 of file CSCCFEBTimeSlice.h.

Referenced by get_l1pipe_full().

◆ lctpipe_count

unsigned CSCCFEBTimeSlice::lctpipe_count
private

Definition at line 115 of file CSCCFEBTimeSlice.h.

Referenced by get_lctpipe_count().

◆ lctpipe_empty

unsigned CSCCFEBTimeSlice::lctpipe_empty
private

Definition at line 118 of file CSCCFEBTimeSlice.h.

Referenced by get_lctpipe_empty().

◆ lctpipe_full

unsigned CSCCFEBTimeSlice::lctpipe_full
private

Definition at line 116 of file CSCCFEBTimeSlice.h.

Referenced by get_lctpipe_full().

◆ n_free_sca_blocks

unsigned CSCCFEBTimeSlice::n_free_sca_blocks
private

WORD 98.

Definition at line 114 of file CSCCFEBTimeSlice.h.

Referenced by get_n_free_sca_blocks().

◆ theSamples

unsigned short CSCCFEBTimeSlice::theSamples[96]
private

Definition at line 108 of file CSCCFEBTimeSlice.h.

Referenced by calcCRC(), and timeSample().