CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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:
31  CSCTMBTrailer(int wordCount, int firmwareVersion);
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 wordCount() const
uint16_t sizeInBytes() const
Definition: CSCTMBTrailer.h:37
int sizeInWords() const
in 16-bit frames
Definition: CSCTMBTrailer.h:42
unsigned short int theFirmwareVersion
Definition: CSCTMBTrailer.h:54
unsigned short * data()
Definition: CSCTMBTrailer.h:43
int crcOffset() const
Definition: CSCTMBTrailer.h:49
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 int crc22() const
unsigned short theData[7]
Definition: CSCTMBTrailer.h:52
const uint16_t * trailer() const
void setCRC(int crc)
CSCTMBTrailer(const CSCTMBStatusDigi &digi)
Definition: CSCTMBTrailer.h:35
static void selfTest()
int de0fOffset() const
Definition: CSCTMBTrailer.h:50
bool check() const
Definition: CSCTMBTrailer.h:40