CMS 3D CMS Logo

CSCDDUHeader.cc
Go to the documentation of this file.
2 #include <cstring> // for bzero
3 #include <iostream>
4 
6  bzero(this, sizeInWords() * 2);
7  init();
8 }
9 
10 CSCDDUHeader::CSCDDUHeader(unsigned bx, unsigned l1num, unsigned sourceId, unsigned fmt_version)
11  : format_version_(fmt_version & 0xF), source_id_(sourceId), bxnum_(bx), lvl1num_(l1num) {
12  bzero(this, sizeInWords() * 2);
14  bxnum_ = bx;
15  lvl1num_ = l1num;
16  format_version_ = fmt_version & 0xF;
17  init();
18 }
19 
21  bit64_ = 5;
22  header2_2_ = 0x0001;
23  header2_1_ = header2_3_ = 0x8000;
24 }
25 
26 void CSCDDUHeader::setDMBDAV(int dduInput) {
27  // Set appropriate bit in dmb_dav_
28 
29  dmb_dav_ |= ((1 << dduInput) & 0x7FFF); // dduInput is 0-14
30 
31  live_cscs_ |= ((1 << dduInput) & 0x7FFF); // Set DDU Inputs Connected to "Live" CSCs
32 
33  // Count bits set in dmb_dav_... for the trick used see
34  // http://en.wikipedia.org/wiki/Hamming_weight or http://graphics.stanford.edu/~seander/bithacks.html
35 
36  ncsc_ = 0;
37  unsigned short dmbdav = dmb_dav_;
38  for (; dmbdav; ++ncsc_) {
39  dmbdav &= dmbdav - 1;
40  }
41 }
42 
43 bool CSCDDUHeader::check() const {
44  //std::cout <<"SANDRIK"<<std::hex <<header2_1_<<" "<<header2_2_ <<" "<<header2_3_<<std::endl;
45  return bit64_ == 5 && header2_1_ == 0x8000 && header2_3_ == 0x8000 && header2_2_ == 0x0001;
46 }
CSCDDUHeader::lvl1num_
unsigned lvl1num_
Definition: CSCDDUHeader.h:59
CSCDDUHeader.h
CSCDDUHeader::bxnum_
unsigned bxnum_
Definition: CSCDDUHeader.h:57
CSCDDUHeader::check
bool check() const
Definition: CSCDDUHeader.cc:43
CSCDDUHeader::header2_2_
unsigned header2_2_
Definition: CSCDDUHeader.h:67
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
CSCDDUHeader::setDMBDAV
void setDMBDAV(int dduInput)
Definition: CSCDDUHeader.cc:26
CSCDDUHeader::init
void init()
initializes constants
Definition: CSCDDUHeader.cc:20
CSCDDUHeader::header2_3_
unsigned header2_3_
Definition: CSCDDUHeader.h:68
CSCDDUHeader::dmb_dav_
unsigned dmb_dav_
Definition: CSCDDUHeader.h:73
CSCDDUHeader::header2_1_
unsigned header2_1_
Definition: CSCDDUHeader.h:66
CSCDDUHeader::sizeInWords
static unsigned sizeInWords()
Definition: CSCDDUHeader.h:31
CSCDDUHeader::bit64_
unsigned bit64_
should always be 5
Definition: CSCDDUHeader.h:62
CSCDDUHeader::CSCDDUHeader
CSCDDUHeader()
Definition: CSCDDUHeader.cc:5
CSCDDUHeader::live_cscs_
unsigned live_cscs_
Definition: CSCDDUHeader.h:75
CSCDDUHeader::source_id_
unsigned source_id_
Definition: CSCDDUHeader.h:56
objects.autophobj.sourceId
sourceId
Definition: autophobj.py:239
CSCDDUHeader::ncsc_
unsigned ncsc_
Definition: CSCDDUHeader.h:70
CSCDDUHeader::format_version_
unsigned format_version_
Definition: CSCDDUHeader.h:55