00001 #ifndef CSCDMBHeader_h 00002 #define CSCDMBHeader_h 00003 00004 #include <cassert> 00005 #include <iosfwd> 00006 #include <string.h> // bzero 00007 #include "DataFormats/CSCDigi/interface/CSCDMBStatusDigi.h" 00008 00009 class CSCDMBHeader { 00010 public: 00011 00012 CSCDMBHeader(); 00013 00014 CSCDMBHeader(unsigned short * buf); 00015 00016 CSCDMBHeader(const CSCDMBStatusDigi & digi) 00017 { 00018 memcpy(this, digi.header(), sizeInWords()*2); 00019 } 00020 00021 bool cfebAvailable(unsigned icfeb); 00022 00023 void addCFEB(int icfeb); 00024 void addNCLCT(); 00025 void addNALCT(); 00026 void setBXN(int bxn); 00027 void setL1A(int l1a); 00028 void setCrateAddress(int crate, int dmbId); 00029 void setdmbID(int newDMBID) {dmb_id = newDMBID;} 00030 00031 unsigned cfebActive() const {return cfeb_active;} 00032 unsigned crateID() const; 00033 unsigned dmbID() const; 00034 unsigned bxn() const; 00035 unsigned bxn12() const; 00036 unsigned l1a() const; 00037 unsigned cfebAvailable() const; 00038 unsigned nalct() const; 00039 unsigned nclct() const; 00040 unsigned cfebMovlp() const; 00041 unsigned dmbCfebSync() const; 00042 unsigned activeDavMismatch() const; 00043 00044 unsigned sizeInWords() const; 00045 00046 bool check() const; 00047 00048 unsigned short * data() {return (unsigned short *) this;} 00049 unsigned short * data() const {return (unsigned short *) this;} 00050 00051 00052 //ostream & operator<<(ostream &, const CSCDMBHeader &); 00053 00054 private: 00055 00056 unsigned dmb_l1a_copy2 : 12; 00058 unsigned newddu_code_1 : 4; 00059 00060 unsigned dmb_l1a_copy1 : 12; 00062 unsigned newddu_code_2 : 4; 00063 00064 unsigned cfeb_dav_1 : 5; 00065 unsigned cfeb_active : 5; 00066 unsigned alct_dav_4 : 1; 00067 unsigned tmb_dav_4 : 1; 00069 unsigned newddu_code_3 : 4; 00070 00071 00072 unsigned dmb_bxn1 : 12; 00074 unsigned newddu_code_4 : 4; 00075 00076 unsigned cfeb_dav : 5; //5 00077 unsigned alct_dav_1 : 1; // start 1 00078 unsigned active_dav_mismatch : 1; // new 00079 unsigned tmb_dav_1 : 1; 00080 unsigned active_dav_mismatch_2 : 1; // new 00081 unsigned alct_dav_2 : 1; 00082 unsigned active_dav_mismatch_3 : 1; // new 00083 unsigned tmb_dav_2 : 1; 00085 unsigned ddu_code_1 : 4; 00086 00087 unsigned dmb_id : 4; 00088 unsigned dmb_crate : 8; 00090 unsigned ddu_code_2: 4; 00091 00092 00093 00094 00095 unsigned dmb_bxn : 7; 00098 unsigned cfeb_movlp : 5; 00100 unsigned ddu_code_3 : 4; 00101 00102 unsigned dmb_l1a : 8; 00103 unsigned dmb_cfeb_sync : 4; 00105 unsigned ddu_code_4 : 4; 00106 00107 00108 }; 00109 00110 #endif 00111