File indexing completed on 2024-04-06 12:10:57
0001 #ifndef EventFilter_RPCRawToDigi_RPCCPPFRecord_h
0002 #define EventFilter_RPCRawToDigi_RPCCPPFRecord_h
0003
0004 #include <cstdint>
0005
0006 namespace rpccppf {
0007
0008 class RXRecord {
0009 protected:
0010 static std::uint32_t const link_mask_ = 0xfe000000;
0011 static std::uint32_t const bx_counter_mod_mask_ = 0x01f00000;
0012 static std::uint32_t const da_mask_ = 0x00080000;
0013 static std::uint32_t const de_mask_ = 0x00040000;
0014 static std::uint32_t const eod_mask_ = 0x00020000;
0015 static std::uint32_t const delay_mask_ = 0x0001c000;
0016 static std::uint32_t const link_board_mask_ = 0x00003000;
0017 static std::uint32_t const connector_mask_ = 0x00000e00;
0018 static std::uint32_t const partition_mask_ = 0x00000100;
0019 static std::uint32_t const partition_data_mask_ = 0x000000ff;
0020
0021 static unsigned int const link_offset_ = 25;
0022 static unsigned int const bx_counter_mod_offset_ = 20;
0023 static unsigned int const da_offset_ = 19;
0024 static unsigned int const de_offset_ = 18;
0025 static unsigned int const eod_offset_ = 17;
0026 static unsigned int const delay_offset_ = 14;
0027 static unsigned int const link_board_offset_ = 12;
0028 static unsigned int const connector_offset_ = 9;
0029 static unsigned int const partition_offset_ = 8;
0030 static unsigned int const partition_data_offset_ = 0;
0031
0032 public:
0033 RXRecord(std::uint32_t const record = da_mask_);
0034
0035 void set(std::uint32_t const record);
0036 void reset();
0037
0038 std::uint32_t const& getRecord() const;
0039
0040 unsigned int getLink() const;
0041 unsigned int getBXCounterMod() const;
0042 bool isAcknowledge() const;
0043 bool isError() const;
0044 bool isEOD() const;
0045 unsigned int getDelay() const;
0046 unsigned int getLinkBoard() const;
0047 unsigned int getConnector() const;
0048 unsigned int getPartition() const;
0049 std::uint8_t getPartitionData() const;
0050
0051 void setLink(unsigned int link);
0052 void setBXCounterMod(unsigned int bx);
0053 void setAcknowledge(bool da);
0054 void setError(bool de);
0055 void setEOD(bool eod);
0056 void setDelay(unsigned int delay);
0057 void setLinkBoard(unsigned int link_board);
0058 void setConnector(unsigned int connector);
0059 void setPartition(unsigned int partition);
0060 void setPartitionData(std::uint8_t data);
0061
0062 protected:
0063 std::uint32_t record_;
0064 };
0065
0066 class TXRecord {
0067 protected:
0068 static std::uint32_t const theta_mask_[2];
0069 static std::uint32_t const phi_mask_[2];
0070
0071 static unsigned int const theta_offset_[2];
0072 static unsigned int const phi_offset_[2];
0073
0074 public:
0075 TXRecord();
0076 TXRecord(std::uint32_t const record);
0077
0078 void set(std::uint32_t const record);
0079 void reset();
0080
0081 std::uint32_t const& getRecord() const;
0082
0083 unsigned int getTheta(unsigned int index) const;
0084 unsigned int getPhi(unsigned int index) const;
0085 bool isValid(unsigned int index) const;
0086
0087 void setTheta(unsigned int index, unsigned int theta);
0088 void setPhi(unsigned int index, unsigned int phi);
0089
0090 protected:
0091 std::uint32_t record_;
0092 };
0093
0094 }
0095
0096 #include "EventFilter/RPCRawToDigi/interface/RPCCPPFRecord.icc"
0097
0098 #endif