CMS 3D CMS Logo

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