CMS 3D CMS Logo

CSCSP_MEblock.h
Go to the documentation of this file.
1 #ifndef CSCSP_MEblock_h
2 #define CSCSP_MEblock_h
3 
4 #include <cstring>
5 
6 class CSCSP_MEblock {
7 private:
9  // higher pattern number - straighter high-momentum tracks with more layers hit, also encodes half/di-strip indication
10  unsigned clct_pattern_number : 4;
11  unsigned quality_ : 4; // the more hits the higher LCT Quality
12  unsigned wire_group_id : 7; // radial position of the pattern within the chamber (0-111)
13  unsigned zero_1 : 1; // format specific
15  unsigned
16  clct_pattern_id : 8; // azimuthal position ot the pattern at the third (key) layer: (0-159 for half-strips 0-39 for di-strips)
17  unsigned csc_id : 4; // chamber # (1-9)
18  unsigned left_right : 1; // L/R - track is heading towards lower/higher strip number
19  unsigned bx0_ : 1; // BX counter least significant bit
20  unsigned bc0_ : 1; // BC Zero flag marks that next BXN = 0
21  unsigned zero_2 : 1; // format specific
23  unsigned me_bxn : 12; // LCT arrival time picked from a local 12-bit BX Counter, that runs at link timing
24  unsigned receiver_status_er1 : 1; // receiver status for the frame 1 (see below)
25  unsigned receiver_status_dv1 : 1; // receiver status for the frame 1 (see below)
26  unsigned
27  aligment_fifo_full : 1; // Alignment FIFO Full Flag, should be 0, if AF has been initialized successfully by L1Reset
28  unsigned zero_3 : 1; // format specific
30  unsigned link_id : 2; // Link number (1-3) [reported by MPC on every L1 Reset]
31  unsigned mpc_id : 6; // MPC Crate number (0-63) [reported by MPC on every L1 Reset]
32  unsigned err_prop_cnt : 4; // accumulates the "Receive Error Propagation" occurrences since last L1Reset
33  unsigned receiver_status_er2 : 1; // receiver status for the frame 2 (see below)
34  unsigned receiver_status_dv2 : 1; // receiver status for the frame 2 (see below)
35  // Alignment FIFO Empty Flag, should be 0, if AF has been initialized successfully by L1Reset
36  unsigned aligment_fifo_empty : 1;
37  unsigned zero_4 : 1; // format specific
38 
39  // Optical Receiver Status options:
40  // {receiver_status_dv, receiver_status_er} = {Receive Data Valid, Receive Error}
41  // {0,0} - Receive Idle Character;
42  // {0,1} - Receive Carrier Extend;
43  // {1,0} - Receive Normal Data Character <- expect to have;
44  // {1,1} - Receive Error Propagation;
45 
46  // Other data members logically belong to ME Block record,
47  // but physically are located in Data Block Header, which implementation is:
48  friend class CSCSPRecord;
49  friend class CSCTFPacker;
50  // Let this class set following data memebers:
51  unsigned int tbin_; // time bin, that this ME block belongs to in global SP record
52  unsigned int valid_pattern; // LCT valid bit
53  unsigned int sync_error; // LCT synchronization error bit
54  unsigned int sync_modified; // LCT modified synchronization error bit
55  unsigned int alignment_fifo; // AF error
56  unsigned int bxBit; // monitors the ALCT/TMB/MPC timing
57  unsigned int spInput_; // Input SP link, this LCT come through [1..15] (as SP sees it)
58 
59 public:
60  bool check(void) const throw() { return zero_1 != 0 || zero_2 != 0 || zero_3 != 0 || zero_4 != 0; }
61 
62  unsigned int quality(void) const throw() { return quality_; }
63  unsigned int BXN(void) const throw() { return me_bxn; }
64  unsigned int bx0(void) const throw() { return bx0_; }
65  unsigned int bc0(void) const throw() { return bc0_; }
66 
67  unsigned int spInput(void) const throw() { return spInput_; }
68  unsigned int link(void) const throw() { return link_id; }
69  unsigned int mpc(void) const throw() { return mpc_id; }
70  unsigned int csc(void) const throw() { return csc_id; }
71 
72  unsigned int l_r(void) const throw() { return left_right; }
73  unsigned int wireGroup(void) const throw() { return wire_group_id; }
74  unsigned int strip(void) const throw() { return clct_pattern_id; }
75  unsigned int pattern(void) const throw() { return clct_pattern_number; }
76 
77  enum AF { EMPTY = 1, FULL = 2 };
78  unsigned int aligment_fifo(void) const throw() { return (aligment_fifo_full << 1) | aligment_fifo_empty; }
79 
80  enum RS { IDLE_CHARs = 0, CARRIER_EXTEND = 1, NORMAL_DATA = 2, ERROR_PROP = 3 };
81  unsigned int receiver_status_frame1(void) const throw() { return (receiver_status_dv1 << 1) | receiver_status_er1; }
82  unsigned int receiver_status_frame2(void) const throw() { return (receiver_status_dv2 << 1) | receiver_status_er2; }
83 
84  unsigned int errCnt(void) const throw() { return err_prop_cnt; }
85 
86  unsigned int tbin(void) const throw() { return tbin_; }
87  unsigned int vp(void) const throw() { return valid_pattern; }
88  unsigned int se(void) const throw() { return sync_error; }
89  unsigned int sm(void) const throw() { return sync_modified; }
90  unsigned int af(void) const throw() { return alignment_fifo; }
91  unsigned int timingError(void) const throw() { return bxBit; }
92 
93  bool unpack(const unsigned short *&buf) throw() {
94  std::memcpy((void *)this, buf, 4 * sizeof(short));
95  buf += 4;
96  return check();
97  }
98 
99  CSCSP_MEblock(void) {}
100 };
101 
102 #endif
CSCSP_MEblock::mpc
unsigned int mpc(void) const
Definition: CSCSP_MEblock.h:69
CSCSP_MEblock::tbin
unsigned int tbin(void) const
Definition: CSCSP_MEblock.h:86
CSCSP_MEblock::timingError
unsigned int timingError(void) const
Definition: CSCSP_MEblock.h:91
CSCSP_MEblock::se
unsigned int se(void) const
Definition: CSCSP_MEblock.h:88
CSCSP_MEblock::aligment_fifo_empty
unsigned aligment_fifo_empty
Definition: CSCSP_MEblock.h:36
CSCSP_MEblock::spInput
unsigned int spInput(void) const
Definition: CSCSP_MEblock.h:67
CSCSP_MEblock::EMPTY
Definition: CSCSP_MEblock.h:77
CSCSP_MEblock::sync_error
unsigned int sync_error
Definition: CSCSP_MEblock.h:53
CSCSP_MEblock::wireGroup
unsigned int wireGroup(void) const
Definition: CSCSP_MEblock.h:73
CSCSP_MEblock::zero_3
unsigned zero_3
Definition: CSCSP_MEblock.h:28
CSCSP_MEblock::aligment_fifo
unsigned int aligment_fifo(void) const
Definition: CSCSP_MEblock.h:78
CSCSP_MEblock::clct_pattern_id
unsigned clct_pattern_id
Definition: CSCSP_MEblock.h:16
CSCSP_MEblock::unpack
bool unpack(const unsigned short *&buf)
Definition: CSCSP_MEblock.h:93
CSCSP_MEblock::receiver_status_er1
unsigned receiver_status_er1
Definition: CSCSP_MEblock.h:24
CSCSP_MEblock::ERROR_PROP
Definition: CSCSP_MEblock.h:80
CSCSP_MEblock::zero_4
unsigned zero_4
Definition: CSCSP_MEblock.h:37
CSCSP_MEblock::receiver_status_er2
unsigned receiver_status_er2
Definition: CSCSP_MEblock.h:33
CSCSP_MEblock::sm
unsigned int sm(void) const
Definition: CSCSP_MEblock.h:89
CSCSP_MEblock::pattern
unsigned int pattern(void) const
Definition: CSCSP_MEblock.h:75
CSCSP_MEblock::NORMAL_DATA
Definition: CSCSP_MEblock.h:80
CSCSP_MEblock::af
unsigned int af(void) const
Definition: CSCSP_MEblock.h:90
CSCSP_MEblock::mpc_id
unsigned mpc_id
Definition: CSCSP_MEblock.h:31
CSCSP_MEblock::zero_2
unsigned zero_2
Definition: CSCSP_MEblock.h:21
CSCSPRecord
Definition: CSCSPRecord.h:9
CSCSP_MEblock::zero_1
unsigned zero_1
Definition: CSCSP_MEblock.h:13
CSCSP_MEblock::me_bxn
unsigned me_bxn
Definition: CSCSP_MEblock.h:23
CSCSP_MEblock::check
bool check(void) const
Definition: CSCSP_MEblock.h:60
CSCSP_MEblock::bx0_
unsigned bx0_
Definition: CSCSP_MEblock.h:19
CSCSP_MEblock
Definition: CSCSP_MEblock.h:6
CSCTFPacker
Definition: CSCTFPacker.h:18
CSCSP_MEblock::link
unsigned int link(void) const
Definition: CSCSP_MEblock.h:68
CSCSP_MEblock::l_r
unsigned int l_r(void) const
Definition: CSCSP_MEblock.h:72
CSCSP_MEblock::strip
unsigned int strip(void) const
Definition: CSCSP_MEblock.h:74
CSCSP_MEblock::clct_pattern_number
unsigned clct_pattern_number
Definition: CSCSP_MEblock.h:10
CSCSP_MEblock::CSCSP_MEblock
CSCSP_MEblock(void)
Definition: CSCSP_MEblock.h:99
CSCSP_MEblock::vp
unsigned int vp(void) const
Definition: CSCSP_MEblock.h:87
CSCSP_MEblock::aligment_fifo_full
unsigned aligment_fifo_full
Definition: CSCSP_MEblock.h:27
CSCSP_MEblock::quality_
unsigned quality_
Definition: CSCSP_MEblock.h:11
CSCSP_MEblock::spInput_
unsigned int spInput_
Definition: CSCSP_MEblock.h:57
CSCSP_MEblock::IDLE_CHARs
Definition: CSCSP_MEblock.h:80
CSCSP_MEblock::quality
unsigned int quality(void) const
Definition: CSCSP_MEblock.h:62
CSCSP_MEblock::wire_group_id
unsigned wire_group_id
Definition: CSCSP_MEblock.h:12
CSCSP_MEblock::CARRIER_EXTEND
Definition: CSCSP_MEblock.h:80
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCSP_MEblock::receiver_status_frame1
unsigned int receiver_status_frame1(void) const
Definition: CSCSP_MEblock.h:81
CSCSP_MEblock::RS
RS
Definition: CSCSP_MEblock.h:80
CSCSP_MEblock::valid_pattern
unsigned int valid_pattern
Definition: CSCSP_MEblock.h:52
CSCSP_MEblock::errCnt
unsigned int errCnt(void) const
Definition: CSCSP_MEblock.h:84
CSCSP_MEblock::left_right
unsigned left_right
Definition: CSCSP_MEblock.h:18
CSCSP_MEblock::FULL
Definition: CSCSP_MEblock.h:77
CSCSP_MEblock::csc_id
unsigned csc_id
Definition: CSCSP_MEblock.h:17
CSCSP_MEblock::alignment_fifo
unsigned int alignment_fifo
Definition: CSCSP_MEblock.h:55
CSCSP_MEblock::tbin_
unsigned int tbin_
Definition: CSCSP_MEblock.h:51
CSCSP_MEblock::csc
unsigned int csc(void) const
Definition: CSCSP_MEblock.h:70
CSCSP_MEblock::AF
AF
Definition: CSCSP_MEblock.h:77
CSCSP_MEblock::bx0
unsigned int bx0(void) const
Definition: CSCSP_MEblock.h:64
CSCSP_MEblock::receiver_status_frame2
unsigned int receiver_status_frame2(void) const
Definition: CSCSP_MEblock.h:82
CSCSP_MEblock::bxBit
unsigned int bxBit
Definition: CSCSP_MEblock.h:56
CSCSP_MEblock::receiver_status_dv2
unsigned receiver_status_dv2
Definition: CSCSP_MEblock.h:34
CSCSP_MEblock::link_id
unsigned link_id
Definition: CSCSP_MEblock.h:30
CSCSP_MEblock::err_prop_cnt
unsigned err_prop_cnt
Definition: CSCSP_MEblock.h:32
CSCSP_MEblock::BXN
unsigned int BXN(void) const
Definition: CSCSP_MEblock.h:63
CSCSP_MEblock::sync_modified
unsigned int sync_modified
Definition: CSCSP_MEblock.h:54
CSCSP_MEblock::receiver_status_dv1
unsigned receiver_status_dv1
Definition: CSCSP_MEblock.h:25
CSCSP_MEblock::bc0
unsigned int bc0(void) const
Definition: CSCSP_MEblock.h:65
CSCSP_MEblock::bc0_
unsigned bc0_
Definition: CSCSP_MEblock.h:20