CMS 3D CMS Logo

CSCDMBHeader2013.h
Go to the documentation of this file.
1 #ifndef CSCDMBHeader2013_h
2 #define CSCDMBHeader2013_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 
38 #include <cassert>
39 #include <iosfwd>
40 #include <cstring> // bzero
43 
45 // public:
46 
48 
49  CSCDMBHeader2013(const uint16_t * buf);
50 /*
51  CSCDMBHeader2013(const CSCDMBStatusDigi & digi)
52  {
53  memcpy(this, digi.header(), sizeInWords()*2);
54  }
55 */
56  bool cfebAvailable(unsigned icfeb) override;
57 
58  void addCFEB(int icfeb) override;
59  void addNCLCT() override;
60  void addNALCT() override;
61  void setBXN(int bxn) override;
62  void setL1A(int l1a) override;
63  void setL1A24(int l1a) override;
64  void setCrateAddress(int crate, int dmbId) override;
65  void setdmbID(int newDMBID) override { bits.dmb_id = newDMBID; }
66  void setdmbVersion(unsigned int version) override {bits.fmt_version = (version<4) ? version: 0;}
67 
68  unsigned cfebActive() const override { return bits.cfeb_clct_sent; }
69  unsigned crateID() const override;
70  unsigned dmbID() const override;
71  unsigned bxn() const override;
72  unsigned bxn12() const override;
73  unsigned l1a() const override;
74  unsigned l1a24() const override;
75  unsigned cfebAvailable() const override;
76  unsigned nalct() const override;
77  unsigned nclct() const override;
78  unsigned cfebMovlp() const override;
79  unsigned dmbCfebSync() const override;
80  unsigned activeDavMismatch() const override;
81  unsigned format_version() const override;
82 
83  unsigned sizeInWords() const override;
84 
85  bool check() const override;
86 
87  unsigned short * data() override {return (unsigned short *)(&bits);}
88  unsigned short * data() const override { return (unsigned short *)(&bits);}
89 
90 
91  //ostream & operator<<(ostream &, const CSCDMBHeader &);
92 
93 // private:
94 
95  struct {
97  unsigned dmb_l1a_lowo : 12;
98  unsigned newddu_code_1 : 4;
99 
101  unsigned dmb_l1a_hiwo : 12;
102  unsigned newddu_code_2 : 4;
103 
105  unsigned cfeb_clct_sent : 7;
106  unsigned clct_dav_mismatch : 1;
107  unsigned fmt_version : 2;
108  unsigned tmb_dav : 1;
109  unsigned alct_dav : 1;
110  unsigned newddu_code_3 : 4;
111 
113  unsigned dmb_bxn1 : 12;
114  unsigned newddu_code_4 : 4;
115 
117  unsigned cfeb_dav : 7;
118  unsigned clct_dav_mismatch_copy : 1;
119  unsigned fmt_version_copy : 2;
120  unsigned tmb_dav_copy : 1;
121  unsigned alct_dav_copy : 1;
122  unsigned ddu_code_1 : 4;
123 
125  unsigned dmb_id : 4;
126  unsigned dmb_crate : 8;
127  unsigned ddu_code_2: 4;
128 
129 
131  unsigned dmb_bxn : 5;
132  unsigned cfeb_movlp : 5;
135  unsigned tmb_dav_copy2 : 1;
136  unsigned alct_dav_copy2 : 1;
137  unsigned ddu_code_3 : 4;
138 
140  unsigned dmb_l1a : 5;
141  unsigned clct_dav_mismatch_copy2 : 1;
142  unsigned fmt_version_copy2 : 2;
143  unsigned dmb_cfeb_sync : 4;
144  unsigned ddu_code_4 : 4;
145  } bits;
146 
147 
148 };
149 
150 #endif
151 
struct CSCDMBHeader2013::@424 bits
unsigned dmbID() const override
unsigned fmt_version
CLCT-DAV-Mismatch(1)
void setdmbID(int newDMBID) override
unsigned dmb_cfeb_sync
Fmt_Vers(1:0)
unsigned cfebAvailable() const override
unsigned dmb_l1a_lowo
1st Header word
unsigned fmt_version_copy
CLCT-DAV-Mismatch(1)
unsigned newddu_code_4
DMB_BXN[11:0].
unsigned sizeInWords() const override
unsigned fmt_version_copy2
CLCT-DAV-Mismatch(1)
unsigned cfebMovlp() const override
unsigned clct_dav_mismatch_copy
CFEB_DAV(7:1)
bool check() const override
unsigned ddu_code_4
DMB-CFEB-Sync[3:0].
unsigned tmb_dav_copy
Fmt_Vers(1:0)
unsigned cfebActive() const override
unsigned short * data() const override
void setL1A(int l1a) override
unsigned ddu_code_1
ALCT_DAV(1)
unsigned tmb_dav
Fmt_Vers(1:0)
unsigned dmb_bxn1
constant, should be 1001
unsigned alct_dav_copy2
TMB_DAV(1)
unsigned format_version() const override
unsigned newddu_code_2
DMB_L1A[23:12].
unsigned dmb_crate
DMB_ID(4)
void addNALCT() override
unsigned cfeb_dav
constant, should be 1001
unsigned ddu_code_3
ALCT_DAV(1)
unsigned l1a() const override
unsigned newddu_code_3
ALCT_DAV(1)
unsigned dmb_l1a_hiwo
constant, should be 1001
unsigned alct_dav_copy
TMB_DAV(1)
void setL1A24(int l1a) override
unsigned activeDavMismatch() const override
void addCFEB(int icfeb) override
void setdmbVersion(unsigned int version) override
unsigned dmb_l1a
constant, should be &#39;1010&#39;
unsigned nclct() const override
unsigned clct_dav_mismatch
CFEB_CLCT_SENT(7:1)
unsigned dmb_id
constant, should be &#39;1010&#39;
unsigned cfeb_clct_sent
constant, should be 1001
unsigned dmbCfebSync() const override
unsigned bxn() const override
unsigned tmb_dav_copy2
CFEB_MOVLP(5:1)
unsigned nalct() const override
unsigned l1a24() const override
unsigned alct_dav
TMB_DAV(1)
unsigned short * data() override
unsigned bxn12() const override
unsigned clct_dav_mismatch_copy2
DMB_L1A[4:0].
void setBXN(int bxn) override
unsigned newddu_code_1
DMB_L1A[11:0].
void addNCLCT() override
unsigned crateID() const override
void setCrateAddress(int crate, int dmbId) override
unsigned dmb_bxn
constant, should be &#39;1010&#39;
unsigned ddu_code_2
DMB_CRATE(8)