File indexing completed on 2024-04-06 12:10:23
0001 #ifndef EventFilter_CSCRawToDigi_CSCTMBTrailer_h
0002 #define EventFilter_CSCRawToDigi_CSCTMBTrailer_h
0003
0004 #include <cstring> // bzero
0005 #include "DataFormats/CSCDigi/interface/CSCTMBStatusDigi.h"
0006 #include <cstdint>
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 class CSCTMBTrailer {
0029 public:
0030
0031 CSCTMBTrailer(int wordCount, int firmwareVersion);
0032
0033 CSCTMBTrailer(const uint16_t* buf, unsigned short int firmwareVersion);
0034
0035 CSCTMBTrailer(const CSCTMBStatusDigi& digi) { memcpy(this, digi.trailer(), sizeInBytes()); }
0036
0037 uint16_t sizeInBytes() const { return 16; }
0038 unsigned int crc22() const;
0039 void setCRC(int crc);
0040 bool check() const { return theData[0] == 0x6e0c; }
0041
0042 int sizeInWords() const { return 5 + thePadding; }
0043 unsigned short* data() { return theData; }
0044
0045 int wordCount() const;
0046 static void selfTest();
0047
0048 private:
0049 int crcOffset() const { return (theFirmwareVersion == 2006 ? 1 : 2) + thePadding; }
0050 int de0fOffset() const { return (theFirmwareVersion == 2006 ? 3 : 1) + thePadding; }
0051
0052 unsigned short theData[7];
0053 int thePadding;
0054 unsigned short int theFirmwareVersion;
0055 };
0056
0057 #endif