CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCSPTrailer.h
Go to the documentation of this file.
1 #ifndef CSCSPTrailer_h
2 #define CSCSPTrailer_h
3 
4 #include <cstring>
5 
6 class CSCSPTrailer {
7 private:
9  unsigned l1a_ : 8;
10  unsigned word_count_low : 4;
11  unsigned trailer_mark_1 : 4; // constant, should be 1111 = 0xF
13  unsigned trailer_mark_2 : 4; // constant, should be 1111 = 0xF
14  unsigned trailer_mark_3 : 3; // constant, should be 111 = 0x7
15  unsigned l1a_fifo_full_ : 1;
16  unsigned word_count_high : 4;
17  unsigned trailer_mark_4 : 4; // constant, should be 1111 = 0xF
19  unsigned month_ : 4;
20  unsigned year_ : 4;
21  unsigned bb_ : 1; // SP readout configuration year base (0 / 16)
22  unsigned spare_1 : 1;
23  unsigned spare_2 : 1;
24  unsigned zero_1 : 1;
25  unsigned trailer_mark_5 : 4; // constant, should be 1111 = 0xF
27  unsigned core_configuraton : 12;
28  unsigned trailer_mark_6 : 4; // constant, should be 1111 = 0xF
30  unsigned day_ : 5;
31  unsigned zero_2 : 7;
32  unsigned trailer_mark_7 : 4; // constant, should be 1110 = 0xE
34  unsigned board_id_ : 12;
35  unsigned trailer_mark_8 : 4; // constant, should be 1110 = 0xE
37  unsigned crc_low : 11;
38  unsigned crc_low_parity : 1;
39  unsigned trailer_mark_9 : 4; // constant, should be 1110 = 0xE
41  unsigned crc_high : 11;
42  unsigned crc_high_parity : 1;
43  unsigned trailer_mark_10 : 4; // constant, should be 1110 = 0xE
44 
45  friend class CSCTFPacker;
46 
47 public:
48  bool check(void) const throw() {
49  return spare_1 != 0 || spare_2 != 0 || zero_1 != 0 || zero_2 != 0 || trailer_mark_1 != 0xF ||
50  trailer_mark_2 != 0xF || trailer_mark_3 != 0x7 || trailer_mark_4 != 0xF || trailer_mark_5 != 0xF ||
51  trailer_mark_6 != 0xF || trailer_mark_7 != 0xE || trailer_mark_8 != 0xE || trailer_mark_9 != 0xE ||
52  trailer_mark_10 != 0xE;
53  }
54 
55  unsigned int l1a_7bits(void) const throw() { return l1a_; }
56  unsigned int l1a_queue_size(void) const throw() { return (word_count_high << 4) | word_count_low; }
57  bool l1a_fifo_full(void) const throw() { return l1a_fifo_full_; }
58 
59  unsigned int year(void) const throw() { return 2000 + 16 * bb_ + year_; }
60  unsigned int month(void) const throw() { return month_; }
61  unsigned int day(void) const throw() { return day_; }
62  unsigned int configuration(void) const throw() { return core_configuraton; }
63 
64  //unsigned int slot (void) const throw() { return board_id_&0x1F; }
65  //unsigned int sector (void) const throw() { return (board_id_&0x700)>>8; }
66  //unsigned int endcap (void) const throw() { return (board_id_&0x800)>>11; }
67 
68  unsigned int board_id(void) const throw() { return board_id_; }
69 
70  unsigned int crc(void) const throw() { return crc_low | (crc_high << 11); }
71 
72  bool unpack(const unsigned short *&buf) throw() {
73  std::memcpy(this, buf, 8 * sizeof(short));
74  buf += 8;
75  return check();
76  }
77 
78  CSCSPTrailer(void) {}
79 };
80 
81 #endif
unsigned core_configuraton
Definition: CSCSPTrailer.h:27
unsigned l1a_
Definition: CSCSPTrailer.h:9
unsigned crc_low
Definition: CSCSPTrailer.h:37
unsigned word_count_low
Definition: CSCSPTrailer.h:10
unsigned trailer_mark_10
Definition: CSCSPTrailer.h:43
unsigned crc_high_parity
Definition: CSCSPTrailer.h:42
unsigned trailer_mark_2
Definition: CSCSPTrailer.h:13
unsigned trailer_mark_4
Definition: CSCSPTrailer.h:17
unsigned word_count_high
Definition: CSCSPTrailer.h:16
unsigned zero_1
Definition: CSCSPTrailer.h:24
unsigned int month(void) const
Definition: CSCSPTrailer.h:60
unsigned trailer_mark_6
Definition: CSCSPTrailer.h:28
unsigned int year(void) const
Definition: CSCSPTrailer.h:59
unsigned bb_
Definition: CSCSPTrailer.h:21
unsigned trailer_mark_3
Definition: CSCSPTrailer.h:14
unsigned trailer_mark_7
Definition: CSCSPTrailer.h:32
bool check(void) const
Definition: CSCSPTrailer.h:48
bool unpack(const unsigned short *&buf)
Definition: CSCSPTrailer.h:72
bool l1a_fifo_full(void) const
Definition: CSCSPTrailer.h:57
unsigned int crc(void) const
Definition: CSCSPTrailer.h:70
unsigned day_
Definition: CSCSPTrailer.h:30
CSCSPTrailer(void)
Definition: CSCSPTrailer.h:78
unsigned trailer_mark_1
Definition: CSCSPTrailer.h:11
unsigned spare_2
Definition: CSCSPTrailer.h:23
unsigned trailer_mark_8
Definition: CSCSPTrailer.h:35
unsigned l1a_fifo_full_
Definition: CSCSPTrailer.h:15
unsigned year_
Definition: CSCSPTrailer.h:20
unsigned trailer_mark_5
Definition: CSCSPTrailer.h:25
unsigned int configuration(void) const
Definition: CSCSPTrailer.h:62
unsigned int l1a_queue_size(void) const
Definition: CSCSPTrailer.h:56
unsigned int board_id(void) const
Definition: CSCSPTrailer.h:68
unsigned month_
Definition: CSCSPTrailer.h:19
unsigned int day(void) const
Definition: CSCSPTrailer.h:61
unsigned spare_1
Definition: CSCSPTrailer.h:22
unsigned trailer_mark_9
Definition: CSCSPTrailer.h:39
unsigned crc_low_parity
Definition: CSCSPTrailer.h:38
unsigned board_id_
Definition: CSCSPTrailer.h:34
unsigned zero_2
Definition: CSCSPTrailer.h:31
unsigned int l1a_7bits(void) const
Definition: CSCSPTrailer.h:55
unsigned crc_high
Definition: CSCSPTrailer.h:41