test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  virtual void setEventInformation(const CSCDMBHeader & dmbHeader)
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  virtual unsigned crateID() const { return bits.crate_id; };
74  virtual unsigned dmbID() const { return bits.dmb_id; };
75 
76  virtual unsigned dmb_l1a() const { return bits.dmb_l1a; };
77  virtual unsigned dmb_bxn() const { return bits.dmb_bxn; };
78 
79  virtual unsigned alct_endtimeout() const { return bits.alct_endtimeout; };
80  virtual unsigned tmb_endtimeout() const { return bits.tmb_endtimeout; };
81  virtual unsigned cfeb_endtimeout() const { return bits.cfeb_endtimeout; };
82 
83  virtual unsigned alct_starttimeout() const { return bits.alct_starttimeout; };
84  virtual unsigned tmb_starttimeout() const { return bits.tmb_starttimeout; };
85  virtual unsigned cfeb_starttimeout() const { return bits.cfeb_starttimeout; };
86 
87  virtual unsigned cfeb_movlp() const { return bits.cfeb_movlp; };
88  virtual unsigned dmb_l1pipe() const { return bits.dmb_l1pipe; };
89 
91  virtual unsigned alct_empty() const { return 0; };
92  virtual unsigned tmb_empty() const { return 0 ; };
93  virtual unsigned cfeb_empty() const { return 0; };
94 
95 
96  virtual unsigned alct_half() const { return bits.alct_half; };
97  virtual unsigned tmb_half() const { return bits.tmb_half; };
98  virtual unsigned cfeb_half() const { return bits.cfeb_half; };
99 
100  virtual unsigned alct_full() const { return bits.alct_full; };
101  virtual unsigned tmb_full() const { return bits.tmb_full; };
102  virtual unsigned cfeb_full() const { return (bits.cfeb_full_lowo | (bits.cfeb_full_hiwo << 3)); };
103 
104  virtual unsigned crc22() const { return (bits.dmb_crc_1 | (bits.dmb_crc_2 << 11)); };
105  virtual unsigned crc_lo_parity() const { return bits.dmb_parity_1; };
106  virtual unsigned crc_hi_parity() const { return bits.dmb_parity_2; };
107 
108  virtual unsigned short * data() { return (unsigned short *)(&bits); }
109  virtual unsigned short * data() const { return (unsigned short *)(&bits); }
110 
111  bool check() const {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 { 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 
virtual unsigned dmbID() const
unsigned cfeb_full_lowo
TMB_Start_Timeout(1)
unsigned l1a() const
Definition: CSCDMBHeader.h:50
unsigned ddu_code_4
ALCT_Start_Timeout(1)
unsigned cfeb_full_hiwo
constant, should be &#39;1111&#39;
unsigned dmb_id
constant, should be &#39;1110&#39;
virtual unsigned cfeb_full() const
virtual unsigned short * data() const
CSCDMBTrailer2013(unsigned short *buf)
unsigned dmb_parity_1
DMB_CRC[10:0].
unsigned ddu_code_3
CFEB_FULL(3:1)
virtual unsigned dmb_bxn() const
virtual unsigned cfeb_empty() const
virtual unsigned dmb_l1pipe() const
unsigned dmb_parity_2
DMB_CRC[21:11].
virtual unsigned cfeb_endtimeout() const
virtual unsigned dmb_l1a() const
virtual unsigned alct_half() const
virtual unsigned crateID() const
virtual unsigned short * data()
virtual unsigned tmb_endtimeout() const
unsigned ddu_code_7
DMB_CRC_LowParity(1)
virtual unsigned cfeb_half() const
virtual unsigned alct_endtimeout() const
unsigned ddu_code_8
DMB_CRC_HighParity(1)
virtual unsigned cfeb_starttimeout() const
unsigned ddu_code_2
CFEB_MOVLP(5:1)
virtual unsigned tmb_half() const
virtual unsigned tmb_full() const
virtual unsigned cfeb_movlp() const
virtual unsigned alct_starttimeout() const
unsigned crate_id
DMB_ID(4)
unsigned ddu_code_1
ALCT_End_Timeout(1)
virtual unsigned crc22() const
unsigned ddu_code_5
ALCT_FULL(1)
struct CSCDMBTrailer2013::@309 bits
unsigned bxn() const
Definition: CSCDMBHeader.h:48
unsigned crateID() const
Definition: CSCDMBHeader.h:46
unsigned dmb_crc_1
constant, should be &#39;1110&#39;
virtual unsigned crc_hi_parity() const
virtual unsigned tmb_empty() const
virtual unsigned tmb_starttimeout() const
unsigned dmbID() const
Definition: CSCDMBHeader.h:47
virtual unsigned alct_empty() const
Empty bits don&#39;t exists in new format.
unsigned sizeInWords() const
virtual void setEventInformation(const CSCDMBHeader &dmbHeader)
@ NEEDS TO BE DONE
virtual unsigned alct_full() const
virtual unsigned crc_lo_parity() const
unsigned ddu_code_6
DMB_CRATE(8)
unsigned dmb_crc_2
constant, should be &#39;1110&#39;