00001 //_______________________________________ 00002 // 00003 // Class to group TMB data 00004 // CSCTMBData 9/18/03 B.Mohr 00005 //_______________________________________ 00006 // 00007 00008 #ifndef CSCTMBData_h 00009 #define CSCTMBData_h 00010 00011 #include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h" 00012 #include "EventFilter/CSCRawToDigi/interface/CSCCLCTData.h" 00013 #include "EventFilter/CSCRawToDigi/interface/CSCTMBScope.h" 00014 #include "EventFilter/CSCRawToDigi/interface/CSCTMBTrailer.h" 00015 #include "EventFilter/CSCRawToDigi/interface/CSCRPCData.h" 00016 #include <bitset> 00017 #include <boost/dynamic_bitset.hpp> 00018 00019 00020 class CSCTMBData { 00021 00022 public: 00023 00024 CSCTMBData(); 00025 ~CSCTMBData(); 00026 CSCTMBData(unsigned short *buf); 00027 CSCTMBData(const CSCTMBData& data); 00028 int UnpackTMB(unsigned short *buf); 00030 bool checkSize() const; 00031 static void setDebug(const bool value) {debug = value;} 00032 short unsigned int CWordCnt() const {return cWordCnt;} 00033 int getCRC() const {return theTMBTrailer.crc22();} 00034 const unsigned short size() const {return size_;} 00035 00036 CSCTMBHeader * tmbHeader() {return &theTMBHeader;} 00037 CSCCLCTData * clctData() {return &theCLCTData;} 00039 bool hasTMBScope() const { return theTMBScopeIsPresent;} 00040 CSCTMBScope & tmbScope() const; 00041 CSCTMBTrailer * tmbTrailer() {return &theTMBTrailer;} 00043 bool hasRPC() const {return theRPCDataIsPresent;} 00044 CSCRPCData * rpcData() {return &theRPCData;} 00045 00047 00049 boost::dynamic_bitset<> pack(); 00050 00051 00052 std::bitset<22> calCRC22(const std::vector< std::bitset<16> >& datain); 00053 std::bitset<22> nextCRC22_D16(const std::bitset<16>& D, const std::bitset<22>& C); 00054 int TMBCRCcalc(); 00055 00057 static void selfTest(); 00058 00059 private: 00060 00063 unsigned short * theOriginalBuffer; 00066 unsigned theB0CLine; 00067 unsigned theE0FLine; 00068 00069 CSCTMBHeader theTMBHeader; 00070 CSCCLCTData theCLCTData; 00071 CSCRPCData theRPCData; 00073 bool theTMBScopeIsPresent; 00074 CSCTMBScope * theTMBScope; 00075 00076 CSCTMBTrailer theTMBTrailer; 00077 static bool debug; 00078 unsigned short size_; 00079 unsigned short cWordCnt; 00080 bool theRPCDataIsPresent; 00081 }; 00082 00083 #endif