CMS 3D CMS Logo

CSCTMBTrailer.h
Go to the documentation of this file.
1 #ifndef CSCTMBTrailer_h
2 #define CSCTMBTrailer_h
3 
4 #include <cstring> // bzero
6 #include <cstdint>
7 
31 public:
33  CSCTMBTrailer(int wordCount, int firmwareVersion);
34 
35  CSCTMBTrailer(unsigned short * buf, unsigned short int firmwareVersion);
36 
38  {
39  memcpy(this, digi.trailer(), sizeInBytes());
40  }
41 
42  uint16_t sizeInBytes() const {return 16;}
43  unsigned int crc22() const;
44  void setCRC(int crc);
45  bool check() const {return theData[0]==0x6e0c;}
47  int sizeInWords() const {return 5+thePadding;}
48  unsigned short * data() {return theData;}
49 
50  int wordCount() const;
51  static void selfTest();
52 private:
53  int crcOffset() const {return (theFirmwareVersion == 2006 ? 1 : 2) + thePadding;}
54  int de0fOffset() const {return (theFirmwareVersion == 2006 ? 3 : 1) + thePadding;}
55 
56  unsigned short theData[7];
58  unsigned short int theFirmwareVersion;
59 };
60 
61 #endif
62 
int wordCount() const
uint16_t sizeInBytes() const
Definition: CSCTMBTrailer.h:42
int sizeInWords() const
in 16-bit frames
Definition: CSCTMBTrailer.h:47
unsigned short int theFirmwareVersion
Definition: CSCTMBTrailer.h:58
unsigned short * data()
Definition: CSCTMBTrailer.h:48
int crcOffset() const
Definition: CSCTMBTrailer.h:53
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:56
const uint16_t * trailer() const
void setCRC(int crc)
CSCTMBTrailer(const CSCTMBStatusDigi &digi)
Definition: CSCTMBTrailer.h:37
static void selfTest()
int de0fOffset() const
Definition: CSCTMBTrailer.h:54
bool check() const
Definition: CSCTMBTrailer.h:45