CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/EventFilter/CSCTFRawToDigi/src/CSCSPTrailer.h

Go to the documentation of this file.
00001 #ifndef CSCSPTrailer_h
00002 #define CSCSPTrailer_h
00003 
00004 class CSCSPTrailer {
00005 private:
00007         unsigned l1a_           : 8;
00008         unsigned word_count_low : 4;
00009         unsigned trailer_mark_1 : 4;  // constant, should be 1111 = 0xF
00011         unsigned trailer_mark_2 : 4;  // constant, should be 1111 = 0xF
00012         unsigned trailer_mark_3 : 3;  // constant, should be  111 = 0x7
00013         unsigned l1a_fifo_full_ : 1;
00014         unsigned word_count_high: 4;
00015         unsigned trailer_mark_4 : 4;  // constant, should be 1111 = 0xF
00017         unsigned month_            : 4;
00018         unsigned year_             : 4;
00019         unsigned bb_               : 1; // SP readout configuration year base (0 / 16)
00020         unsigned spare_1           : 1;
00021         unsigned spare_2           : 1;
00022         unsigned zero_1            : 1;
00023         unsigned trailer_mark_5    : 4;  // constant, should be 1111 = 0xF
00025         unsigned core_configuraton : 12;
00026         unsigned trailer_mark_6    : 4;  // constant, should be 1111 = 0xF
00028         unsigned day_              : 5;
00029         unsigned zero_2            : 7;
00030         unsigned trailer_mark_7    : 4;  // constant, should be 1110 = 0xE
00032         unsigned board_id_         : 12;
00033         unsigned trailer_mark_8    : 4;  // constant, should be 1110 = 0xE
00035         unsigned crc_low           : 11;
00036         unsigned crc_low_parity    : 1;
00037         unsigned trailer_mark_9    : 4;  // constant, should be 1110 = 0xE
00039         unsigned crc_high          : 11;
00040         unsigned crc_high_parity   : 1;
00041         unsigned trailer_mark_10   : 4;  // constant, should be 1110 = 0xE
00042 
00043         friend class CSCTFPacker;
00044 
00045 public:
00046         bool check(void) const throw() {
00047                 return spare_1!=0 || spare_2!=0 || zero_1!=0 || zero_2!=0 ||
00048                         trailer_mark_1!=0xF || trailer_mark_2!=0xF || trailer_mark_3!=0x7 || trailer_mark_4!=0xF || trailer_mark_5!=0xF || trailer_mark_6!=0xF ||
00049                         trailer_mark_7!=0xE || trailer_mark_8!=0xE || trailer_mark_9!=0xE || trailer_mark_10!=0xE;
00050         }
00051 
00052         unsigned int l1a_7bits     (void) const throw() { return l1a_; }
00053         unsigned int l1a_queue_size(void) const throw() { return (word_count_high<<4)|word_count_low; }
00054         bool         l1a_fifo_full (void) const throw() { return l1a_fifo_full_; }
00055 
00056         unsigned int year          (void) const throw() { return 2000+16*bb_+year_; }
00057         unsigned int month         (void) const throw() { return month_; }
00058         unsigned int day           (void) const throw() { return day_;   }
00059         unsigned int configuration (void) const throw() { return core_configuraton;  }
00060 
00061         //unsigned int slot    (void) const throw() { return  board_id_&0x1F;       }
00062         //unsigned int sector  (void) const throw() { return (board_id_&0x700)>>8;  }
00063         //unsigned int endcap  (void) const throw() { return (board_id_&0x800)>>11; }
00064 
00065         unsigned int board_id(void) const throw() { return  board_id_;             }
00066 
00067         unsigned int crc     (void) const throw() { return crc_low|(crc_high<<11); }
00068 
00069         bool unpack(const unsigned short *&buf) throw()  { memcpy(this, buf, 8*sizeof(short)); buf+=8; return check(); }
00070 
00071         CSCSPTrailer(void){}
00072 };
00073 
00074 #endif