CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/EventFilter/CSCRawToDigi/src/CSCDMBHeader.cc

Go to the documentation of this file.
00001 #include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader.h"
00002 #include <iostream>
00003 
00004 
00005 CSCDMBHeader::CSCDMBHeader() 
00006 {
00007   bzero(this, sizeInWords()*2);
00008   ddu_code_1 = ddu_code_2 = ddu_code_3 = ddu_code_4 = 0xA;
00009   newddu_code_1 = newddu_code_2 = newddu_code_3 = newddu_code_4 = 0x9;
00010 }
00011 
00012 CSCDMBHeader::CSCDMBHeader(unsigned short * buf) 
00013 {
00014   memcpy(this, buf, sizeInWords()*2);
00015 }
00016 
00017 
00018 unsigned CSCDMBHeader::cfebMovlp() const 
00019 {
00020   return cfeb_movlp;
00021 }
00022 
00023 
00024 unsigned CSCDMBHeader::dmbCfebSync() const 
00025 {
00026   return dmb_cfeb_sync;
00027 }
00028 
00029 unsigned CSCDMBHeader::activeDavMismatch() const 
00030 {
00031   return active_dav_mismatch;
00032 }
00033 
00034 
00035 unsigned CSCDMBHeader::cfebAvailable() const 
00036 {
00037   return cfeb_dav;
00038 }
00039 
00040 
00041 unsigned CSCDMBHeader::nalct() const 
00042 {
00043   return alct_dav_1;
00044 }
00045 
00046 unsigned CSCDMBHeader::nclct() const 
00047 {
00048   return tmb_dav_1;
00049 }
00050 
00051 unsigned CSCDMBHeader::crateID() const 
00052 {
00053   return dmb_crate;
00054 }
00055 
00056 unsigned CSCDMBHeader::dmbID() const 
00057 {
00058   return dmb_id;
00059 }
00060 
00061 unsigned CSCDMBHeader::bxn() const 
00062 {
00063   return dmb_bxn;
00064 } 
00065 
00066 unsigned CSCDMBHeader::bxn12() const
00067 {
00068   return dmb_bxn1;
00069 }
00070 
00071 
00072 
00073 
00074 unsigned CSCDMBHeader::l1a() const 
00075 {
00076   return dmb_l1a;
00077 } 
00078 
00079 
00080 void CSCDMBHeader::setL1A(int l1a) 
00081 {
00082   dmb_l1a = l1a;
00083 }
00084 
00085 void CSCDMBHeader::setBXN(int bxn) 
00086 {
00087   dmb_bxn = bxn;
00088 } 
00089 
00090 
00091 void CSCDMBHeader::setCrateAddress(int crate, int dmbId) 
00092 {
00093     this->dmb_crate = crate;
00094     this->dmb_id = dmbId;
00095 }
00096 
00097 unsigned CSCDMBHeader::sizeInWords() const 
00098 {
00099   return 8;
00100 }
00101 
00103 bool CSCDMBHeader::cfebAvailable(unsigned icfeb)
00104 {
00105   assert (icfeb < 5);
00106   return (cfebAvailable() >> icfeb) & 1;
00107 }
00108 
00109 void CSCDMBHeader::addCFEB(int icfeb) 
00110 {
00111   assert(icfeb < 5);
00112   cfeb_dav |= (1 << icfeb);
00113 }
00114 
00115 void CSCDMBHeader::addNCLCT() 
00116 {
00117   tmb_dav_1 =  tmb_dav_2 =  tmb_dav_4 = 1;
00118 }
00119 
00120 void CSCDMBHeader::addNALCT() 
00121 {
00122   alct_dav_1 = alct_dav_2 = alct_dav_4 = 1;
00123 }
00124 
00125 
00126 bool CSCDMBHeader::check() const 
00127 {
00128     return (ddu_code_1==0xA && ddu_code_2==0xA && 
00129             ddu_code_3==0xA && ddu_code_4==0xA && 
00130             newddu_code_1==0x9 && newddu_code_2==0x9 &&  
00131             newddu_code_3==0x9 && newddu_code_4==0x9);
00132 }
00133