CMS 3D CMS Logo

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 ||
50  trailer_mark_1!=0xF || trailer_mark_2!=0xF || trailer_mark_3!=0x7 || trailer_mark_4!=0xF || trailer_mark_5!=0xF || trailer_mark_6!=0xF ||
51  trailer_mark_7!=0xE || trailer_mark_8!=0xE || trailer_mark_9!=0xE || trailer_mark_10!=0xE;
52  }
53 
54  unsigned int l1a_7bits (void) const throw() { return l1a_; }
55  unsigned int l1a_queue_size(void) const throw() { return (word_count_high<<4)|word_count_low; }
56  bool l1a_fifo_full (void) const throw() { return l1a_fifo_full_; }
57 
58  unsigned int year (void) const throw() { return 2000+16*bb_+year_; }
59  unsigned int month (void) const throw() { return month_; }
60  unsigned int day (void) const throw() { return day_; }
61  unsigned int configuration (void) const throw() { return core_configuraton; }
62 
63  //unsigned int slot (void) const throw() { return board_id_&0x1F; }
64  //unsigned int sector (void) const throw() { return (board_id_&0x700)>>8; }
65  //unsigned int endcap (void) const throw() { return (board_id_&0x800)>>11; }
66 
67  unsigned int board_id(void) const throw() { return board_id_; }
68 
69  unsigned int crc (void) const throw() { return crc_low|(crc_high<<11); }
70 
71  bool unpack(const unsigned short *&buf) throw() { std::memcpy(this, buf, 8*sizeof(short)); buf+=8; return check(); }
72 
73  CSCSPTrailer(void){}
74 };
75 
76 #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:59
unsigned trailer_mark_6
Definition: CSCSPTrailer.h:28
unsigned int year(void) const
Definition: CSCSPTrailer.h:58
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:71
bool l1a_fifo_full(void) const
Definition: CSCSPTrailer.h:56
unsigned int crc(void) const
Definition: CSCSPTrailer.h:69
unsigned day_
Definition: CSCSPTrailer.h:30
CSCSPTrailer(void)
Definition: CSCSPTrailer.h:73
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:61
unsigned int l1a_queue_size(void) const
Definition: CSCSPTrailer.h:55
unsigned int board_id(void) const
Definition: CSCSPTrailer.h:67
unsigned month_
Definition: CSCSPTrailer.h:19
unsigned int day(void) const
Definition: CSCSPTrailer.h:60
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:54
unsigned crc_high
Definition: CSCSPTrailer.h:41