File indexing completed on 2024-04-06 12:10:29
0001 #ifndef CSCSP_MEblock_h
0002 #define CSCSP_MEblock_h
0003
0004 #include <cstring>
0005
0006 class CSCSP_MEblock {
0007 private:
0008
0009
0010 unsigned clct_pattern_number : 4;
0011 unsigned quality_ : 4;
0012 unsigned wire_group_id : 7;
0013 unsigned zero_1 : 1;
0014
0015 unsigned
0016 clct_pattern_id : 8;
0017 unsigned csc_id : 4;
0018 unsigned left_right : 1;
0019 unsigned bx0_ : 1;
0020 unsigned bc0_ : 1;
0021 unsigned zero_2 : 1;
0022
0023 unsigned me_bxn : 12;
0024 unsigned receiver_status_er1 : 1;
0025 unsigned receiver_status_dv1 : 1;
0026 unsigned
0027 aligment_fifo_full : 1;
0028 unsigned zero_3 : 1;
0029
0030 unsigned link_id : 2;
0031 unsigned mpc_id : 6;
0032 unsigned err_prop_cnt : 4;
0033 unsigned receiver_status_er2 : 1;
0034 unsigned receiver_status_dv2 : 1;
0035
0036 unsigned aligment_fifo_empty : 1;
0037 unsigned zero_4 : 1;
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 friend class CSCSPRecord;
0049 friend class CSCTFPacker;
0050
0051 unsigned int tbin_;
0052 unsigned int valid_pattern;
0053 unsigned int sync_error;
0054 unsigned int sync_modified;
0055 unsigned int alignment_fifo;
0056 unsigned int bxBit;
0057 unsigned int spInput_;
0058
0059 public:
0060 bool check(void) const throw() { return zero_1 != 0 || zero_2 != 0 || zero_3 != 0 || zero_4 != 0; }
0061
0062 unsigned int quality(void) const throw() { return quality_; }
0063 unsigned int BXN(void) const throw() { return me_bxn; }
0064 unsigned int bx0(void) const throw() { return bx0_; }
0065 unsigned int bc0(void) const throw() { return bc0_; }
0066
0067 unsigned int spInput(void) const throw() { return spInput_; }
0068 unsigned int link(void) const throw() { return link_id; }
0069 unsigned int mpc(void) const throw() { return mpc_id; }
0070 unsigned int csc(void) const throw() { return csc_id; }
0071
0072 unsigned int l_r(void) const throw() { return left_right; }
0073 unsigned int wireGroup(void) const throw() { return wire_group_id; }
0074 unsigned int strip(void) const throw() { return clct_pattern_id; }
0075 unsigned int pattern(void) const throw() { return clct_pattern_number; }
0076
0077 enum AF { EMPTY = 1, FULL = 2 };
0078 unsigned int aligment_fifo(void) const throw() { return (aligment_fifo_full << 1) | aligment_fifo_empty; }
0079
0080 enum RS { IDLE_CHARs = 0, CARRIER_EXTEND = 1, NORMAL_DATA = 2, ERROR_PROP = 3 };
0081 unsigned int receiver_status_frame1(void) const throw() { return (receiver_status_dv1 << 1) | receiver_status_er1; }
0082 unsigned int receiver_status_frame2(void) const throw() { return (receiver_status_dv2 << 1) | receiver_status_er2; }
0083
0084 unsigned int errCnt(void) const throw() { return err_prop_cnt; }
0085
0086 unsigned int tbin(void) const throw() { return tbin_; }
0087 unsigned int vp(void) const throw() { return valid_pattern; }
0088 unsigned int se(void) const throw() { return sync_error; }
0089 unsigned int sm(void) const throw() { return sync_modified; }
0090 unsigned int af(void) const throw() { return alignment_fifo; }
0091 unsigned int timingError(void) const throw() { return bxBit; }
0092
0093 bool unpack(const unsigned short *&buf) throw() {
0094 std::memcpy((void *)this, buf, 4 * sizeof(short));
0095 buf += 4;
0096 return check();
0097 }
0098
0099 CSCSP_MEblock(void) {}
0100 };
0101
0102 #endif