Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:16

0001 #include "EventFilter/RPCRawToDigi/interface/RPCTwinMuxRecord.h"
0002 
0003 namespace rpctwinmux {
0004 
0005   TwinMuxRecord::TwinMuxRecord(std::uint64_t const record) : record_(record) {}
0006 
0007   BlockHeader::BlockHeader(std::uint64_t const record) : record_(record) {}
0008 
0009   BlockHeader::BlockHeader(unsigned int ufov, unsigned int n_amc, unsigned int orbit_counter) : record_(0x0) {
0010     setFirmwareVersion(ufov);
0011     setNAMC(n_amc);
0012     setOrbitCounter(orbit_counter);
0013   }
0014 
0015   BlockTrailer::BlockTrailer(std::uint64_t const record) : record_(record) {}
0016 
0017   BlockTrailer::BlockTrailer(std::uint32_t crc,
0018                              unsigned int block_number,
0019                              unsigned int event_counter,
0020                              unsigned int bx_counter)
0021       : record_(0x0) {
0022     setCRC(crc);
0023     setBlockNumber(block_number);
0024     setEventCounter(event_counter);
0025     setBXCounter(bx_counter);
0026   }
0027 
0028   BlockAMCContent::BlockAMCContent(std::uint64_t const record) : record_(record) {}
0029 
0030   BlockAMCContent::BlockAMCContent(bool length_correct,
0031                                    bool last_block,
0032                                    bool first_block,
0033                                    bool enabled,
0034                                    bool present,
0035                                    bool valid,
0036                                    bool crc_ok,
0037                                    unsigned int size,
0038                                    unsigned int block_number,
0039                                    unsigned int amc_number,
0040                                    unsigned int board_id)
0041       : record_(0x0) {
0042     setLengthCorrect(length_correct);
0043     setLastBlock(last_block);
0044     setFirstBlock(first_block);
0045     setEnabled(enabled);
0046     setPresent(present);
0047     setValid(valid);
0048     setCRCOk(crc_ok);
0049     setSize(size);
0050     setBlockNumber(block_number);
0051     setAMCNumber(amc_number);
0052     setBoardId(board_id);
0053   }
0054 
0055   TwinMuxHeader::TwinMuxHeader() {
0056     record_[0] = 0x0;
0057     record_[1] = dt_bx_window_mask_ | rpc_bx_window_mask_ | ho_bx_window_mask_;
0058   }
0059 
0060   TwinMuxHeader::TwinMuxHeader(std::uint64_t const record[2]) {
0061     record_[0] = record[0];
0062     record_[1] = record[1];
0063   }
0064 
0065   TwinMuxHeader::TwinMuxHeader(unsigned int amc_number,
0066                                unsigned int event_counter,
0067                                unsigned int bx_counter,
0068                                unsigned int data_length,
0069                                unsigned int orbit_counter,
0070                                unsigned int board_id,
0071                                unsigned int dt_bx_window,
0072                                int rpc_bx_min,
0073                                int rpc_bx_max,
0074                                unsigned int ho_bx_window) {
0075     record_[0] = 0x0;
0076     record_[1] = dt_bx_window_mask_ | rpc_bx_window_mask_ | ho_bx_window_mask_;
0077 
0078     setAMCNumber(amc_number);
0079     setEventCounter(event_counter);
0080     setBXCounter(bx_counter);
0081     setDataLength(data_length);
0082 
0083     setOrbitCounter(orbit_counter);
0084     setBoardId(board_id);
0085 
0086     setDTBXWindow(dt_bx_window);
0087     setRPCBXWindow(rpc_bx_min, rpc_bx_max);
0088     setHOBXWindow(ho_bx_window);
0089   }
0090 
0091   TwinMuxTrailer::TwinMuxTrailer(std::uint64_t const record) : record_(record) {}
0092 
0093   TwinMuxTrailer::TwinMuxTrailer(std::uint32_t crc, unsigned int event_counter, unsigned int data_length)
0094       : record_(0x0) {
0095     setCRC(crc);
0096     setEventCounter(event_counter);
0097     setDataLength(data_length);
0098   }
0099 
0100   RPCLinkRecord::RPCLinkRecord(std::uint32_t const record) : record_(record) {}
0101 
0102   RPCBXRecord::RPCBXRecord(std::uint8_t const record) : record_(record) {}
0103 
0104   unsigned int const RPCRecord::link_record_word_[] = {0, 0, 1, 1, 1};
0105   unsigned int const RPCRecord::link_record_offset_[] = {20, 0, 40, 20, 0};
0106   unsigned int const RPCRecord::bx_record_offset_[] = {52, 49, 46, 43, 40};
0107 
0108   RPCRecord::RPCRecord() {
0109     record_[0] = TwinMuxRecord::rpc_first_identifier_ |
0110                  ((std::uint64_t)RPCLinkRecord::da_mask_ << link_record_offset_[0]) |
0111                  ((std::uint64_t)RPCLinkRecord::da_mask_ << link_record_offset_[1]);
0112     record_[1] = TwinMuxRecord::rpc_second_identifier_ |
0113                  ((std::uint64_t)RPCLinkRecord::da_mask_ << link_record_offset_[2]) |
0114                  ((std::uint64_t)RPCLinkRecord::da_mask_ << link_record_offset_[3]) |
0115                  ((std::uint64_t)RPCLinkRecord::da_mask_ << link_record_offset_[4]);
0116   }
0117 
0118   RPCRecord::RPCRecord(std::uint64_t const record[2]) {
0119     record_[0] = record[0];
0120     record_[1] = record[1];
0121   }
0122 
0123 }  // namespace rpctwinmux