Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DataFormats_RPCDigi_RecordSLD_H
0002 #define DataFormats_RPCDigi_RecordSLD_H
0003 
0004 #include "DataFormats/RPCDigi/interface/DataRecord.h"
0005 
0006 namespace rpcrawtodigi {
0007   class RecordSLD : public DataRecord {
0008   private:
0009     static const int SLD_TYPE_FLAG = 0x1F;
0010     static const int SLD_TYPE_SHIFT = 11;
0011     static const int TB_LINK_INPUT_NUMBER_MASK = 0x1F;
0012     static const int TB_LINK_INPUT_NUMBER_SHIFT = 0;
0013     static const int TB_RMB_MASK = 0X3F;
0014     static const int TB_RMB_SHIFT = 5;
0015 
0016   public:
0017     // empty record
0018     RecordSLD() : DataRecord() {}
0019 
0020     // set TB
0021     RecordSLD(int tbLinkInputNumber, int rmb) : DataRecord(0) {
0022       theData = SLD_TYPE_FLAG << SLD_TYPE_SHIFT;
0023       theData |= (tbLinkInputNumber << TB_LINK_INPUT_NUMBER_SHIFT);
0024       theData |= (rmb << TB_RMB_SHIFT);
0025     }
0026 
0027     // specialize given recort to this type
0028     RecordSLD(const DataRecord& rec) : DataRecord(rec) {}
0029 
0030     ~RecordSLD() override {}
0031 
0032     int tbLinkInputNumber() const { return (theData >> TB_LINK_INPUT_NUMBER_SHIFT) & TB_LINK_INPUT_NUMBER_MASK; }
0033 
0034     int rmb() const { return (theData >> TB_RMB_SHIFT) & TB_RMB_MASK; }
0035 
0036     static bool matchType(const DataRecord& record) { return (SLD_TYPE_FLAG == (record.data() >> SLD_TYPE_SHIFT)); }
0037     std::string print() const;
0038   };
0039 }  // namespace rpcrawtodigi
0040 #endif