Go to the documentation of this file.00001 #ifndef CSCSPHeader_h
00002 #define CSCSPHeader_h
00003
00004 #include <string.h>
00005
00006 class CSCSPHeader {
00007 private:
00009 unsigned sp_l1a_low : 12;
00010 unsigned header_mark_1 : 4;
00011
00012 unsigned sp_l1a_high : 12;
00013 unsigned header_mark_2 : 4;
00014
00015 unsigned zero_1 : 12;
00016 unsigned header_mark_3 : 4;
00017
00018 unsigned sp_bxn : 12;
00019 unsigned header_mark_4 : 4;
00020
00022 unsigned zero_2 : 12;
00023 unsigned header_mark_5 : 4;
00024
00025 unsigned sp_slot_number : 5;
00026 unsigned sp_ersv : 3;
00027 unsigned sp_trigger_sector : 4;
00028
00029 unsigned header_mark_6 : 4;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 unsigned fmm_status : 6;
00042 unsigned ddm : 1;
00043 unsigned zero_3 : 5;
00044 unsigned header_mark_7 : 4;
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 unsigned csr_dfc : 11;
00062 unsigned skip : 1;
00063 unsigned header_mark_8 : 4;
00064
00065 friend class CSCTFPacker;
00066
00067 public:
00068 bool check(void) const {
00069 return header_mark_1!=0x9 || header_mark_2!=0x9 || header_mark_3!=0x9 || header_mark_4!=0x9
00070 || header_mark_5!=0xA || header_mark_6!=0xA || header_mark_7!=0xA || header_mark_8!=0xA
00071 || zero_1!=0 || zero_2!=0 || zero_3!=0;
00072 }
00073
00074 unsigned int BXN(void) const throw() { return sp_bxn; }
00075 unsigned int L1A(void) const throw() { return (sp_l1a_high<<12)|sp_l1a_low; }
00076
00077 unsigned int slot (void) const throw() { return sp_slot_number; }
00078 unsigned int trigger_sector(void) const throw() { return sp_trigger_sector; }
00079
00080 unsigned int sector(void) const throw() {
00081 if(sp_ersv<2) return sp_trigger_sector&0x7;
00082 else return (sp_trigger_sector<=6?sp_trigger_sector:sp_trigger_sector-6);
00083 }
00084 unsigned int endcap(void) const throw() {
00085 if(sp_ersv<2) return sp_trigger_sector&0x8;
00086 else return (sp_trigger_sector<=6?1:0);
00087 }
00088
00089 enum FMM {WOF=1,OSY=2,BUZY=4,READY=8,FA_OSY=16,SP_OSY=32};
00090 unsigned int status(void) const throw() { return fmm_status; }
00091
00092 unsigned int nTBINs(void) const throw() { return csr_dfc&0x7; }
00093
00094 bool suppression(void) const throw() { return csr_dfc&0x8; }
00095
00096 enum ACTIVE {F1=1,F2=2,F3=4,F4=8,F5=16,DT=32,SP=64};
00097 unsigned int active(void) const throw() { return csr_dfc>>4; }
00098
00099 bool empty(void) const throw() { return skip; }
00100
00101 int format_version(void) const throw() { return sp_ersv; }
00102 bool ddu_readout (void) const throw() { return ddm; }
00103
00104 bool unpack(const unsigned short *&buf) throw() { memcpy((void*)this,buf,8*sizeof(short)); buf+=8; return check(); }
00105
00106 CSCSPHeader(void){}
00107 };
00108
00109 #endif