test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 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 56 of file CSCCFEBTimeSlice.h.

Constructor & Destructor Documentation

CSCCFEBTimeSlice::CSCCFEBTimeSlice ( )

Definition at line 13 of file CSCCFEBTimeSlice.cc.

References blank_space_1, blank_space_3, and dummy.

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

Member Function Documentation

unsigned CSCCFEBTimeSlice::calcCRC ( ) const

Definition at line 72 of file CSCCFEBTimeSlice.cc.

References theSamples.

Referenced by checkCRC(), and setCRC().

73 {
74  unsigned CRC=0;
75  for(uint16_t pos=0; pos<96; ++pos)
76  CRC=(theSamples[pos]&0x1fff)^((theSamples[pos]&0x1fff)<<1)^(((CRC&0x7ffc)>>2)|((0x0003&CRC)<<13))^((CRC&0x7ffc)>>1);
77  return CRC;
78 }
unsigned short theSamples[96]
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 85 of file CSCCFEBTimeSlice.h.

References crc, and dummy.

Referenced by CSCCFEBData::CSCCFEBData().

85 {return ((dummy == 0x7FFF)||((dummy+crc)== 0x7FFF));}
unsigned crc
WORD 97.
unsigned dummy
WORD 100.
bool CSCCFEBTimeSlice::checkCRC ( ) const
inline

Definition at line 87 of file CSCCFEBTimeSlice.h.

References calcCRC(), and crc.

87 {return crc==calcCRC();}
unsigned calcCRC() const
unsigned crc
WORD 97.
unsigned CSCCFEBTimeSlice::get_buffer_count ( ) const
inline

Definition at line 106 of file CSCCFEBTimeSlice.h.

References buffer_count.

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

106 {return buffer_count;}
unsigned CSCCFEBTimeSlice::get_buffer_warning ( ) const
inline

Definition at line 105 of file CSCCFEBTimeSlice.h.

References buffer_warning.

105 {return buffer_warning;}
unsigned buffer_warning
WORD 99.
unsigned CSCCFEBTimeSlice::get_crc ( ) const
inline

accessors for words 97, 98 and 99

Definition at line 98 of file CSCCFEBTimeSlice.h.

References crc.

Referenced by CSCCFEBData::statusDigi().

98 {return crc;}
unsigned crc
WORD 97.
unsigned CSCCFEBTimeSlice::get_L1A_number ( ) const
inline

Definition at line 107 of file CSCCFEBTimeSlice.h.

References L1A_number.

107 {return L1A_number;}
unsigned CSCCFEBTimeSlice::get_l1pipe_empty ( ) const
inline

Definition at line 104 of file CSCCFEBTimeSlice.h.

References l1pipe_empty.

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

104 {return l1pipe_empty;}
unsigned CSCCFEBTimeSlice::get_l1pipe_full ( ) const
inline

Definition at line 102 of file CSCCFEBTimeSlice.h.

References l1pipe_full.

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

102 {return l1pipe_full;}
unsigned CSCCFEBTimeSlice::get_lctpipe_count ( ) const
inline

Definition at line 100 of file CSCCFEBTimeSlice.h.

References lctpipe_count.

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

100 {return lctpipe_count;}
unsigned CSCCFEBTimeSlice::get_lctpipe_empty ( ) const
inline

Definition at line 103 of file CSCCFEBTimeSlice.h.

References lctpipe_empty.

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

103 {return lctpipe_empty;}
unsigned CSCCFEBTimeSlice::get_lctpipe_full ( ) const
inline

Definition at line 101 of file CSCCFEBTimeSlice.h.

References lctpipe_full.

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

101 {return lctpipe_full;}
unsigned CSCCFEBTimeSlice::get_n_free_sca_blocks ( ) const
inline

Definition at line 99 of file CSCCFEBTimeSlice.h.

References n_free_sca_blocks.

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

99 {return n_free_sca_blocks;}
unsigned n_free_sca_blocks
WORD 98.
CSCCFEBSCAControllerWord CSCCFEBTimeSlice::scaControllerWord ( int  layer) const

unpacked from the controller words for each channel in the layer

Definition at line 48 of file CSCCFEBTimeSlice.cc.

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

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

49 {
50  unsigned int result=0;
51  for(unsigned i = 0; i < 16; ++i) {
52  result |= timeSample(i*6+layer-1)->controllerData << i;
53  }
54  return CSCCFEBSCAControllerWord(result);
55 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: mps_fire.py:84
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short controllerData
combined from all 16 strips to make a word
void CSCCFEBTimeSlice::set_L1Anumber ( unsigned  l1a)
inline

Definition at line 109 of file CSCCFEBTimeSlice.h.

References L1A_number.

109 {L1A_number = l1a & 0x3F;}
void CSCCFEBTimeSlice::setControllerWord ( const CSCCFEBSCAControllerWord controllerWord)

Definition at line 58 of file CSCCFEBTimeSlice.cc.

References CSCCFEBDataWord::controllerData, and timeSample().

Referenced by CSCCFEBData::CSCCFEBData().

59 {
60  for(int layer = 1; layer <= 6; ++layer)
61  {
62  for(int channel = 1; channel <= 16; ++channel)
63  {
64  const unsigned short * shortWord = reinterpret_cast<const unsigned short *>(&controllerWord);
65  timeSample(layer, channel)->controllerData
66  = ( *shortWord >> (channel-1)) & 1;
67  }
68  }
69 }
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short controllerData
combined from all 16 strips to make a word
void CSCCFEBTimeSlice::setCRC ( )
inline

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

Definition at line 92 of file CSCCFEBTimeSlice.h.

References calcCRC(), crc, and dummy.

92 { crc=calcCRC(); dummy=0x7FFF-crc;}
unsigned calcCRC() const
unsigned crc
WORD 97.
unsigned dummy
WORD 100.
bool CSCCFEBTimeSlice::sixteenSamples ( )
inline

whether we keep 8 or 16 time samples

Definition at line 73 of file CSCCFEBTimeSlice.h.

References CSCCFEBDataWord::controllerData, and timeSample().

Referenced by CSCCFEBData::CSCCFEBData().

73  {/*return scaControllerWord(1).ts_flag;i*/
74  return timeSample(95)->controllerData;}
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short controllerData
combined from all 16 strips to make a word
unsigned CSCCFEBTimeSlice::sizeInWords ( ) const
inline

Definition at line 75 of file CSCCFEBTimeSlice.h.

Referenced by CSCCFEBData::CSCCFEBData().

75 {return 100;}
CSCCFEBDataWord* CSCCFEBTimeSlice::timeSample ( int  index) const
inline
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 34 of file CSCCFEBTimeSlice.cc.

References assert(), channelInverseGrayCode, layerInverseGrayCode, and timeSample().

35 {
36  assert(layer >= 1 && layer <= 6);
37  assert(channel >=1 && channel <= 16);
38  int layerIndex = layerInverseGrayCode[layer-1];
39 
40  unsigned channelIndex = channelInverseGrayCode[channel-1];
41  if (isDCFEB) channelIndex = channel-1;
42  unsigned scaBin = channelIndex*6 + layerIndex;
43  assert(scaBin < 96U); // scaBin >= 0, since scaBin is unsigned
44  return timeSample(scaBin);
45 }
assert(m_qm.get())
const unsigned channelInverseGrayCode[]
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
const unsigned layerInverseGrayCode[]

Friends And Related Function Documentation

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

Definition at line 81 of file CSCCFEBTimeSlice.cc.

82 {
83  for(int ichannel = 1; ichannel <= 16; ++ichannel)
84  {
85  for(int ilayer = 1; ilayer <= 6; ++ilayer)
86  {
87  //unsigned index = (ilayer-1) + (ichannel-1)*6;
88  //int value = (slice.timeSample(index))->adcCounts - 560;
89  int value = (slice.timeSample(ilayer, ichannel))->adcCounts - 560;
90  os << " " << std::setw(5) << std::dec << value;
91  }
92  os << std::endl;
93  }
94  return os;
95 }
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95

Member Data Documentation

unsigned CSCCFEBTimeSlice::blank_space_1
private

Definition at line 124 of file CSCCFEBTimeSlice.h.

Referenced by CSCCFEBTimeSlice().

unsigned CSCCFEBTimeSlice::blank_space_3
private

Definition at line 131 of file CSCCFEBTimeSlice.h.

Referenced by CSCCFEBTimeSlice().

unsigned CSCCFEBTimeSlice::buffer_count
private

Definition at line 129 of file CSCCFEBTimeSlice.h.

Referenced by get_buffer_count().

unsigned CSCCFEBTimeSlice::buffer_warning
private

WORD 99.

Definition at line 128 of file CSCCFEBTimeSlice.h.

Referenced by get_buffer_warning().

unsigned CSCCFEBTimeSlice::crc
private

WORD 97.

Definition at line 115 of file CSCCFEBTimeSlice.h.

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

unsigned CSCCFEBTimeSlice::dummy
private

WORD 100.

Definition at line 134 of file CSCCFEBTimeSlice.h.

Referenced by check(), CSCCFEBTimeSlice(), and setCRC().

unsigned CSCCFEBTimeSlice::L1A_number
private

Definition at line 130 of file CSCCFEBTimeSlice.h.

Referenced by get_L1A_number(), and set_L1Anumber().

unsigned CSCCFEBTimeSlice::l1pipe_empty
private

Definition at line 123 of file CSCCFEBTimeSlice.h.

Referenced by get_l1pipe_empty().

unsigned CSCCFEBTimeSlice::l1pipe_full
private

Definition at line 121 of file CSCCFEBTimeSlice.h.

Referenced by get_l1pipe_full().

unsigned CSCCFEBTimeSlice::lctpipe_count
private

Definition at line 119 of file CSCCFEBTimeSlice.h.

Referenced by get_lctpipe_count().

unsigned CSCCFEBTimeSlice::lctpipe_empty
private

Definition at line 122 of file CSCCFEBTimeSlice.h.

Referenced by get_lctpipe_empty().

unsigned CSCCFEBTimeSlice::lctpipe_full
private

Definition at line 120 of file CSCCFEBTimeSlice.h.

Referenced by get_lctpipe_full().

unsigned CSCCFEBTimeSlice::n_free_sca_blocks
private

WORD 98.

Definition at line 118 of file CSCCFEBTimeSlice.h.

Referenced by get_n_free_sca_blocks().

unsigned short CSCCFEBTimeSlice::theSamples[96]
private

Definition at line 112 of file CSCCFEBTimeSlice.h.

Referenced by calcCRC(), and timeSample().