CMS 3D CMS Logo

CSCTMBTrailer.h
Go to the documentation of this file.
1 #ifndef EventFilter_CSCRawToDigi_CSCTMBTrailer_h
2 #define EventFilter_CSCRawToDigi_CSCTMBTrailer_h
3 
4 #include <cstring> // bzero
6 #include <cstdint>
7 
29 public:
32 
33  CSCTMBTrailer(const uint16_t* buf, unsigned short int firmwareVersion);
34 
35  CSCTMBTrailer(const CSCTMBStatusDigi& digi) { memcpy(this, digi.trailer(), sizeInBytes()); }
36 
37  uint16_t sizeInBytes() const { return 16; }
38  unsigned int crc22() const;
39  void setCRC(int crc);
40  bool check() const { return theData[0] == 0x6e0c; }
42  int sizeInWords() const { return 5 + thePadding; }
43  unsigned short* data() { return theData; }
44 
45  int wordCount() const;
46  static void selfTest();
47 
48 private:
49  int crcOffset() const { return (theFirmwareVersion == 2006 ? 1 : 2) + thePadding; }
50  int de0fOffset() const { return (theFirmwareVersion == 2006 ? 3 : 1) + thePadding; }
51 
52  unsigned short theData[7];
54  unsigned short int theFirmwareVersion;
55 };
56 
57 #endif
int crcOffset() const
Definition: CSCTMBTrailer.h:49
bool check() const
Definition: CSCTMBTrailer.h:40
unsigned short int theFirmwareVersion
Definition: CSCTMBTrailer.h:54
unsigned short * data()
Definition: CSCTMBTrailer.h:43
CSCTMBTrailer(int wordCount, int firmwareVersion)
don&#39;t forget to pass in the size of the tmb header + clct data
Definition: CSCTMBTrailer.cc:6
unsigned short theData[7]
Definition: CSCTMBTrailer.h:52
int wordCount() const
uint16_t sizeInBytes() const
Definition: CSCTMBTrailer.h:37
void setCRC(int crc)
CSCTMBTrailer(const CSCTMBStatusDigi &digi)
Definition: CSCTMBTrailer.h:35
static void selfTest()
int de0fOffset() const
Definition: CSCTMBTrailer.h:50
int sizeInWords() const
in 16-bit frames
Definition: CSCTMBTrailer.h:42
const uint16_t * trailer() const
unsigned int crc22() const