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