CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes

CSCALCTTrailer Class Reference

#include <CSCALCTTrailer.h>

List of all members.

Public Member Functions

unsigned alctCRCCheck () const
CSCALCTTrailer2006 alctTrailer2006 ()
CSCALCTTrailer2007 alctTrailer2007 ()
bool check () const
 CSCALCTTrailer (const unsigned short *buf)
 CSCALCTTrailer (int size, int firmVersion)
 needed for packing
 CSCALCTTrailer (const CSCALCTStatusDigi &digi)
unsigned short * data ()
unsigned FrameCount () const
int getCRC ()
int wordCount () const

Static Public Member Functions

static void setDebug (bool debugValue)
static int sizeInWords ()
 in 16-bit frames

Private Attributes

unsigned short int theOriginalBuffer [4]
CSCALCTTrailer2006 trailer2006
CSCALCTTrailer2007 trailer2007

Static Private Attributes

static bool debug = false
static unsigned short int firmwareVersion = 2006

Detailed Description

Definition at line 38 of file CSCALCTTrailer.h.


Constructor & Destructor Documentation

CSCALCTTrailer::CSCALCTTrailer ( int  size,
int  firmVersion 
)

needed for packing

needed for packing

Definition at line 33 of file CSCALCTTrailer.cc.

References firmwareVersion, CSCALCTTrailer2007::setSize(), CSCALCTTrailer2006::setSize(), trailer2006, and trailer2007.

Referenced by CSCALCTTrailer().

{ 
  if(firmVersion == 2006)
  {
     trailer2006.setSize(size);
     firmwareVersion = 2006;
  }
  else if (firmVersion == 2007)
  {
     trailer2007.setSize(size);
     firmwareVersion = 2007;
  }
  else {
    edm::LogError("CSCALCTTrailer|CSCRawToDigi") <<"failed to construct: undetermined ALCT firmware version!!" << firmVersion;
  }

}
CSCALCTTrailer::CSCALCTTrailer ( const unsigned short *  buf)

determine the version first

Now fill data

Definition at line 51 of file CSCALCTTrailer.cc.

References firmwareVersion, CSCALCTTrailer2006::sizeInWords(), CSCALCTTrailer2007::sizeInWords(), trailer2006, and trailer2007.

                                                        {
  if ((buf[0]==0xDE0D)&&((buf[1]&0xF000)==0xD000)) {
    firmwareVersion=2007;
  }
  else if ( (buf[2]&0xFFF)==0xE0D ) {
    firmwareVersion=2006;
  }
  else {
    edm::LogError("CSCALCTTrailer|CSCRawToDigi") <<"failed to construct: undetermined ALCT firmware version!!" << firmwareVersion;
  }

  switch (firmwareVersion) {
  case 2006:
    memcpy(&trailer2006, buf, trailer2006.sizeInWords()*2);
    break;
  case 2007:
    memcpy(&trailer2007, buf, trailer2007.sizeInWords()*2);
    break;
  default:
    edm::LogError("CSCALCTTrailer|CSCRawToDigi")
      <<"couldn't construct: ALCT firmware version is bad/not defined!";
    break;
  }
}
CSCALCTTrailer::CSCALCTTrailer ( const CSCALCTStatusDigi digi) [inline]

Definition at line 44 of file CSCALCTTrailer.h.

References CSCALCTTrailer(), and CSCALCTStatusDigi::trailer().

                                                 {
    CSCALCTTrailer(digi.trailer());
  }

Member Function Documentation

unsigned CSCALCTTrailer::alctCRCCheck ( ) const [inline]

Definition at line 108 of file CSCALCTTrailer.h.

References firmwareVersion, CSCALCTTrailer2006::reserved_3, CSCALCTTrailer2007::reserved_3, trailer2006, and trailer2007.

                                { 
    switch (firmwareVersion) {
    case 2006:
      return trailer2006.reserved_3;
    case 2007:
      return trailer2007.reserved_3;  
    default:
      edm::LogError("CSCALCTTrailer|CSCRawToDigi")
        <<"couldn't CRCcheck: ALCT firmware version is bad/not defined!";
      return 0;
    }
  }
CSCALCTTrailer2006 CSCALCTTrailer::alctTrailer2006 ( ) [inline]

Definition at line 123 of file CSCALCTTrailer.h.

References trailer2006.

{return trailer2006;}
CSCALCTTrailer2007 CSCALCTTrailer::alctTrailer2007 ( ) [inline]

Definition at line 124 of file CSCALCTTrailer.h.

References trailer2007.

{return trailer2007;}
bool CSCALCTTrailer::check ( ) const [inline]

Definition at line 82 of file CSCALCTTrailer.h.

References CSCALCTTrailer2006::e0dLine, CSCALCTTrailer2007::e0dLine, firmwareVersion, trailer2006, and trailer2007.

                     {
    switch (firmwareVersion) {
    case 2006:
      return (trailer2006.e0dLine & 0xfff) == 0xe0d;
    case 2007:
      return (trailer2007.e0dLine & 0xffff) == 0xde0d;
    default:
      edm::LogError("CSCALCTTrailer|CSCRawToDigi")
        <<"couldn't check: ALCT firmware version is bad/not defined!";
      return 0;
    }
  }
unsigned short* CSCALCTTrailer::data ( ) [inline]

Definition at line 50 of file CSCALCTTrailer.h.

References firmwareVersion, CSCALCTTrailer2006::sizeInWords(), CSCALCTTrailer2007::sizeInWords(), theOriginalBuffer, trailer2006, and trailer2007.

Referenced by CSCEventData::pack().

                          {
    switch (firmwareVersion) {
    case 2006:
      memcpy(theOriginalBuffer, &trailer2006, trailer2006.sizeInWords()*2);
      break;
    case 2007:
      memcpy(theOriginalBuffer, &trailer2007, trailer2007.sizeInWords()*2);
      break;
    default:
      edm::LogError("CSCALCTTrailer|CSCRawToDigi")
        <<"couldn't access data: ALCT firmware version is bad/not defined!";
      break;
    }
    return theOriginalBuffer;
  }
unsigned CSCALCTTrailer::FrameCount ( ) const [inline]

Definition at line 121 of file CSCALCTTrailer.h.

References wordCount().

{ return wordCount(); }
int CSCALCTTrailer::getCRC ( ) [inline]

Definition at line 69 of file CSCALCTTrailer.h.

References CSCALCTTrailer2007::crc0, CSCALCTTrailer2006::crc0, CSCALCTTrailer2006::crc1, CSCALCTTrailer2007::crc1, firmwareVersion, trailer2006, and trailer2007.

               { 
    switch (firmwareVersion) {
    case 2006:
      return ((trailer2006.crc1&0x7ff)<<11) | (trailer2006.crc0&0x7ff);
    case 2007:
      return ((trailer2007.crc1&0x7ff)<<11) | (trailer2007.crc0&0x7ff);
    default:
      edm::LogError("CSCALCTTrailer|CSCRawToDigi")
        <<"couldn't getCRC: ALCT firmware version is bad/not defined!";
      return 0;
    }
  }
static void CSCALCTTrailer::setDebug ( bool  debugValue) [inline, static]

Definition at line 48 of file CSCALCTTrailer.h.

References debug.

{debug = debugValue;}
static int CSCALCTTrailer::sizeInWords ( ) [inline, static]

in 16-bit frames

Definition at line 67 of file CSCALCTTrailer.h.

Referenced by CSCEventData::checkALCTClasses(), and CSCEventData::pack().

{return 4;}
int CSCALCTTrailer::wordCount ( ) const [inline]

Definition at line 95 of file CSCALCTTrailer.h.

References firmwareVersion, CSCALCTTrailer2007::frameCount, CSCALCTTrailer2006::frameCount, trailer2006, and trailer2007.

Referenced by FrameCount(), and cscdqm::EventProcessor::processCSC().

                        {
    switch (firmwareVersion) {
    case 2006:
      return trailer2006.frameCount;
    case 2007:
      return trailer2007.frameCount;
    default:
      edm::LogError("CSCALCTTrailer|CSCRawToDigi")
        <<"couldn't wordCount: ALCT firmware version is bad/not defined!";
      return 0;
    }
  }

Member Data Documentation

bool CSCALCTTrailer::debug = false [static, private]

documented in flags https://www.phys.ufl.edu/~madorsky/alctv/alct2000_spec.PDF

Definition at line 127 of file CSCALCTTrailer.h.

Referenced by setDebug().

short unsigned int CSCALCTTrailer::firmwareVersion = 2006 [static, private]

Definition at line 128 of file CSCALCTTrailer.h.

Referenced by alctCRCCheck(), check(), CSCALCTTrailer(), data(), getCRC(), and wordCount().

unsigned short int CSCALCTTrailer::theOriginalBuffer[4] [private]

Definition at line 131 of file CSCALCTTrailer.h.

Referenced by data().