Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef EventFilter_RPCRawToDigi_RPCAMCRecord_icc
0002 #define EventFilter_RPCRawToDigi_RPCAMCRecord_icc
0003 
0004 #include "EventFilter/RPCRawToDigi/interface/RPCAMCRecord.h"
0005 
0006 namespace rpcamc {
0007 
0008   inline void Header::set(unsigned int nword, std::uint64_t const word) {
0009     if (nword < 2)
0010       record_[nword] = word;
0011   }
0012 
0013   inline void Header::reset() {
0014     record_[0] = 0x0;
0015     record_[1] = 0x0;
0016   }
0017 
0018   inline std::uint64_t const* Header::getRecord() const { return record_; }
0019 
0020   inline unsigned int Header::getAMCNumber() const { return (record_[0] & amc_number_mask_) >> amc_number_offset_; }
0021 
0022   inline unsigned int Header::getEventCounter() const {
0023     return (record_[0] & event_counter_mask_) >> event_counter_offset_;
0024   }
0025 
0026   inline unsigned int Header::getBXCounter() const { return (record_[0] & bx_counter_mask_) >> bx_counter_offset_; }
0027 
0028   inline unsigned int Header::getDataLength() const { return (record_[0] & data_length_mask_) >> data_length_offset_; }
0029 
0030   inline bool Header::hasDataLength() const { return ((record_[0] & data_length_mask_) != data_length_mask_); }
0031 
0032   inline unsigned int Header::getOrbitCounter() const {
0033     return (record_[1] & orbit_counter_mask_) >> orbit_counter_offset_;
0034   }
0035 
0036   inline unsigned int Header::getBoardId() const { return (record_[1] & board_id_mask_) >> board_id_offset_; }
0037 
0038   inline void Header::setAMCNumber(unsigned int amc_number) {
0039     record_[0] &= ~amc_number_mask_;
0040     record_[0] |= (((std::uint64_t)(amc_number) << amc_number_offset_) & amc_number_mask_);
0041   }
0042 
0043   inline void Header::setEventCounter(unsigned int event_counter) {
0044     record_[0] &= ~event_counter_mask_;
0045     record_[0] |= (((std::uint64_t)(event_counter) << event_counter_offset_) & event_counter_mask_);
0046   }
0047 
0048   inline void Header::setBXCounter(unsigned int bx_counter) {
0049     record_[0] &= ~bx_counter_mask_;
0050     record_[0] |= (((std::uint64_t)(bx_counter) << bx_counter_offset_) & bx_counter_mask_);
0051   }
0052 
0053   inline void Header::setDataLength(unsigned int data_length) {
0054     record_[0] &= ~data_length_mask_;
0055     record_[0] |= (((std::uint64_t)(data_length) << data_length_offset_) & data_length_mask_);
0056   }
0057 
0058   inline void Header::setOrbitCounter(unsigned int orbit_counter) {
0059     record_[1] &= ~orbit_counter_mask_;
0060     record_[1] |= (((std::uint64_t)(orbit_counter) << orbit_counter_offset_) & orbit_counter_mask_);
0061   }
0062 
0063   inline void Header::setBoardId(unsigned int board_id) {
0064     record_[1] &= ~board_id_mask_;
0065     record_[1] |= (((std::uint64_t)(board_id) << board_id_offset_) & board_id_mask_);
0066   }
0067 
0068   inline void Trailer::set(std::uint64_t const record) { record_ = record; }
0069 
0070   inline void Trailer::reset() { record_ = 0x0; }
0071 
0072   inline std::uint64_t const& Trailer::getRecord() const { return record_; }
0073 
0074   inline std::uint32_t Trailer::getCRC() const { return (record_ & crc_mask_) >> crc_offset_; }
0075 
0076   inline unsigned int Trailer::getEventCounter() const {
0077     return (record_ & event_counter_mask_) >> event_counter_offset_;
0078   }
0079 
0080   inline unsigned int Trailer::getDataLength() const { return (record_ & data_length_mask_) >> data_length_offset_; }
0081 
0082   inline void Trailer::setCRC(std::uint32_t crc) {
0083     record_ &= ~crc_mask_;
0084     record_ |= (((std::uint64_t)(crc) << crc_offset_) & crc_mask_);
0085   }
0086 
0087   inline void Trailer::setEventCounter(unsigned int event_counter) {
0088     record_ &= ~event_counter_mask_;
0089     record_ |= (((std::uint64_t)(event_counter) << event_counter_offset_) & event_counter_mask_);
0090   }
0091 
0092   inline void Trailer::setDataLength(unsigned int data_length) {
0093     record_ &= ~data_length_mask_;
0094     record_ |= (((std::uint64_t)(data_length) << data_length_offset_) & data_length_mask_);
0095   }
0096 
0097 }  // namespace rpcamc
0098 
0099 #endif  // EventFilter_RPCRawToDigi_RPCAMCRecord_icc