File indexing completed on 2024-04-06 12:10:26
0001 #include "EventFilter/CSCRawToDigi/interface/CSCDDUHeader.h"
0002 #include <cstring> // for bzero
0003 #include <iostream>
0004
0005 CSCDDUHeader::CSCDDUHeader() {
0006 bzero(this, sizeInWords() * 2);
0007 init();
0008 }
0009
0010 CSCDDUHeader::CSCDDUHeader(unsigned bx, unsigned l1num, unsigned sourceId, unsigned fmt_version)
0011 : format_version_(fmt_version & 0xF), source_id_(sourceId), bxnum_(bx), lvl1num_(l1num) {
0012 bzero(this, sizeInWords() * 2);
0013 source_id_ = sourceId;
0014 bxnum_ = bx;
0015 lvl1num_ = l1num;
0016 format_version_ = fmt_version & 0xF;
0017 init();
0018 }
0019
0020 void CSCDDUHeader::init() {
0021 bit64_ = 5;
0022 header2_2_ = 0x0001;
0023 header2_1_ = header2_3_ = 0x8000;
0024 }
0025
0026 void CSCDDUHeader::setDMBDAV(int dduInput) {
0027
0028
0029 dmb_dav_ |= ((1 << dduInput) & 0x7FFF);
0030
0031 live_cscs_ |= ((1 << dduInput) & 0x7FFF);
0032
0033
0034
0035
0036 ncsc_ = 0;
0037 unsigned short dmbdav = dmb_dav_;
0038 for (; dmbdav; ++ncsc_) {
0039 dmbdav &= dmbdav - 1;
0040 }
0041 }
0042
0043 bool CSCDDUHeader::check() const {
0044
0045 return bit64_ == 5 && header2_1_ == 0x8000 && header2_3_ == 0x8000 && header2_2_ == 0x0001;
0046 }