CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/EventFilter/CSCRawToDigi/interface/CSCTMBTrailer.h

Go to the documentation of this file.
00001 #ifndef CSCTMBTrailer_h
00002 #define CSCTMBTrailer_h
00003 
00004 #include <string.h> // bzero
00005 #include "DataFormats/CSCDigi/interface/CSCTMBStatusDigi.h"
00006 #include <stdint.h>
00007 
00030 class CSCTMBTrailer {
00031 public:
00033   CSCTMBTrailer(int wordCount, int firmwareVersion);
00034 
00035   CSCTMBTrailer(unsigned short * buf, unsigned short int firmwareVersion);
00036 
00037   CSCTMBTrailer(const CSCTMBStatusDigi & digi)
00038     {
00039       memcpy(this, digi.trailer(), sizeInBytes());
00040     }
00041 
00042   uint16_t sizeInBytes() const {return 16;}
00043   unsigned int crc22() const;
00044   void setCRC(int crc);
00045   bool check() const {return theData[0]==0x6e0c;}
00047   int sizeInWords() const {return 5+thePadding;}
00048   unsigned short * data() {return theData;}
00049 
00050   int wordCount() const;
00051   static void selfTest();
00052 private:
00053   int crcOffset() const  {return (theFirmwareVersion == 2006 ? 1 : 2) + thePadding;}
00054   int de0fOffset() const {return (theFirmwareVersion == 2006 ? 3 : 1) + thePadding;}
00055 
00056   unsigned short theData[7];
00057   int thePadding;
00058   unsigned short int theFirmwareVersion;
00059 };
00060 
00061 #endif
00062