Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:57

0001 #ifndef EventFilter_RPCRawToDigi_RPCCPPFRecord_icc
0002 #define EventFilter_RPCRawToDigi_RPCCPPFRecord_icc
0003 
0004 #include "EventFilter/RPCRawToDigi/interface/RPCCPPFRecord.h"
0005 
0006 namespace rpccppf {
0007 
0008   inline void RXRecord::set(std::uint32_t const record) { record_ = record; }
0009 
0010   inline void RXRecord::reset() { record_ = da_mask_; }
0011 
0012   inline std::uint32_t const& RXRecord::getRecord() const { return record_; }
0013 
0014   inline unsigned int RXRecord::getLink() const { return (record_ & link_mask_) >> link_offset_; }
0015 
0016   inline unsigned int RXRecord::getBXCounterMod() const {
0017     return (record_ & bx_counter_mod_mask_) >> bx_counter_mod_offset_;
0018   }
0019 
0020   inline bool RXRecord::isAcknowledge() const { return ((record_ & da_mask_) ? true : false); }
0021 
0022   inline bool RXRecord::isError() const { return ((record_ & de_mask_) ? true : false); }
0023 
0024   inline bool RXRecord::isEOD() const { return ((record_ & eod_mask_) ? true : false); }
0025 
0026   inline unsigned int RXRecord::getDelay() const { return (record_ & delay_mask_) >> delay_offset_; }
0027 
0028   inline unsigned int RXRecord::getLinkBoard() const { return (record_ & link_board_mask_) >> link_board_offset_; }
0029 
0030   inline unsigned int RXRecord::getConnector() const { return (record_ & connector_mask_) >> connector_offset_; }
0031 
0032   inline unsigned int RXRecord::getPartition() const { return (record_ & partition_mask_) >> partition_offset_; }
0033 
0034   inline std::uint8_t RXRecord::getPartitionData() const {
0035     return (record_ & partition_data_mask_) >> partition_data_offset_;
0036   }
0037 
0038   inline void RXRecord::setLink(unsigned int link) {
0039     record_ &= ~link_mask_;
0040     record_ |= (((std::uint32_t)(link) << link_offset_) & link_mask_);
0041   }
0042 
0043   inline void RXRecord::setBXCounterMod(unsigned int bx) {
0044     bx %= 27;
0045     record_ &= ~bx_counter_mod_mask_;
0046     record_ |= (((std::uint32_t)(bx) << bx_counter_mod_offset_) & bx_counter_mod_mask_);
0047   }
0048 
0049   inline void RXRecord::setAcknowledge(bool da) {
0050     if (da)
0051       record_ |= da_mask_;
0052     else
0053       record_ &= ~(da_mask_);
0054   }
0055 
0056   inline void RXRecord::setError(bool de) {
0057     if (de)
0058       record_ |= de_mask_;
0059     else
0060       record_ &= ~(de_mask_);
0061   }
0062 
0063   inline void RXRecord::setEOD(bool eod) {
0064     if (eod)
0065       record_ |= eod_mask_;
0066     else
0067       record_ &= ~(eod_mask_);
0068   }
0069 
0070   inline void RXRecord::setDelay(unsigned int delay) {
0071     record_ &= ~delay_mask_;
0072     record_ |= (((std::uint32_t)(delay) << delay_offset_) & delay_mask_);
0073   }
0074 
0075   inline void RXRecord::setLinkBoard(unsigned int link_board) {
0076     record_ &= ~link_board_mask_;
0077     record_ |= (((std::uint32_t)(link_board) << link_board_offset_) & link_board_mask_);
0078   }
0079 
0080   inline void RXRecord::setConnector(unsigned int connector) {
0081     record_ &= ~connector_mask_;
0082     record_ |= (((std::uint32_t)(connector) << connector_offset_) & connector_mask_);
0083   }
0084 
0085   inline void RXRecord::setPartition(unsigned int partition) {
0086     record_ &= ~partition_mask_;
0087     record_ |= (((std::uint32_t)(partition) << partition_offset_) & partition_mask_);
0088   }
0089 
0090   inline void RXRecord::setPartitionData(std::uint8_t data) {
0091     record_ &= ~partition_data_mask_;
0092     record_ |= (((std::uint32_t)(data) << partition_data_offset_) & partition_data_mask_);
0093   }
0094 
0095   inline void TXRecord::set(std::uint32_t const record) { record_ = record; }
0096 
0097   inline void TXRecord::reset() { record_ = phi_mask_[0] | phi_mask_[1]; }
0098 
0099   inline std::uint32_t const& TXRecord::getRecord() const { return record_; }
0100 
0101   inline unsigned int TXRecord::getTheta(unsigned int index) const {
0102     if (index < 2) {
0103       return (record_ & theta_mask_[index]) >> theta_offset_[index];
0104     }
0105     return 0;
0106   }
0107 
0108   inline unsigned int TXRecord::getPhi(unsigned int index) const {
0109     if (index < 2) {
0110       return (record_ & phi_mask_[index]) >> phi_offset_[index];
0111     }
0112     return 0;
0113   }
0114 
0115   inline bool TXRecord::isValid(unsigned int index) const {
0116     if (index < 2) {
0117       return ((record_ & phi_mask_[index]) == phi_mask_[index] ? false : true);
0118     }
0119     return false;
0120   }
0121 
0122   inline void TXRecord::setTheta(unsigned int index, unsigned int theta) {
0123     if (index < 2) {
0124       record_ &= ~theta_mask_[index];
0125       record_ |= (((std::uint32_t)(theta) << theta_offset_[index]) & theta_mask_[index]);
0126     }
0127   }
0128 
0129   inline void TXRecord::setPhi(unsigned int index, unsigned int phi) {
0130     if (index < 2) {
0131       record_ &= ~phi_mask_[index];
0132       record_ |= (((std::uint32_t)(phi) << phi_offset_[index]) & phi_mask_[index]);
0133     }
0134   }
0135 
0136 }  // namespace rpccppf
0137 
0138 #endif  // EventFilter_RPCRawToDigi_RPCCPPFRecord_icc