CMS 3D CMS Logo

CSCDMBTrailer2013.h
Go to the documentation of this file.
1 #ifndef EventFilter_CSCRawToDigi_CSCDMBTrailer2013_h
2 #define EventFilter_CSCRawToDigi_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  bzero(data(), sizeInWords() * 2);
46  bits.ddu_code_1 = bits.ddu_code_2 = bits.ddu_code_3 = bits.ddu_code_4 = 0xF;
47  bits.ddu_code_5 = bits.ddu_code_6 = bits.ddu_code_7 = bits.ddu_code_8 = 0xE;
48  }
49 
50  CSCDMBTrailer2013(const uint16_t *buf) { memcpy(data(), buf, sizeInWords() * 2); }
51 
52  /*
53  CSCDMBTrailer2013(const CSCDMBStatusDigi & digi)
54  {
55  memcpy(this, digi.trailer(), sizeInWords()*2);
56  }
57 */
58 
60  void setEventInformation(const CSCDMBHeader &dmbHeader) override {
61  bits.dmb_id = dmbHeader.dmbID();
62  bits.crate_id = dmbHeader.crateID();
63  bits.dmb_l1a = dmbHeader.l1a();
64  bits.dmb_bxn = dmbHeader.bxn();
65  };
66 
67  unsigned crateID() const override { return bits.crate_id; };
68  unsigned dmbID() const override { return bits.dmb_id; };
69 
70  unsigned dmb_l1a() const override { return bits.dmb_l1a; };
71  unsigned dmb_bxn() const override { return bits.dmb_bxn; };
72 
73  unsigned alct_endtimeout() const override { return bits.alct_endtimeout; };
74  unsigned tmb_endtimeout() const override { return bits.tmb_endtimeout; };
75  unsigned cfeb_endtimeout() const override { return bits.cfeb_endtimeout; };
76 
77  unsigned alct_starttimeout() const override { return bits.alct_starttimeout; };
78  unsigned tmb_starttimeout() const override { return bits.tmb_starttimeout; };
79  unsigned cfeb_starttimeout() const override { return bits.cfeb_starttimeout; };
80 
81  unsigned cfeb_movlp() const override { return bits.cfeb_movlp; };
82  unsigned dmb_l1pipe() const override { return bits.dmb_l1pipe; };
83 
85  unsigned alct_empty() const override { return 0; };
86  unsigned tmb_empty() const override { return 0; };
87  unsigned cfeb_empty() const override { return 0; };
88 
89  unsigned alct_half() const override { return bits.alct_half; };
90  unsigned tmb_half() const override { return bits.tmb_half; };
91  unsigned cfeb_half() const override { return bits.cfeb_half; };
92 
93  unsigned alct_full() const override { return bits.alct_full; };
94  unsigned tmb_full() const override { return bits.tmb_full; };
95  unsigned cfeb_full() const override { return (bits.cfeb_full_lowo | (bits.cfeb_full_hiwo << 3)); };
96 
97  unsigned crc22() const override { return (bits.dmb_crc_1 | (bits.dmb_crc_2 << 11)); };
98  unsigned crc_lo_parity() const override { return bits.dmb_parity_1; };
99  unsigned crc_hi_parity() const override { return bits.dmb_parity_2; };
100 
101  unsigned short *data() override { return (unsigned short *)(&bits); }
102  unsigned short *data() const override { return (unsigned short *)(&bits); }
103 
104  bool check() const override {
105  return bits.ddu_code_1 == 0xF && bits.ddu_code_2 == 0xF && bits.ddu_code_3 == 0xF && bits.ddu_code_4 == 0xF &&
106  bits.ddu_code_5 == 0xE && bits.ddu_code_6 == 0xE && bits.ddu_code_7 == 0xE && bits.ddu_code_8 == 0xE;
107  }
108 
109  unsigned sizeInWords() const override { return 8; }
110 
111  struct {
113  unsigned dmb_l1a : 6;
114  unsigned dmb_bxn : 5;
115  unsigned alct_endtimeout : 1;
116  unsigned ddu_code_1 : 4;
117 
119  unsigned cfeb_endtimeout : 7;
120  unsigned cfeb_movlp : 5;
121  unsigned ddu_code_2 : 4;
122 
124  unsigned dmb_l1pipe : 8;
125  unsigned tmb_starttimeout : 1;
126  unsigned cfeb_full_lowo : 3;
127  unsigned ddu_code_3 : 4;
128 
130  unsigned cfeb_full_hiwo : 4;
131  unsigned cfeb_starttimeout : 7;
132  unsigned alct_starttimeout : 1;
133  unsigned ddu_code_4 : 4;
134 
136  unsigned cfeb_half : 7;
137  unsigned tmb_endtimeout : 1;
138  unsigned tmb_half : 1;
139  unsigned alct_half : 1;
140  unsigned tmb_full : 1;
141  unsigned alct_full : 1;
142  unsigned ddu_code_5 : 4;
143 
145  unsigned dmb_id : 4;
146  unsigned crate_id : 8;
147  unsigned ddu_code_6 : 4;
148 
150  unsigned dmb_crc_1 : 11;
151  unsigned dmb_parity_1 : 1;
152  unsigned ddu_code_7 : 4;
153 
155  unsigned dmb_crc_2 : 11;
156  unsigned dmb_parity_2 : 1;
157  unsigned ddu_code_8 : 4;
158  } bits;
159 };
160 
161 #endif
unsigned cfeb_full_lowo
TMB_Start_Timeout(1)
unsigned cfeb_endtimeout() const override
unsigned ddu_code_4
ALCT_Start_Timeout(1)
unsigned tmb_full
ALCT_HALF(1)
unsigned cfeb_full_hiwo
constant, should be &#39;1111&#39;
unsigned dmb_id
constant, should be &#39;1110&#39;
unsigned bxn() const
Definition: CSCDMBHeader.h:37
unsigned crateID() const override
unsigned cfeb_endtimeout
constant, should be &#39;1111&#39;
bool check() const override
unsigned tmb_starttimeout() const override
unsigned dmb_l1a
1st Trailer word
unsigned cfeb_full() const override
CSCDMBTrailer2013(const uint16_t *buf)
unsigned dmb_l1pipe() const override
unsigned alct_endtimeout
DMB_BXN[4:0].
unsigned tmb_empty() const override
unsigned dmb_parity_1
DMB_CRC[10:0].
unsigned ddu_code_3
CFEB_FULL(3:1)
unsigned dmb_bxn() const override
unsigned alct_starttimeout() const override
unsigned dmb_parity_2
DMB_CRC[21:11].
unsigned cfeb_starttimeout
CFEB_FULL(7:4)
unsigned cfeb_empty() const override
unsigned dmbID() const override
unsigned tmb_half() const override
unsigned ddu_code_7
DMB_CRC_LowParity(1)
unsigned cfeb_half
constant, should be &#39;1111&#39;
unsigned ddu_code_8
DMB_CRC_HighParity(1)
unsigned ddu_code_2
CFEB_MOVLP(5:1)
unsigned dmb_l1pipe
constant, should be &#39;1111&#39;
unsigned alct_full
TMB_FULL(1)
unsigned cfeb_movlp
CFEB_End_Timeout(7:1)
unsigned alct_starttimeout
CFEB_Start_Timeout(7:1)
unsigned crate_id
DMB_ID(4)
unsigned alct_half
TMB_HALF(1)
unsigned alct_endtimeout() const override
unsigned ddu_code_1
ALCT_End_Timeout(1)
unsigned sizeInWords() const override
unsigned l1a() const
Definition: CSCDMBHeader.h:39
unsigned tmb_starttimeout
DMB_L1PIPE(8)
void setEventInformation(const CSCDMBHeader &dmbHeader) override
@ NEEDS TO BE DONE
unsigned ddu_code_5
ALCT_FULL(1)
unsigned tmb_endtimeout() const override
unsigned cfeb_starttimeout() const override
unsigned dmbID() const
Definition: CSCDMBHeader.h:36
unsigned tmb_full() const override
unsigned dmb_crc_1
constant, should be &#39;1110&#39;
unsigned alct_empty() const override
Empty bits don&#39;t exists in new format.
struct CSCDMBTrailer2013::@462 bits
unsigned short * data() override
unsigned crateID() const
Definition: CSCDMBHeader.h:35
unsigned tmb_endtimeout
CFEB_HALF(7:1)
unsigned dmb_bxn
DMB_L1A[5:0].
unsigned crc_hi_parity() const override
unsigned alct_half() const override
unsigned short * data() const override
unsigned crc22() const override
unsigned ddu_code_6
DMB_CRATE(8)
unsigned cfeb_movlp() const override
unsigned dmb_l1a() const override
unsigned dmb_crc_2
constant, should be &#39;1110&#39;
unsigned cfeb_half() const override
unsigned tmb_half
TMB_End_Timeout(1)
unsigned crc_lo_parity() const override
unsigned alct_full() const override