CMS 3D CMS Logo

Public Member Functions | Private Attributes | Friends

CSCCFEBTimeSlice Class Reference

#include <CSCCFEBTimeSlice.h>

List of all members.

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
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
void setControllerWord (const CSCCFEBSCAControllerWord &controllerWord)
void setCRC ()
 =VB= Set calculated CRC value for simulated CFEB Time Slice data
bool sixteenSamples ()
 whether we keep 8 or 16 time samples
unsigned sizeInWords () const
CSCCFEBDataWordtimeSample (int layer, int channel) const
 layer and element count from one
CSCCFEBDataWordtimeSample (int index) const
 input from 0 to 95

Private Attributes

unsigned blank_space_1: 4
unsigned blank_space_3: 4
unsigned buffer_count: 5
unsigned buffer_warning: 1
 WORD 99.
unsigned crc: 16
 WORD 97.
unsigned dummy: 16
 WORD 100.
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.
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.

{
    bzero(this, 99*2);
  dummy = 0x7FFF;
  blank_space_1 = 0x7;
  blank_space_3 = 0x7;
}

Member Function Documentation

unsigned CSCCFEBTimeSlice::calcCRC ( ) const

Definition at line 70 of file CSCCFEBTimeSlice.cc.

References pos, and theSamples.

Referenced by checkCRC(), and setCRC().

{
        unsigned CRC=0;
        for(uint16_t pos=0; pos<96; ++pos)
        CRC=(theSamples[pos]&0x1fff)^((theSamples[pos]&0x1fff)<<1)^(((CRC&0x7ffc)>>2)|((0x0003&CRC)<<13))^((CRC&0x7ffc)>>1);
        return CRC;
}
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, and dummy.

Referenced by CSCCFEBData::CSCCFEBData().

{return ((dummy == 0x7FFF)||((dummy+crc)== 0x7FFF));}
bool CSCCFEBTimeSlice::checkCRC ( ) const [inline]

Definition at line 81 of file CSCCFEBTimeSlice.h.

References calcCRC(), and crc.

{return crc==calcCRC();}
unsigned CSCCFEBTimeSlice::get_buffer_count ( ) const [inline]

Definition at line 100 of file CSCCFEBTimeSlice.h.

References buffer_count.

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

Definition at line 99 of file CSCCFEBTimeSlice.h.

References buffer_warning.

{return buffer_warning;}
unsigned CSCCFEBTimeSlice::get_crc ( ) const [inline]

accessors for words 97, 98 and 99

Definition at line 92 of file CSCCFEBTimeSlice.h.

References crc.

Referenced by CSCCFEBData::statusDigi().

{return crc;}
unsigned CSCCFEBTimeSlice::get_L1A_number ( ) const [inline]

Definition at line 101 of file CSCCFEBTimeSlice.h.

References L1A_number.

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

Definition at line 98 of file CSCCFEBTimeSlice.h.

References l1pipe_empty.

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

Definition at line 96 of file CSCCFEBTimeSlice.h.

References l1pipe_full.

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

Definition at line 94 of file CSCCFEBTimeSlice.h.

References lctpipe_count.

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

Definition at line 97 of file CSCCFEBTimeSlice.h.

References lctpipe_empty.

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

Definition at line 95 of file CSCCFEBTimeSlice.h.

References lctpipe_full.

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

Definition at line 93 of file CSCCFEBTimeSlice.h.

References n_free_sca_blocks.

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, i, query::result, and timeSample().

{
  unsigned int result=0;
  for(unsigned i = 0; i < 16; ++i) {
     result |= timeSample(i*6+layer-1)->controllerData << i;
  }
  return CSCCFEBSCAControllerWord(result);
}
void CSCCFEBTimeSlice::setControllerWord ( const CSCCFEBSCAControllerWord controllerWord)

Definition at line 56 of file CSCCFEBTimeSlice.cc.

References CSCCFEBDataWord::controllerData, and timeSample().

Referenced by CSCCFEBData::CSCCFEBData().

{
  for(int layer = 1; layer <= 6; ++layer)
    {
      for(int channel = 1; channel <= 16; ++channel)
        {
          const unsigned short * shortWord = reinterpret_cast<const unsigned short *>(&controllerWord);
          timeSample(layer, channel)->controllerData
            = ( *shortWord >> (channel-1)) & 1;
        }
    }
}
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(), crc, and dummy.

{ crc=calcCRC(); dummy=0x7FFF-crc;}
bool CSCCFEBTimeSlice::sixteenSamples ( ) [inline]

whether we keep 8 or 16 time samples

Definition at line 68 of file CSCCFEBTimeSlice.h.

References CSCCFEBDataWord::controllerData, and timeSample().

Referenced by CSCCFEBData::CSCCFEBData().

                        {/*return scaControllerWord(1).ts_flag;i*/
    return timeSample(95)->controllerData;}
unsigned CSCCFEBTimeSlice::sizeInWords ( ) const [inline]

Definition at line 70 of file CSCCFEBTimeSlice.h.

Referenced by CSCCFEBData::CSCCFEBData().

{return 100;}
CSCCFEBDataWord* CSCCFEBTimeSlice::timeSample ( int  index) const [inline]
CSCCFEBDataWord * CSCCFEBTimeSlice::timeSample ( int  layer,
int  channel 
) const

layer and element count from one

Definition at line 34 of file CSCCFEBTimeSlice.cc.

References channelInverseGrayCode, layerInverseGrayCode, and timeSample().

{
  assert(layer >= 1 && layer <= 6);
  assert(channel >=1 && channel <= 16);
  int layerIndex = layerInverseGrayCode[layer-1];
  unsigned channelIndex = channelInverseGrayCode[channel-1];
  unsigned scaBin = channelIndex*6 + layerIndex;
  assert(scaBin < 96U); // scaBin >= 0, since scaBin is unsigned
  return timeSample(scaBin);
}

Friends And Related Function Documentation

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

Definition at line 79 of file CSCCFEBTimeSlice.cc.

{
  for(int ichannel = 1; ichannel <= 16; ++ichannel) 
    {
      for(int ilayer = 1; ilayer <= 6; ++ilayer)
        {
          //unsigned index = (ilayer-1) + (ichannel-1)*6;
          //int value = (slice.timeSample(index))->adcCounts - 560;
          int value = (slice.timeSample(ilayer, ichannel))->adcCounts - 560; 
          os << " " << std::setw(5) << std::dec << value;
        }
      os << std::endl;
    }
  return os;
}

Member Data Documentation

unsigned CSCCFEBTimeSlice::blank_space_1 [private]

Definition at line 116 of file CSCCFEBTimeSlice.h.

Referenced by CSCCFEBTimeSlice().

unsigned CSCCFEBTimeSlice::blank_space_3 [private]

Definition at line 123 of file CSCCFEBTimeSlice.h.

Referenced by CSCCFEBTimeSlice().

unsigned CSCCFEBTimeSlice::buffer_count [private]

Definition at line 121 of file CSCCFEBTimeSlice.h.

Referenced by get_buffer_count().

WORD 99.

Definition at line 120 of file CSCCFEBTimeSlice.h.

Referenced by get_buffer_warning().

unsigned CSCCFEBTimeSlice::crc [private]

WORD 97.

Definition at line 107 of file CSCCFEBTimeSlice.h.

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

unsigned CSCCFEBTimeSlice::dummy [private]

WORD 100.

Definition at line 126 of file CSCCFEBTimeSlice.h.

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

unsigned CSCCFEBTimeSlice::L1A_number [private]

Definition at line 122 of file CSCCFEBTimeSlice.h.

Referenced by get_L1A_number().

unsigned CSCCFEBTimeSlice::l1pipe_empty [private]

Definition at line 115 of file CSCCFEBTimeSlice.h.

Referenced by get_l1pipe_empty().

unsigned CSCCFEBTimeSlice::l1pipe_full [private]

Definition at line 113 of file CSCCFEBTimeSlice.h.

Referenced by get_l1pipe_full().

unsigned CSCCFEBTimeSlice::lctpipe_count [private]

Definition at line 111 of file CSCCFEBTimeSlice.h.

Referenced by get_lctpipe_count().

unsigned CSCCFEBTimeSlice::lctpipe_empty [private]

Definition at line 114 of file CSCCFEBTimeSlice.h.

Referenced by get_lctpipe_empty().

unsigned CSCCFEBTimeSlice::lctpipe_full [private]

Definition at line 112 of file CSCCFEBTimeSlice.h.

Referenced by get_lctpipe_full().

WORD 98.

Definition at line 110 of file CSCCFEBTimeSlice.h.

Referenced by get_n_free_sca_blocks().

unsigned short CSCCFEBTimeSlice::theSamples[96] [private]

Definition at line 104 of file CSCCFEBTimeSlice.h.

Referenced by calcCRC(), and timeSample().