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>
40 
41 class CSCDMBHeader;
42 
44 // public:
46  {
47  bzero(data(), sizeInWords()*2);
48  bits.ddu_code_1 = bits.ddu_code_2 = bits.ddu_code_3 = bits.ddu_code_4 = 0xF;
49  bits.ddu_code_5 = bits.ddu_code_6 = bits.ddu_code_7 = bits.ddu_code_8 = 0xE;
50  }
51 
52  CSCDMBTrailer2013(unsigned short * buf)
53  {
54  memcpy(data(), buf, sizeInWords()*2);
55  }
56 
57 /*
58  CSCDMBTrailer2013(const CSCDMBStatusDigi & digi)
59  {
60  memcpy(this, digi.trailer(), sizeInWords()*2);
61  }
62 */
63 
65  void setEventInformation(const CSCDMBHeader & dmbHeader) override
66  {
67  bits.dmb_id = dmbHeader.dmbID();
68  bits.crate_id = dmbHeader.crateID();
69  bits.dmb_l1a = dmbHeader.l1a();
70  bits.dmb_bxn = dmbHeader.bxn();
71  };
72 
73  unsigned crateID() const override { return bits.crate_id; };
74  unsigned dmbID() const override { return bits.dmb_id; };
75 
76  unsigned dmb_l1a() const override { return bits.dmb_l1a; };
77  unsigned dmb_bxn() const override { return bits.dmb_bxn; };
78 
79  unsigned alct_endtimeout() const override { return bits.alct_endtimeout; };
80  unsigned tmb_endtimeout() const override { return bits.tmb_endtimeout; };
81  unsigned cfeb_endtimeout() const override { return bits.cfeb_endtimeout; };
82 
83  unsigned alct_starttimeout() const override { return bits.alct_starttimeout; };
84  unsigned tmb_starttimeout() const override { return bits.tmb_starttimeout; };
85  unsigned cfeb_starttimeout() const override { return bits.cfeb_starttimeout; };
86 
87  unsigned cfeb_movlp() const override { return bits.cfeb_movlp; };
88  unsigned dmb_l1pipe() const override { return bits.dmb_l1pipe; };
89 
91  unsigned alct_empty() const override { return 0; };
92  unsigned tmb_empty() const override { return 0 ; };
93  unsigned cfeb_empty() const override { return 0; };
94 
95 
96  unsigned alct_half() const override { return bits.alct_half; };
97  unsigned tmb_half() const override { return bits.tmb_half; };
98  unsigned cfeb_half() const override { return bits.cfeb_half; };
99 
100  unsigned alct_full() const override { return bits.alct_full; };
101  unsigned tmb_full() const override { return bits.tmb_full; };
102  unsigned cfeb_full() const override { return (bits.cfeb_full_lowo | (bits.cfeb_full_hiwo << 3)); };
103 
104  unsigned crc22() const override { return (bits.dmb_crc_1 | (bits.dmb_crc_2 << 11)); };
105  unsigned crc_lo_parity() const override { return bits.dmb_parity_1; };
106  unsigned crc_hi_parity() const override { return bits.dmb_parity_2; };
107 
108  unsigned short * data() override { return (unsigned short *)(&bits); }
109  unsigned short * data() const override { return (unsigned short *)(&bits); }
110 
111  bool check() const override {return bits.ddu_code_1 == 0xF && bits.ddu_code_2 == 0xF
112  && bits.ddu_code_3 == 0xF && bits.ddu_code_4 == 0xF
113  && bits.ddu_code_5 == 0xE && bits.ddu_code_6 == 0xE
114  && bits.ddu_code_7 == 0xE && bits.ddu_code_8 == 0xE;}
115 
116  unsigned sizeInWords() const override { return 8; }
117 
118  struct {
120  unsigned dmb_l1a : 6;
121  unsigned dmb_bxn : 5;
122  unsigned alct_endtimeout : 1;
123  unsigned ddu_code_1 : 4;
124 
126  unsigned cfeb_endtimeout : 7;
127  unsigned cfeb_movlp : 5;
128  unsigned ddu_code_2 : 4;
129 
131  unsigned dmb_l1pipe : 8;
132  unsigned tmb_starttimeout : 1;
133  unsigned cfeb_full_lowo : 3;
134  unsigned ddu_code_3 : 4;
135 
137  unsigned cfeb_full_hiwo : 4;
138  unsigned cfeb_starttimeout : 7;
139  unsigned alct_starttimeout : 1;
140  unsigned ddu_code_4 : 4;
141 
143  unsigned cfeb_half : 7;
144  unsigned tmb_endtimeout : 1;
145  unsigned tmb_half : 1;
146  unsigned alct_half : 1;
147  unsigned tmb_full : 1;
148  unsigned alct_full : 1;
149  unsigned ddu_code_5 : 4;
150 
152  unsigned dmb_id : 4;
153  unsigned crate_id : 8;
154  unsigned ddu_code_6 : 4;
155 
157  unsigned dmb_crc_1 : 11;
158  unsigned dmb_parity_1 : 1;
159  unsigned ddu_code_7 : 4;
160 
162  unsigned dmb_crc_2 : 11;
163  unsigned dmb_parity_2 : 1;
164  unsigned ddu_code_8 : 4;
165  } bits;
166 
167 };
168 
169 #endif
170 
unsigned dmb_l1pipe() const override
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
CSCDMBTrailer2013(unsigned short *buf)
unsigned dmbID() const override
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;
struct CSCDMBTrailer2013::@374 bits
unsigned tmb_half() const override
unsigned cfeb_endtimeout() const override
unsigned crc_hi_parity() const override