File indexing completed on 2024-04-06 12:10:29
0001 #ifndef CSCSP_MBblock_h
0002 #define CSCSP_MBblock_h
0003
0004 #include <cstring>
0005
0006 class CSCSP_MBblock {
0007 private:
0008
0009 unsigned quality_ : 3;
0010 unsigned zero_1 : 1;
0011 unsigned phi_bend_ : 5;
0012 unsigned zero_2 : 3;
0013 unsigned flag_ : 1;
0014 unsigned cal_ : 1;
0015 unsigned zero_3 : 2;
0016
0017 unsigned phi_ : 12;
0018 unsigned bxn1_ : 1;
0019 unsigned bxn0_ : 1;
0020 unsigned bc0_ : 1;
0021 unsigned zero_4 : 1;
0022
0023 unsigned mb_bxn_ : 12;
0024 unsigned spare_1 : 3;
0025 unsigned zero_5 : 1;
0026
0027 unsigned spare_2 : 15;
0028 unsigned zero_6 : 1;
0029
0030
0031
0032 friend class CSCSPRecord;
0033 friend class CSCTFPacker;
0034
0035 unsigned int tbin_;
0036 unsigned int valid_quality;
0037 unsigned int alignment_fifo;
0038 unsigned int bxBit;
0039 unsigned int id_;
0040
0041 public:
0042 bool check(void) const throw() {
0043 return zero_1 != 0 || zero_2 != 0 || zero_3 != 0 || zero_4 != 0 || zero_5 != 0 || zero_6 != 0 || spare_1 != 0 ||
0044 spare_2 != 0;
0045 }
0046
0047 unsigned int quality(void) const throw() { return quality_; }
0048 unsigned int phi_bend(void) const throw() { return phi_bend_; }
0049 unsigned int flag(void) const throw() { return flag_; }
0050 unsigned int cal(void) const throw() { return cal_; }
0051
0052 unsigned int phi(void) const throw() { return phi_; }
0053 unsigned int bxn(void) const throw() { return (bxn1_ << 1) | bxn0_; }
0054 unsigned int bc0(void) const throw() { return bc0_; }
0055 unsigned int BXN(void) const throw() { return mb_bxn_; }
0056
0057 unsigned int id(void) const throw() { return id_; }
0058 unsigned int tbin(void) const throw() { return tbin_; }
0059 unsigned int vq(void) const throw() { return valid_quality; }
0060 unsigned int af(void) const throw() { return alignment_fifo; }
0061 unsigned int timingError(void) const throw() { return bxBit; }
0062
0063 bool unpack(const unsigned short *&buf) throw() {
0064 std::memcpy(this, buf, 4 * sizeof(short));
0065 buf += 4;
0066 return check();
0067 }
0068
0069 CSCSP_MBblock(void) {}
0070 };
0071
0072 #endif