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
CSCDMBHeader2013::cfebAvailable
unsigned cfebAvailable() const override
Definition: CSCDMBHeader2013.cc:20
CSCDMBHeader2013::newddu_code_4
unsigned newddu_code_4
DMB_BXN[11:0].
Definition: CSCDMBHeader2013.h:112
CSCDMBHeader2013::clct_dav_mismatch_copy2
unsigned clct_dav_mismatch_copy2
DMB_L1A[4:0].
Definition: CSCDMBHeader2013.h:138
CSCDMBHeader2013::fmt_version
unsigned fmt_version
CLCT-DAV-Mismatch(1)
Definition: CSCDMBHeader2013.h:105
CSCDMBHeader2013::ddu_code_2
unsigned ddu_code_2
DMB_CRATE(8)
Definition: CSCDMBHeader2013.h:125
CSCDMBHeader2013::dmb_l1a_lowo
unsigned dmb_l1a_lowo
1st Header word
Definition: CSCDMBHeader2013.h:95
CSCDMBStatusDigi.h
CSCDMBHeader2013::l1a24
unsigned l1a24() const override
Definition: CSCDMBHeader2013.cc:36
CSCDMBHeader2013::CSCDMBHeader2013
CSCDMBHeader2013()
Definition: CSCDMBHeader2013.cc:4
CSCDMBHeader2013::dmb_cfeb_sync
unsigned dmb_cfeb_sync
Fmt_Vers(1:0)
Definition: CSCDMBHeader2013.h:140
CSCDMBHeader2013::setdmbID
void setdmbID(int newDMBID) override
Definition: CSCDMBHeader2013.h:64
CSCDMBHeader2013::bxn
unsigned bxn() const override
Definition: CSCDMBHeader2013.cc:30
CSCDMBHeader2013::crateID
unsigned crateID() const override
Definition: CSCDMBHeader2013.cc:26
CSCDMBHeader2013::sizeInWords
unsigned sizeInWords() const override
Definition: CSCDMBHeader2013.cc:55
CSCDMBHeader2013::l1a
unsigned l1a() const override
Definition: CSCDMBHeader2013.cc:34
CSCDMBHeader2013::bxn12
unsigned bxn12() const override
Definition: CSCDMBHeader2013.cc:32
CSCDMBHeader2013::activeDavMismatch
unsigned activeDavMismatch() const override
Definition: CSCDMBHeader2013.cc:16
CSCDMBHeader2013::setL1A
void setL1A(int l1a) override
Definition: CSCDMBHeader2013.cc:38
CSCDMBHeader2013::format_version
unsigned format_version() const override
Definition: CSCDMBHeader2013.cc:18
CSCDMBHeader2013::ddu_code_1
unsigned ddu_code_1
ALCT_DAV(1)
Definition: CSCDMBHeader2013.h:120
CSCDMBHeader2013::tmb_dav
unsigned tmb_dav
Fmt_Vers(1:0)
Definition: CSCDMBHeader2013.h:106
CSCDMBHeader2013::dmb_crate
unsigned dmb_crate
DMB_ID(4)
Definition: CSCDMBHeader2013.h:124
CSCDMBHeader2013::fmt_version_copy2
unsigned fmt_version_copy2
CLCT-DAV-Mismatch(1)
Definition: CSCDMBHeader2013.h:139
CSCDMBHeader2013::ddu_code_4
unsigned ddu_code_4
DMB-CFEB-Sync[3:0].
Definition: CSCDMBHeader2013.h:141
CSCVDMBHeaderFormat.h
CSCDMBHeader2013::newddu_code_3
unsigned newddu_code_3
ALCT_DAV(1)
Definition: CSCDMBHeader2013.h:108
CSCDMBHeader2013::dmb_l1a_hiwo
unsigned dmb_l1a_hiwo
constant, should be 1001
Definition: CSCDMBHeader2013.h:99
CSCDMBHeader2013::alct_dav_copy2
unsigned alct_dav_copy2
TMB_DAV(1)
Definition: CSCDMBHeader2013.h:133
CSCDMBHeader2013::dmb_bxn1
unsigned dmb_bxn1
constant, should be 1001
Definition: CSCDMBHeader2013.h:111
CSCDMBHeader2013::tmb_dav_copy
unsigned tmb_dav_copy
Fmt_Vers(1:0)
Definition: CSCDMBHeader2013.h:118
CSCDMBHeader2013::clct_dav_mismatch_copy
unsigned clct_dav_mismatch_copy
CFEB_DAV(7:1)
Definition: CSCDMBHeader2013.h:116
CSCDMBHeader2013::cfebActive
unsigned cfebActive() const override
Definition: CSCDMBHeader2013.h:67
CSCDMBHeader2013::ddu_code_3
unsigned ddu_code_3
ALCT_DAV(1)
Definition: CSCDMBHeader2013.h:134
CSCDMBHeader2013::dmbCfebSync
unsigned dmbCfebSync() const override
Definition: CSCDMBHeader2013.cc:14
CSCDMBHeader2013::check
bool check() const override
Definition: CSCDMBHeader2013.cc:73
CSCDMBHeader2013::addNALCT
void addNALCT() override
Definition: CSCDMBHeader2013.cc:71
CSCDMBHeader2013::cfeb_dav
unsigned cfeb_dav
constant, should be 1001
Definition: CSCDMBHeader2013.h:115
CSCDMBHeader2013::cfeb_movlp
unsigned cfeb_movlp
Definition: CSCDMBHeader2013.h:131
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCDMBHeader2013::nalct
unsigned nalct() const override
Definition: CSCDMBHeader2013.cc:22
CSCDMBHeader2013::newddu_code_2
unsigned newddu_code_2
DMB_L1A[23:12].
Definition: CSCDMBHeader2013.h:100
CSCDMBHeader2013::addCFEB
void addCFEB(int icfeb) override
Definition: CSCDMBHeader2013.cc:63
CSCDMBHeader2013::dmb_l1a
unsigned dmb_l1a
constant, should be '1010'
Definition: CSCDMBHeader2013.h:137
CSCDMBHeader2013::setL1A24
void setL1A24(int l1a) override
Definition: CSCDMBHeader2013.cc:40
CSCDMBHeader2013::clct_dav_mismatch
unsigned clct_dav_mismatch
CFEB_CLCT_SENT(7:1)
Definition: CSCDMBHeader2013.h:104
CSCVDMBHeaderFormat
Definition: CSCVDMBHeaderFormat.h:8
CSCDMBHeader2013::dmbID
unsigned dmbID() const override
Definition: CSCDMBHeader2013.cc:28
CSCDMBHeader2013::addNCLCT
void addNCLCT() override
Definition: CSCDMBHeader2013.cc:69
CSCDMBHeader2013::alct_dav_copy
unsigned alct_dav_copy
TMB_DAV(1)
Definition: CSCDMBHeader2013.h:119
CSCDMBHeader2013::data
unsigned short * data() const override
Definition: CSCDMBHeader2013.h:87
CSCDMBHeader2013::setdmbVersion
void setdmbVersion(unsigned int version) override
Definition: CSCDMBHeader2013.h:65
CSCDMBHeader2013
Definition: CSCDMBHeader2013.h:43
CSCDMBHeader2013::setCrateAddress
void setCrateAddress(int crate, int dmbId) override
Definition: CSCDMBHeader2013.cc:50
CSCDMBHeader2013::bits
struct CSCDMBHeader2013::@470 bits
CSCDMBHeader2013::dmb_id
unsigned dmb_id
constant, should be '1010'
Definition: CSCDMBHeader2013.h:123
CSCDMBHeader2013::newddu_code_1
unsigned newddu_code_1
DMB_L1A[11:0].
Definition: CSCDMBHeader2013.h:96
CSCDMBHeader2013::nclct
unsigned nclct() const override
Definition: CSCDMBHeader2013.cc:24
CSCDMBHeader2013::alct_dav
unsigned alct_dav
TMB_DAV(1)
Definition: CSCDMBHeader2013.h:107
CSCDMBHeader2013::data
unsigned short * data() override
Definition: CSCDMBHeader2013.h:86
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
CSCDMBHeader2013::dmb_bxn
unsigned dmb_bxn
constant, should be '1010'
Definition: CSCDMBHeader2013.h:128
CSCDMBHeader2013::setBXN
void setBXN(int bxn) override
Definition: CSCDMBHeader2013.cc:45
CSCDMBHeader2013::cfebMovlp
unsigned cfebMovlp() const override
Definition: CSCDMBHeader2013.cc:12
CSCDMBHeader2013::cfeb_clct_sent
unsigned cfeb_clct_sent
constant, should be 1001
Definition: CSCDMBHeader2013.h:103
CSCDMBHeader2013::tmb_dav_copy2
unsigned tmb_dav_copy2
CFEB_MOVLP(5:1)
Definition: CSCDMBHeader2013.h:132
CSCDMBHeader2013::fmt_version_copy
unsigned fmt_version_copy
CLCT-DAV-Mismatch(1)
Definition: CSCDMBHeader2013.h:117