CMS 3D CMS Logo

CSCDMBTrailer2013.h
Go to the documentation of this file.
1 #ifndef CSCDMBTrailer2013_h
2 #define CSCDMBTrailer2013_h
3 
4 /*
5  DMB-DDU 2013 Header/Trailer bit definitions (some bits get repeated for bit error mitigation)
6 
7  DMB_L1A: L1A Event Number, count from DMB
8  DMB_BXN: Bunch Crossing Number, count from DMB
9  TMB_DAV: non-zero indicates TMB data exists for this event
10  ALCT_DAV: non-zero indicates ALCT data exists for this event
11  CFEB_CLCT_SENT: indicates which CFEBs should have sent data to DMB
12  CFEB_DAV: indicates which CFEBs have sent data to DMB
13  CLCT-DAV-Mismatch: the CFEB_DAVs do not match the CLCTs sent
14  DMB_CRATE: peripheral crate ID from DMB
15  DMB_ID: board number of DMB
16  CFEB_MOVLP: the time sample for this event has multiple overlaps with samples from previous events
17  DMB-CFEB-Sync: bits used for DMB-CFEB synchronization check
18  ALCT_HALF: zero indicates that the ALCT FIFO on the DMB is half-full
19  TMB_HALF: zero indicates that the TMB FIFO on the DMB is half-full
20  CFEB_HALF: zero indicates that the CFEB FIFO on the DMB is half-full
21  DMB_L1PIPE: number of L1A Events backed-up in the DMB
22  ALCT_EMPTY: one indicates that the ALCT FIFO on the DMB is empty
23  TMB_EMPTY: one indicates that the TMB FIFO on the DMB is empty
24  CFEB_EMPTY: one indicates that the CFEB FIFO on the DMB is empty
25  ALCT_Start_Timeout: indicates that the start of ALCT data was not detected within the time-out period
26  TMB_Start_Timeout: indicates that the start of TMB data was not detected within the time-out period
27  CFEB_Start_Timeout: indicates that the start of CFEB data was not detected within the time-out period.
28  CFEB_End_Timeout: indicates that the end of CFEB data was not detected within the time-out period
29  ALCT_End_Timeout: indicates that the end of ALCT data was not detected within the time-out period
30  TMB_End_Timeout: indicates that the end of TMB data was not detected within the time-out period
31  ALCT_FULL: one indicates that the ALCT FIFO on the DMB is full
32  TMB_FULL: one indicates that the TMB FIFO on the DMB is full
33  CFEB_FULL: one indicates that the CFEB FIFO on the DMB is full
34  DMB_CRC: each DMB generates a 22-bit CRC that encompasses all CSC data from the first 9-code to the last F-code in the event
35  */
36 
37 #include <iostream>
41 
43 // public:
45  {
46  bzero(data(), sizeInWords()*2);
47  bits.ddu_code_1 = bits.ddu_code_2 = bits.ddu_code_3 = bits.ddu_code_4 = 0xF;
48  bits.ddu_code_5 = bits.ddu_code_6 = bits.ddu_code_7 = bits.ddu_code_8 = 0xE;
49  }
50 
51  CSCDMBTrailer2013(const uint16_t * buf)
52  {
53  memcpy(data(), buf, sizeInWords()*2);
54  }
55 
56 /*
57  CSCDMBTrailer2013(const CSCDMBStatusDigi & digi)
58  {
59  memcpy(this, digi.trailer(), sizeInWords()*2);
60  }
61 */
62 
64  void setEventInformation(const CSCDMBHeader & dmbHeader) override
65  {
66  bits.dmb_id = dmbHeader.dmbID();
67  bits.crate_id = dmbHeader.crateID();
68  bits.dmb_l1a = dmbHeader.l1a();
69  bits.dmb_bxn = dmbHeader.bxn();
70  };
71 
72  unsigned crateID() const override { return bits.crate_id; };
73  unsigned dmbID() const override { return bits.dmb_id; };
74 
75  unsigned dmb_l1a() const override { return bits.dmb_l1a; };
76  unsigned dmb_bxn() const override { return bits.dmb_bxn; };
77 
78  unsigned alct_endtimeout() const override { return bits.alct_endtimeout; };
79  unsigned tmb_endtimeout() const override { return bits.tmb_endtimeout; };
80  unsigned cfeb_endtimeout() const override { return bits.cfeb_endtimeout; };
81 
82  unsigned alct_starttimeout() const override { return bits.alct_starttimeout; };
83  unsigned tmb_starttimeout() const override { return bits.tmb_starttimeout; };
84  unsigned cfeb_starttimeout() const override { return bits.cfeb_starttimeout; };
85 
86  unsigned cfeb_movlp() const override { return bits.cfeb_movlp; };
87  unsigned dmb_l1pipe() const override { return bits.dmb_l1pipe; };
88 
90  unsigned alct_empty() const override { return 0; };
91  unsigned tmb_empty() const override { return 0 ; };
92  unsigned cfeb_empty() const override { return 0; };
93 
94 
95  unsigned alct_half() const override { return bits.alct_half; };
96  unsigned tmb_half() const override { return bits.tmb_half; };
97  unsigned cfeb_half() const override { return bits.cfeb_half; };
98 
99  unsigned alct_full() const override { return bits.alct_full; };
100  unsigned tmb_full() const override { return bits.tmb_full; };
101  unsigned cfeb_full() const override { return (bits.cfeb_full_lowo | (bits.cfeb_full_hiwo << 3)); };
102 
103  unsigned crc22() const override { return (bits.dmb_crc_1 | (bits.dmb_crc_2 << 11)); };
104  unsigned crc_lo_parity() const override { return bits.dmb_parity_1; };
105  unsigned crc_hi_parity() const override { return bits.dmb_parity_2; };
106 
107  unsigned short * data() override { return (unsigned short *)(&bits); }
108  unsigned short * data() const override { return (unsigned short *)(&bits); }
109 
110  bool check() const override {return bits.ddu_code_1 == 0xF && bits.ddu_code_2 == 0xF
111  && bits.ddu_code_3 == 0xF && bits.ddu_code_4 == 0xF
112  && bits.ddu_code_5 == 0xE && bits.ddu_code_6 == 0xE
113  && bits.ddu_code_7 == 0xE && bits.ddu_code_8 == 0xE;}
114 
115  unsigned sizeInWords() const override { return 8; }
116 
117  struct {
119  unsigned dmb_l1a : 6;
120  unsigned dmb_bxn : 5;
121  unsigned alct_endtimeout : 1;
122  unsigned ddu_code_1 : 4;
123 
125  unsigned cfeb_endtimeout : 7;
126  unsigned cfeb_movlp : 5;
127  unsigned ddu_code_2 : 4;
128 
130  unsigned dmb_l1pipe : 8;
131  unsigned tmb_starttimeout : 1;
132  unsigned cfeb_full_lowo : 3;
133  unsigned ddu_code_3 : 4;
134 
136  unsigned cfeb_full_hiwo : 4;
137  unsigned cfeb_starttimeout : 7;
138  unsigned alct_starttimeout : 1;
139  unsigned ddu_code_4 : 4;
140 
142  unsigned cfeb_half : 7;
143  unsigned tmb_endtimeout : 1;
144  unsigned tmb_half : 1;
145  unsigned alct_half : 1;
146  unsigned tmb_full : 1;
147  unsigned alct_full : 1;
148  unsigned ddu_code_5 : 4;
149 
151  unsigned dmb_id : 4;
152  unsigned crate_id : 8;
153  unsigned ddu_code_6 : 4;
154 
156  unsigned dmb_crc_1 : 11;
157  unsigned dmb_parity_1 : 1;
158  unsigned ddu_code_7 : 4;
159 
161  unsigned dmb_crc_2 : 11;
162  unsigned dmb_parity_2 : 1;
163  unsigned ddu_code_8 : 4;
164  } bits;
165 
166 };
167 
168 #endif
169 
unsigned dmb_l1pipe() const override
struct CSCDMBTrailer2013::@380 bits
unsigned cfeb_full_lowo
TMB_Start_Timeout(1)
unsigned cfeb_full() const override
unsigned tmb_endtimeout() const override
unsigned short * data() const override
unsigned cfeb_starttimeout() const override
unsigned l1a() const
Definition: CSCDMBHeader.h:49
unsigned ddu_code_4
ALCT_Start_Timeout(1)
unsigned cfeb_full_hiwo
constant, should be &#39;1111&#39;
unsigned tmb_starttimeout() const override
unsigned dmb_id
constant, should be &#39;1110&#39;
unsigned alct_endtimeout() const override
unsigned cfeb_half() const override
unsigned dmbID() const override
CSCDMBTrailer2013(const uint16_t *buf)
unsigned dmb_parity_1
DMB_CRC[10:0].
unsigned ddu_code_3
CFEB_FULL(3:1)
unsigned crc_lo_parity() const override
unsigned dmb_parity_2
DMB_CRC[21:11].
unsigned dmb_bxn() const override
unsigned crc22() const override
unsigned alct_empty() const override
Empty bits don&#39;t exists in new format.
unsigned ddu_code_7
DMB_CRC_LowParity(1)
bool check() const override
unsigned ddu_code_8
DMB_CRC_HighParity(1)
unsigned ddu_code_2
CFEB_MOVLP(5:1)
unsigned crate_id
DMB_ID(4)
unsigned cfeb_movlp() const override
unsigned ddu_code_1
ALCT_End_Timeout(1)
void setEventInformation(const CSCDMBHeader &dmbHeader) override
@ NEEDS TO BE DONE
unsigned ddu_code_5
ALCT_FULL(1)
unsigned bxn() const
Definition: CSCDMBHeader.h:47
unsigned crateID() const
Definition: CSCDMBHeader.h:45
unsigned dmb_crc_1
constant, should be &#39;1110&#39;
unsigned short * data() override
unsigned alct_starttimeout() const override
unsigned sizeInWords() const override
unsigned dmbID() const
Definition: CSCDMBHeader.h:46
unsigned cfeb_empty() const override
unsigned dmb_l1a() const override
unsigned crateID() const override
unsigned alct_half() const override
unsigned tmb_full() const override
unsigned ddu_code_6
DMB_CRATE(8)
unsigned alct_full() const override
unsigned tmb_empty() const override
unsigned dmb_crc_2
constant, should be &#39;1110&#39;
unsigned tmb_half() const override
unsigned cfeb_endtimeout() const override
unsigned crc_hi_parity() const override