test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <string.h> // bzero
43 
45 // public:
46 
48 
49  CSCDMBHeader2013(unsigned short * buf);
50 /*
51  CSCDMBHeader2013(const CSCDMBStatusDigi & digi)
52  {
53  memcpy(this, digi.header(), sizeInWords()*2);
54  }
55 */
56  virtual bool cfebAvailable(unsigned icfeb);
57 
58  virtual void addCFEB(int icfeb);
59  virtual void addNCLCT();
60  virtual void addNALCT();
61  virtual void setBXN(int bxn);
62  virtual void setL1A(int l1a);
63  virtual void setL1A24(int l1a);
64  virtual void setCrateAddress(int crate, int dmbId);
65  virtual void setdmbID(int newDMBID) { bits.dmb_id = newDMBID; }
66  virtual void setdmbVersion(unsigned int version) {bits.fmt_version = (version<4) ? version: 0;}
67 
68  virtual unsigned cfebActive() const { return bits.cfeb_clct_sent; }
69  virtual unsigned crateID() const;
70  virtual unsigned dmbID() const;
71  virtual unsigned bxn() const;
72  virtual unsigned bxn12() const;
73  virtual unsigned l1a() const;
74  virtual unsigned l1a24() const;
75  virtual unsigned cfebAvailable() const;
76  virtual unsigned nalct() const;
77  virtual unsigned nclct() const;
78  virtual unsigned cfebMovlp() const;
79  virtual unsigned dmbCfebSync() const;
80  virtual unsigned activeDavMismatch() const;
81  virtual unsigned format_version() const;
82 
83  unsigned sizeInWords() const;
84 
85  bool check() const;
86 
87  virtual unsigned short * data() {return (unsigned short *)(&bits);}
88  virtual unsigned short * data() const { 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 
virtual void setL1A(int l1a)
bool check() const
unsigned fmt_version
CLCT-DAV-Mismatch(1)
virtual void setdmbID(int newDMBID)
unsigned dmb_cfeb_sync
Fmt_Vers(1:0)
unsigned dmb_l1a_lowo
1st Header word
unsigned fmt_version_copy
CLCT-DAV-Mismatch(1)
virtual unsigned l1a() const
unsigned newddu_code_4
DMB_BXN[11:0].
virtual unsigned l1a24() const
virtual void setBXN(int bxn)
virtual unsigned format_version() const
virtual unsigned cfebActive() const
virtual void addNCLCT()
unsigned fmt_version_copy2
CLCT-DAV-Mismatch(1)
virtual unsigned nclct() const
virtual void setCrateAddress(int crate, int dmbId)
virtual unsigned crateID() const
unsigned clct_dav_mismatch_copy
CFEB_DAV(7:1)
unsigned ddu_code_4
DMB-CFEB-Sync[3:0].
unsigned tmb_dav_copy
Fmt_Vers(1:0)
virtual unsigned bxn() const
virtual unsigned bxn12() const
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)
virtual void addNALCT()
virtual void addCFEB(int icfeb)
unsigned newddu_code_2
DMB_L1A[23:12].
struct CSCDMBHeader2013::@320 bits
virtual unsigned cfebAvailable() const
unsigned dmb_crate
DMB_ID(4)
virtual unsigned dmbCfebSync() const
virtual unsigned short * data()
virtual unsigned nalct() const
virtual unsigned activeDavMismatch() const
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)
virtual unsigned short * data() const
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 cfeb_clct_sent
constant, should be 1001
virtual unsigned cfebMovlp() const
unsigned tmb_dav_copy2
CFEB_MOVLP(5:1)
virtual void setL1A24(int l1a)
virtual unsigned dmbID() const
unsigned alct_dav
TMB_DAV(1)
unsigned clct_dav_mismatch_copy2
DMB_L1A[4:0].
unsigned newddu_code_1
DMB_L1A[11:0].
virtual void setdmbVersion(unsigned int version)
unsigned dmb_bxn
constant, should be &#39;1010&#39;
unsigned sizeInWords() const
unsigned ddu_code_2
DMB_CRATE(8)