CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
unsigned me_bxn
Definition: CSCSP_MEblock.h:23
unsigned int mpc(void) const
Definition: CSCSP_MEblock.h:69
unsigned int wireGroup(void) const
Definition: CSCSP_MEblock.h:73
unsigned zero_4
Definition: CSCSP_MEblock.h:37
unsigned aligment_fifo_empty
Definition: CSCSP_MEblock.h:36
unsigned int bxBit
Definition: CSCSP_MEblock.h:56
unsigned int spInput(void) const
Definition: CSCSP_MEblock.h:67
unsigned int sync_modified
Definition: CSCSP_MEblock.h:54
unsigned int vp(void) const
Definition: CSCSP_MEblock.h:87
unsigned int pattern(void) const
Definition: CSCSP_MEblock.h:75
unsigned clct_pattern_number
Definition: CSCSP_MEblock.h:10
unsigned bx0_
Definition: CSCSP_MEblock.h:19
unsigned int se(void) const
Definition: CSCSP_MEblock.h:88
unsigned aligment_fifo_full
Definition: CSCSP_MEblock.h:27
unsigned int timingError(void) const
Definition: CSCSP_MEblock.h:91
unsigned int sm(void) const
Definition: CSCSP_MEblock.h:89
unsigned csc_id
Definition: CSCSP_MEblock.h:17
unsigned left_right
Definition: CSCSP_MEblock.h:18
unsigned int errCnt(void) const
Definition: CSCSP_MEblock.h:84
unsigned zero_2
Definition: CSCSP_MEblock.h:21
unsigned int receiver_status_frame1(void) const
Definition: CSCSP_MEblock.h:81
unsigned int af(void) const
Definition: CSCSP_MEblock.h:90
unsigned int BXN(void) const
Definition: CSCSP_MEblock.h:63
unsigned int spInput_
Definition: CSCSP_MEblock.h:57
unsigned clct_pattern_id
Definition: CSCSP_MEblock.h:16
unsigned receiver_status_dv2
Definition: CSCSP_MEblock.h:34
unsigned receiver_status_dv1
Definition: CSCSP_MEblock.h:25
unsigned int sync_error
Definition: CSCSP_MEblock.h:53
unsigned int l_r(void) const
Definition: CSCSP_MEblock.h:72
unsigned receiver_status_er2
Definition: CSCSP_MEblock.h:33
unsigned bc0_
Definition: CSCSP_MEblock.h:20
unsigned receiver_status_er1
Definition: CSCSP_MEblock.h:24
CSCSP_MEblock(void)
Definition: CSCSP_MEblock.h:99
unsigned int alignment_fifo
Definition: CSCSP_MEblock.h:55
unsigned int csc(void) const
Definition: CSCSP_MEblock.h:70
unsigned int strip(void) const
Definition: CSCSP_MEblock.h:74
unsigned zero_1
Definition: CSCSP_MEblock.h:13
unsigned int bc0(void) const
Definition: CSCSP_MEblock.h:65
unsigned int tbin_
Definition: CSCSP_MEblock.h:51
unsigned int bx0(void) const
Definition: CSCSP_MEblock.h:64
unsigned int link(void) const
Definition: CSCSP_MEblock.h:68
unsigned quality_
Definition: CSCSP_MEblock.h:11
unsigned wire_group_id
Definition: CSCSP_MEblock.h:12
bool unpack(const unsigned short *&buf)
Definition: CSCSP_MEblock.h:93
unsigned mpc_id
Definition: CSCSP_MEblock.h:31
unsigned int quality(void) const
Definition: CSCSP_MEblock.h:62
unsigned err_prop_cnt
Definition: CSCSP_MEblock.h:32
unsigned int aligment_fifo(void) const
Definition: CSCSP_MEblock.h:78
unsigned int valid_pattern
Definition: CSCSP_MEblock.h:52
unsigned link_id
Definition: CSCSP_MEblock.h:30
unsigned int tbin(void) const
Definition: CSCSP_MEblock.h:86
unsigned zero_3
Definition: CSCSP_MEblock.h:28
bool check(void) const
Definition: CSCSP_MEblock.h:60
unsigned int receiver_status_frame2(void) const
Definition: CSCSP_MEblock.h:82