CMS 3D CMS Logo

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