Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader2005.h"
0002 #include <iostream>
0003 
0004 CSCDMBHeader2005::CSCDMBHeader2005() {
0005   bzero(data(), sizeInWords() * 2);
0006   bits.ddu_code_1 = bits.ddu_code_2 = bits.ddu_code_3 = bits.ddu_code_4 = 0xA;
0007   bits.newddu_code_1 = bits.newddu_code_2 = bits.newddu_code_3 = bits.newddu_code_4 = 0x9;
0008 }
0009 
0010 CSCDMBHeader2005::CSCDMBHeader2005(const uint16_t* buf) { memcpy(data(), buf, sizeInWords() * 2); }
0011 
0012 unsigned CSCDMBHeader2005::cfebMovlp() const { return bits.cfeb_movlp; }
0013 
0014 unsigned CSCDMBHeader2005::dmbCfebSync() const { return bits.dmb_cfeb_sync; }
0015 
0016 unsigned CSCDMBHeader2005::activeDavMismatch() const { return bits.active_dav_mismatch; }
0017 
0018 unsigned CSCDMBHeader2005::cfebAvailable() const { return bits.cfeb_dav; }
0019 
0020 unsigned CSCDMBHeader2005::nalct() const { return bits.alct_dav_1; }
0021 
0022 unsigned CSCDMBHeader2005::nclct() const { return bits.tmb_dav_1; }
0023 
0024 unsigned CSCDMBHeader2005::crateID() const { return bits.dmb_crate; }
0025 
0026 unsigned CSCDMBHeader2005::dmbID() const { return bits.dmb_id; }
0027 
0028 unsigned CSCDMBHeader2005::bxn() const { return bits.dmb_bxn; }
0029 
0030 unsigned CSCDMBHeader2005::bxn12() const { return bits.dmb_bxn1; }
0031 
0032 unsigned CSCDMBHeader2005::l1a() const { return bits.dmb_l1a; }
0033 
0034 unsigned CSCDMBHeader2005::l1a24() const { return (bits.dmb_l1a_lowo | (bits.dmb_l1a_hiwo << 12)); }
0035 
0036 void CSCDMBHeader2005::setL1A(int l1a) { bits.dmb_l1a = l1a; }
0037 
0038 void CSCDMBHeader2005::setL1A24(int l1a) {
0039   bits.dmb_l1a_lowo = l1a & 0xFFF;
0040   bits.dmb_l1a_hiwo = (l1a >> 12) & 0xFFF;
0041 }
0042 
0043 void CSCDMBHeader2005::setBXN(int bxn) {
0044   bits.dmb_bxn = bxn & 0x3F;
0045   bits.dmb_bxn1 = bxn & 0xFFF;
0046 }
0047 
0048 void CSCDMBHeader2005::setCrateAddress(int crate, int dmbId) {
0049   this->bits.dmb_crate = crate;
0050   this->bits.dmb_id = dmbId;
0051 }
0052 
0053 unsigned CSCDMBHeader2005::sizeInWords() const { return 8; }
0054 
0055 /// counts from zero
0056 bool CSCDMBHeader2005::cfebAvailable(unsigned icfeb) {
0057   assert(icfeb < 5);
0058   return (cfebAvailable() >> icfeb) & 1;
0059 }
0060 
0061 unsigned CSCDMBHeader2005::format_version() const { return 0; }
0062 
0063 void CSCDMBHeader2005::addCFEB(int icfeb) {
0064   assert(icfeb < 5);
0065   bits.cfeb_dav |= (1 << icfeb);
0066   bits.cfeb_active |= (1 << icfeb);
0067 }
0068 
0069 void CSCDMBHeader2005::addNCLCT() { bits.tmb_dav_1 = bits.tmb_dav_2 = bits.tmb_dav_4 = 1; }
0070 
0071 void CSCDMBHeader2005::addNALCT() { bits.alct_dav_1 = bits.alct_dav_2 = bits.alct_dav_4 = 1; }
0072 
0073 bool CSCDMBHeader2005::check() const {
0074   return (bits.ddu_code_1 == 0xA && bits.ddu_code_2 == 0xA && bits.ddu_code_3 == 0xA && bits.ddu_code_4 == 0xA &&
0075           bits.newddu_code_1 == 0x9 && bits.newddu_code_2 == 0x9 && bits.newddu_code_3 == 0x9 &&
0076           bits.newddu_code_4 == 0x9);
0077 }