File indexing completed on 2024-04-06 12:05:08
0001 #include "DataFormats/RPCDigi/interface/DataRecord.h"
0002 #include "DataFormats/RPCDigi/interface/RecordBX.h"
0003 #include "DataFormats/RPCDigi/interface/RecordSLD.h"
0004 #include "DataFormats/RPCDigi/interface/RecordCD.h"
0005 #include "DataFormats/RPCDigi/interface/EmptyWord.h"
0006 #include "DataFormats/RPCDigi/interface/ErrorRDM.h"
0007 #include "DataFormats/RPCDigi/interface/ErrorSDDM.h"
0008 #include "DataFormats/RPCDigi/interface/ErrorRDDM.h"
0009 #include "DataFormats/RPCDigi/interface/ErrorRCDM.h"
0010
0011 using namespace rpcrawtodigi;
0012
0013 rpcrawtodigi::DataRecord::DataRecordType rpcrawtodigi::DataRecord::type() const {
0014 DataRecordType wordType = UndefinedType;
0015 if (RecordBX::matchType(*this))
0016 wordType = StartOfBXData;
0017 if (RecordSLD::matchType(*this))
0018 wordType = StartOfTbLinkInputNumberData;
0019 if (RecordCD::matchType(*this))
0020 wordType = ChamberData;
0021 if (EmptyWord::matchType(*this))
0022 wordType = Empty;
0023 if (ErrorRCDM::matchType(*this))
0024 wordType = RCDM;
0025 if (ErrorSDDM::matchType(*this))
0026 wordType = SDDM;
0027 if (ErrorRDDM::matchType(*this))
0028 wordType = RDDM;
0029 if (ErrorRDM::matchType(*this))
0030 wordType = RDM;
0031
0032 return wordType;
0033 }
0034
0035 std::string rpcrawtodigi::DataRecord::print(const rpcrawtodigi::DataRecord& record) {
0036 std::ostringstream str;
0037
0038 if (RecordBX::matchType(record))
0039 return RecordBX(record).print();
0040 if (RecordSLD::matchType(record))
0041 return RecordSLD(record).print();
0042 if (RecordCD::matchType(record))
0043 return RecordCD(record).print();
0044 if (EmptyWord::matchType(record))
0045 return EmptyWord().print();
0046 if (ErrorRCDM::matchType(record))
0047 return ErrorRCDM(record).print();
0048 if (ErrorSDDM::matchType(record))
0049 return ErrorSDDM(record).print();
0050 if (ErrorRDDM::matchType(record))
0051 return ErrorRDDM(record).print();
0052 if (ErrorRDM::matchType(record))
0053 return ErrorRDM(record).print();
0054
0055 return str.str();
0056 }
0057
0058 std::string rpcrawtodigi::DataRecord::name(const rpcrawtodigi::DataRecord::DataRecordType& code) {
0059 std::string result;
0060 switch (code) {
0061 case (None): {
0062 result = "None";
0063 break;
0064 }
0065 case (StartOfBXData): {
0066 result = "StartOfBXData";
0067 break;
0068 }
0069 case (StartOfTbLinkInputNumberData): {
0070 result = "StartOfTBLnkData";
0071 break;
0072 }
0073 case (ChamberData): {
0074 result = "ChamberData";
0075 break;
0076 }
0077 case (Empty): {
0078 result = "Empty";
0079 break;
0080 }
0081 case (RDDM): {
0082 result = "RDDM";
0083 break;
0084 }
0085 case (SDDM): {
0086 result = "SDDM";
0087 break;
0088 }
0089 case (RCDM): {
0090 result = "RCDM";
0091 break;
0092 }
0093 case (RDM): {
0094 result = "RDM";
0095 break;
0096 }
0097 default: {
0098 result = "UndefinedType";
0099 }
0100 }
0101 return result;
0102 }