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
CSCDMBTrailer2013::ddu_code_6
unsigned ddu_code_6
DMB_CRATE(8)
Definition: CSCDMBTrailer2013.h:147
CSCDMBTrailer2013::alct_half
unsigned alct_half
TMB_HALF(1)
Definition: CSCDMBTrailer2013.h:139
CSCVDMBTrailerFormat.h
CSCDMBTrailer2013::tmb_endtimeout
unsigned tmb_endtimeout
CFEB_HALF(7:1)
Definition: CSCDMBTrailer2013.h:137
CSCDMBHeader::l1a
unsigned l1a() const
Definition: CSCDMBHeader.h:39
CSCDMBTrailer2013::cfeb_starttimeout
unsigned cfeb_starttimeout() const override
Definition: CSCDMBTrailer2013.h:79
CSCDMBTrailer2013::crc_lo_parity
unsigned crc_lo_parity() const override
Definition: CSCDMBTrailer2013.h:98
CSCDMBStatusDigi.h
CSCDMBTrailer2013::cfeb_movlp
unsigned cfeb_movlp() const override
Definition: CSCDMBTrailer2013.h:81
CSCDMBTrailer2013::dmb_parity_2
unsigned dmb_parity_2
DMB_CRC[21:11].
Definition: CSCDMBTrailer2013.h:156
CSCVDMBTrailerFormat
Definition: CSCVDMBTrailerFormat.h:10
CSCDMBTrailer2013::dmb_bxn
unsigned dmb_bxn
DMB_L1A[5:0].
Definition: CSCDMBTrailer2013.h:114
CSCDMBTrailer2013::cfeb_movlp
unsigned cfeb_movlp
CFEB_End_Timeout(7:1)
Definition: CSCDMBTrailer2013.h:120
CSCDMBTrailer2013::crc22
unsigned crc22() const override
Definition: CSCDMBTrailer2013.h:97
CSCDMBTrailer2013::cfeb_starttimeout
unsigned cfeb_starttimeout
CFEB_FULL(7:4)
Definition: CSCDMBTrailer2013.h:131
CSCDMBTrailer2013::tmb_starttimeout
unsigned tmb_starttimeout
DMB_L1PIPE(8)
Definition: CSCDMBTrailer2013.h:125
CSCDMBTrailer2013::sizeInWords
unsigned sizeInWords() const override
Definition: CSCDMBTrailer2013.h:109
CSCDMBTrailer2013::cfeb_full_hiwo
unsigned cfeb_full_hiwo
constant, should be '1111'
Definition: CSCDMBTrailer2013.h:130
CSCDMBTrailer2013::CSCDMBTrailer2013
CSCDMBTrailer2013()
Definition: CSCDMBTrailer2013.h:44
CSCDMBTrailer2013::ddu_code_2
unsigned ddu_code_2
CFEB_MOVLP(5:1)
Definition: CSCDMBTrailer2013.h:121
CSCDMBTrailer2013::tmb_starttimeout
unsigned tmb_starttimeout() const override
Definition: CSCDMBTrailer2013.h:78
CSCDMBTrailer2013::dmb_crc_1
unsigned dmb_crc_1
constant, should be '1110'
Definition: CSCDMBTrailer2013.h:150
CSCDMBTrailer2013::tmb_half
unsigned tmb_half
TMB_End_Timeout(1)
Definition: CSCDMBTrailer2013.h:138
CSCDMBTrailer2013::ddu_code_1
unsigned ddu_code_1
ALCT_End_Timeout(1)
Definition: CSCDMBTrailer2013.h:116
CSCDMBTrailer2013::bits
struct CSCDMBTrailer2013::@452 bits
CSCDMBTrailer2013::cfeb_half
unsigned cfeb_half
constant, should be '1111'
Definition: CSCDMBTrailer2013.h:136
CSCDMBTrailer2013::tmb_endtimeout
unsigned tmb_endtimeout() const override
Definition: CSCDMBTrailer2013.h:74
CSCDMBTrailer2013::dmb_crc_2
unsigned dmb_crc_2
constant, should be '1110'
Definition: CSCDMBTrailer2013.h:155
CSCDMBTrailer2013::alct_half
unsigned alct_half() const override
Definition: CSCDMBTrailer2013.h:89
CSCDMBTrailer2013::data
unsigned short * data() override
Definition: CSCDMBTrailer2013.h:101
CSCDMBTrailer2013::cfeb_full_lowo
unsigned cfeb_full_lowo
TMB_Start_Timeout(1)
Definition: CSCDMBTrailer2013.h:126
CSCDMBTrailer2013::cfeb_endtimeout
unsigned cfeb_endtimeout
constant, should be '1111'
Definition: CSCDMBTrailer2013.h:119
CSCDMBTrailer2013::dmb_id
unsigned dmb_id
constant, should be '1110'
Definition: CSCDMBTrailer2013.h:145
CSCDMBTrailer2013::alct_endtimeout
unsigned alct_endtimeout() const override
Definition: CSCDMBTrailer2013.h:73
CSCDMBHeader.h
CSCDMBTrailer2013::alct_full
unsigned alct_full
TMB_FULL(1)
Definition: CSCDMBTrailer2013.h:141
CSCDMBTrailer2013::ddu_code_3
unsigned ddu_code_3
CFEB_FULL(3:1)
Definition: CSCDMBTrailer2013.h:127
CSCDMBTrailer2013::ddu_code_7
unsigned ddu_code_7
DMB_CRC_LowParity(1)
Definition: CSCDMBTrailer2013.h:152
CSCDMBTrailer2013::cfeb_empty
unsigned cfeb_empty() const override
Definition: CSCDMBTrailer2013.h:87
CSCDMBTrailer2013::crateID
unsigned crateID() const override
Definition: CSCDMBTrailer2013.h:67
CSCDMBTrailer2013::check
bool check() const override
Definition: CSCDMBTrailer2013.h:104
CSCDMBHeader::crateID
unsigned crateID() const
Definition: CSCDMBHeader.h:35
CSCDMBTrailer2013::alct_empty
unsigned alct_empty() const override
Empty bits don't exists in new format.
Definition: CSCDMBTrailer2013.h:85
CSCDMBHeader::bxn
unsigned bxn() const
Definition: CSCDMBHeader.h:37
CSCDMBTrailer2013::crc_hi_parity
unsigned crc_hi_parity() const override
Definition: CSCDMBTrailer2013.h:99
CSCDMBTrailer2013::dmb_l1a
unsigned dmb_l1a() const override
Definition: CSCDMBTrailer2013.h:70
CSCDMBTrailer2013::data
unsigned short * data() const override
Definition: CSCDMBTrailer2013.h:102
CSCDMBTrailer2013::alct_endtimeout
unsigned alct_endtimeout
DMB_BXN[4:0].
Definition: CSCDMBTrailer2013.h:115
CSCDMBTrailer2013::dmb_l1a
unsigned dmb_l1a
1st Trailer word
Definition: CSCDMBTrailer2013.h:113
CSCDMBTrailer2013::tmb_empty
unsigned tmb_empty() const override
Definition: CSCDMBTrailer2013.h:86
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCDMBTrailer2013::dmb_bxn
unsigned dmb_bxn() const override
Definition: CSCDMBTrailer2013.h:71
CSCDMBTrailer2013::cfeb_endtimeout
unsigned cfeb_endtimeout() const override
Definition: CSCDMBTrailer2013.h:75
CSCDMBTrailer2013::ddu_code_8
unsigned ddu_code_8
DMB_CRC_HighParity(1)
Definition: CSCDMBTrailer2013.h:157
CSCDMBHeader
Definition: CSCDMBHeader.h:15
CSCDMBTrailer2013::dmb_l1pipe
unsigned dmb_l1pipe
constant, should be '1111'
Definition: CSCDMBTrailer2013.h:124
CSCDMBTrailer2013::tmb_full
unsigned tmb_full() const override
Definition: CSCDMBTrailer2013.h:94
CSCDMBTrailer2013::dmb_parity_1
unsigned dmb_parity_1
DMB_CRC[10:0].
Definition: CSCDMBTrailer2013.h:151
CSCDMBTrailer2013::cfeb_half
unsigned cfeb_half() const override
Definition: CSCDMBTrailer2013.h:91
CSCDMBTrailer2013::CSCDMBTrailer2013
CSCDMBTrailer2013(const uint16_t *buf)
Definition: CSCDMBTrailer2013.h:50
CSCDMBTrailer2013::dmb_l1pipe
unsigned dmb_l1pipe() const override
Definition: CSCDMBTrailer2013.h:82
CSCDMBTrailer2013::setEventInformation
void setEventInformation(const CSCDMBHeader &dmbHeader) override
@ NEEDS TO BE DONE
Definition: CSCDMBTrailer2013.h:60
CSCDMBTrailer2013::alct_starttimeout
unsigned alct_starttimeout() const override
Definition: CSCDMBTrailer2013.h:77
CSCDMBHeader::dmbID
unsigned dmbID() const
Definition: CSCDMBHeader.h:36
CSCDMBTrailer2013::tmb_half
unsigned tmb_half() const override
Definition: CSCDMBTrailer2013.h:90
CSCDMBTrailer2013
Definition: CSCDMBTrailer2013.h:42
CSCDMBTrailer2013::tmb_full
unsigned tmb_full
ALCT_HALF(1)
Definition: CSCDMBTrailer2013.h:140
CSCDMBTrailer2013::crate_id
unsigned crate_id
DMB_ID(4)
Definition: CSCDMBTrailer2013.h:146
CSCDMBTrailer2013::ddu_code_5
unsigned ddu_code_5
ALCT_FULL(1)
Definition: CSCDMBTrailer2013.h:142
CSCDMBTrailer2013::ddu_code_4
unsigned ddu_code_4
ALCT_Start_Timeout(1)
Definition: CSCDMBTrailer2013.h:133
CSCDMBTrailer2013::alct_starttimeout
unsigned alct_starttimeout
CFEB_Start_Timeout(7:1)
Definition: CSCDMBTrailer2013.h:132
CSCDMBTrailer2013::dmbID
unsigned dmbID() const override
Definition: CSCDMBTrailer2013.h:68
CSCDMBTrailer2013::alct_full
unsigned alct_full() const override
Definition: CSCDMBTrailer2013.h:93
CSCDMBTrailer2013::cfeb_full
unsigned cfeb_full() const override
Definition: CSCDMBTrailer2013.h:95