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 || 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
CSCSPTrailer::trailer_mark_6
unsigned trailer_mark_6
Definition: CSCSPTrailer.h:28
CSCSPTrailer::month
unsigned int month(void) const
Definition: CSCSPTrailer.h:60
CSCSPTrailer::bb_
unsigned bb_
Definition: CSCSPTrailer.h:21
CSCSPTrailer::trailer_mark_9
unsigned trailer_mark_9
Definition: CSCSPTrailer.h:39
CSCSPTrailer
Definition: CSCSPTrailer.h:6
CSCSPTrailer::board_id_
unsigned board_id_
Definition: CSCSPTrailer.h:34
CSCSPTrailer::unpack
bool unpack(const unsigned short *&buf)
Definition: CSCSPTrailer.h:72
CSCSPTrailer::l1a_
unsigned l1a_
Definition: CSCSPTrailer.h:9
CSCSPTrailer::crc_low
unsigned crc_low
Definition: CSCSPTrailer.h:37
CSCSPTrailer::crc
unsigned int crc(void) const
Definition: CSCSPTrailer.h:70
CSCSPTrailer::word_count_low
unsigned word_count_low
Definition: CSCSPTrailer.h:10
CSCSPTrailer::trailer_mark_1
unsigned trailer_mark_1
Definition: CSCSPTrailer.h:11
CSCSPTrailer::crc_high_parity
unsigned crc_high_parity
Definition: CSCSPTrailer.h:42
CSCSPTrailer::l1a_queue_size
unsigned int l1a_queue_size(void) const
Definition: CSCSPTrailer.h:56
CSCSPTrailer::zero_1
unsigned zero_1
Definition: CSCSPTrailer.h:24
CSCSPTrailer::trailer_mark_8
unsigned trailer_mark_8
Definition: CSCSPTrailer.h:35
CSCSPTrailer::trailer_mark_3
unsigned trailer_mark_3
Definition: CSCSPTrailer.h:14
CSCSPTrailer::trailer_mark_7
unsigned trailer_mark_7
Definition: CSCSPTrailer.h:32
CSCSPTrailer::l1a_7bits
unsigned int l1a_7bits(void) const
Definition: CSCSPTrailer.h:55
CSCTFPacker
Definition: CSCTFPacker.h:18
CSCSPTrailer::year_
unsigned year_
Definition: CSCSPTrailer.h:20
CSCSPTrailer::board_id
unsigned int board_id(void) const
Definition: CSCSPTrailer.h:68
CSCSPTrailer::trailer_mark_5
unsigned trailer_mark_5
Definition: CSCSPTrailer.h:25
CSCSPTrailer::configuration
unsigned int configuration(void) const
Definition: CSCSPTrailer.h:62
CSCSPTrailer::month_
unsigned month_
Definition: CSCSPTrailer.h:19
CSCSPTrailer::CSCSPTrailer
CSCSPTrailer(void)
Definition: CSCSPTrailer.h:78
CSCSPTrailer::check
bool check(void) const
Definition: CSCSPTrailer.h:48
CSCSPTrailer::day_
unsigned day_
Definition: CSCSPTrailer.h:30
CSCSPTrailer::day
unsigned int day(void) const
Definition: CSCSPTrailer.h:61
CSCSPTrailer::spare_1
unsigned spare_1
Definition: CSCSPTrailer.h:22
CSCSPTrailer::spare_2
unsigned spare_2
Definition: CSCSPTrailer.h:23
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCSPTrailer::crc_low_parity
unsigned crc_low_parity
Definition: CSCSPTrailer.h:38
CSCSPTrailer::l1a_fifo_full_
unsigned l1a_fifo_full_
Definition: CSCSPTrailer.h:15
CSCSPTrailer::zero_2
unsigned zero_2
Definition: CSCSPTrailer.h:31
CSCSPTrailer::year
unsigned int year(void) const
Definition: CSCSPTrailer.h:59
CSCSPTrailer::crc_high
unsigned crc_high
Definition: CSCSPTrailer.h:41
CSCSPTrailer::core_configuraton
unsigned core_configuraton
Definition: CSCSPTrailer.h:27
CSCSPTrailer::l1a_fifo_full
bool l1a_fifo_full(void) const
Definition: CSCSPTrailer.h:57
CSCSPTrailer::trailer_mark_2
unsigned trailer_mark_2
Definition: CSCSPTrailer.h:13
CSCSPTrailer::trailer_mark_10
unsigned trailer_mark_10
Definition: CSCSPTrailer.h:43
CSCSPTrailer::trailer_mark_4
unsigned trailer_mark_4
Definition: CSCSPTrailer.h:17
CSCSPTrailer::word_count_high
unsigned word_count_high
Definition: CSCSPTrailer.h:16