CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCALCTTrailer.h
Go to the documentation of this file.
1 #ifndef CSCALCTTrailer_h
2 #define CSCALCTTrailer_h
3 
8 #include <string.h> // memcpy
11 
14  void setSize(int size) {frameCount = size;}
15  short unsigned int sizeInWords() const {
16  return 4;
17  }
18  unsigned crc0:11, zero_0:1, d_0:4;
19  unsigned crc1:11, zero_1:1, d_1:4;
20  unsigned e0dLine:16;
21  unsigned frameCount:11, reserved_3:1, d_3:4;
22 };
23 
26  void setSize(int size) {frameCount = size;}
27  short unsigned int sizeInWords() const {
28  return 4;
29  }
30  unsigned e0dLine:16;
31  unsigned crc0:11, zero_0:1, reserved_0:4;
32  unsigned crc1:11, zero_1:1, reserved_1:4;
33  unsigned frameCount:11, reserved_3:1, reserved_4:4;
34 };
35 
36 
37 
39 {
40 public:
42  CSCALCTTrailer(int size, int firmVersion);
43  CSCALCTTrailer(const unsigned short * buf);
45  CSCALCTTrailer(digi.trailer());
46  }
47 
48  static void setDebug(bool debugValue) {debug = debugValue;}
49 
50  unsigned short * data() {
51  switch (firmwareVersion) {
52  case 2006:
54  break;
55  case 2007:
57  break;
58  default:
59  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
60  <<"couldn't access data: ALCT firmware version is bad/not defined!";
61  break;
62  }
63  return theOriginalBuffer;
64  }
65 
67  static int sizeInWords() {return 4;}
68 
69  int getCRC() {
70  switch (firmwareVersion) {
71  case 2006:
72  return ((trailer2006.crc1&0x7ff)<<11) | (trailer2006.crc0&0x7ff);
73  case 2007:
74  return ((trailer2007.crc1&0x7ff)<<11) | (trailer2007.crc0&0x7ff);
75  default:
76  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
77  <<"couldn't getCRC: ALCT firmware version is bad/not defined!";
78  return 0;
79  }
80  }
81 
82  bool check() const {
83  switch (firmwareVersion) {
84  case 2006:
85  return (trailer2006.e0dLine & 0xfff) == 0xe0d;
86  case 2007:
87  return (trailer2007.e0dLine & 0xffff) == 0xde0d;
88  default:
89  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
90  <<"couldn't check: ALCT firmware version is bad/not defined!";
91  return 0;
92  }
93  }
94 
95  int wordCount() const {
96  switch (firmwareVersion) {
97  case 2006:
98  return trailer2006.frameCount;
99  case 2007:
100  return trailer2007.frameCount;
101  default:
102  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
103  <<"couldn't wordCount: ALCT firmware version is bad/not defined!";
104  return 0;
105  }
106  }
107 
108  unsigned alctCRCCheck() const {
109  switch (firmwareVersion) {
110  case 2006:
111  return trailer2006.reserved_3;
112  case 2007:
113  return trailer2007.reserved_3;
114  default:
115  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
116  <<"couldn't CRCcheck: ALCT firmware version is bad/not defined!";
117  return 0;
118  }
119  }
120 
121  unsigned FrameCount() const { return wordCount(); }
122 
125 
126 private:
127  static bool debug;
128  static unsigned short int firmwareVersion;
131  unsigned short int theOriginalBuffer[4];
132 
133 };
134 
135 #endif
136 
CSCALCTTrailer(const CSCALCTStatusDigi &digi)
const uint16_t * trailer() const
unsigned FrameCount() const
short unsigned int sizeInWords() const
CSCALCTTrailer2006 alctTrailer2006()
unsigned alctCRCCheck() const
CSCALCTTrailer2007 trailer2007
CSCALCTTrailer(int size, int firmVersion)
needed for packing
int wordCount() const
static int sizeInWords()
in 16-bit frames
CSCALCTTrailer2006 trailer2006
short unsigned int sizeInWords() const
unsigned short * data()
static bool debug
CSCALCTTrailer2007 alctTrailer2007()
void setSize(int size)
static void setDebug(bool debugValue)
void setSize(int size)
bool check() const
unsigned short int theOriginalBuffer[4]
tuple size
Write out results.
static unsigned short int firmwareVersion