Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:37

0001 #ifndef DataFormats_RPCDigi_DataRecord_H
0002 #define DataFormats_RPCDigi_DataRecord_H
0003 
0004 #include <string>
0005 #include <bitset>
0006 #include <sstream>
0007 #include <cstdint>
0008 
0009 namespace rpcrawtodigi {
0010   class DataRecord {
0011   public:
0012     typedef uint16_t Data;
0013     enum DataRecordType {
0014       None = 0,
0015       StartOfBXData = 1,
0016       StartOfTbLinkInputNumberData = 2,
0017       ChamberData = 3,
0018       Empty = 4,
0019       RDDM = 5,
0020       SDDM = 6,
0021       RCDM = 7,
0022       RDM = 8,
0023       UndefinedType = 9
0024     };
0025 
0026   public:
0027     explicit DataRecord(const Data& data = None) : theData(data) {}
0028 
0029     virtual ~DataRecord() {}
0030 
0031     const Data& data() const { return theData; }
0032 
0033     DataRecordType type() const;
0034 
0035     static std::string name(const DataRecordType& code);
0036 
0037     std::string print() const {
0038       std::ostringstream str;
0039       str << std::bitset<16>(theData);
0040       return str.str();
0041     }
0042 
0043     static std::string print(const DataRecord& record);
0044 
0045   protected:
0046     Data theData;
0047   };
0048 }  // namespace rpcrawtodigi
0049 #endif