CMS 3D CMS Logo

CSCCFEBTimeSlice.h

Go to the documentation of this file.
00001 #ifndef CSCCFEBTimeSlice_h
00002 #define CSCCFEBTimeSlice_h
00003 
00004 
00021 struct CSCCFEBDataWord {
00022   unsigned short adcCounts   : 12;
00023   unsigned short adcOverflow : 1;
00025   unsigned short controllerData : 1;
00028   unsigned short overlappedSampleFlag : 1;
00031   unsigned short errorstat : 1;
00032 };
00033 
00034 #include <iostream>
00035 #include <string.h> //for bzero
00036 
00037 struct CSCCFEBSCAControllerWord {
00042   CSCCFEBSCAControllerWord() {bzero(this, 2);}
00043 
00044   unsigned short trig_time : 8;
00045   unsigned short sca_blk   : 4;
00046   unsigned short l1a_phase : 1;
00047   unsigned short lct_phase : 1;
00048   unsigned short sca_full  : 1;
00049   unsigned short ts_flag   : 1;
00050 };
00051 
00052 
00053 
00054 
00055 class CSCCFEBTimeSlice {
00056  public:
00057   CSCCFEBTimeSlice();
00058 
00060   CSCCFEBDataWord * timeSample(int index) const {
00061     return (CSCCFEBDataWord *)(theSamples+index);
00062   }
00064   CSCCFEBDataWord * timeSample(int layer, int channel) const;
00065 
00067   bool sixteenSamples() {/*return scaControllerWord(1).ts_flag;i*/
00068     return timeSample(95)->controllerData;}
00069   unsigned sizeInWords() const {return 100;}
00070 
00072   CSCCFEBSCAControllerWord scaControllerWord(int layer) const ;
00073   
00074   void setControllerWord(const CSCCFEBSCAControllerWord & controllerWord);
00075 
00078   bool check() const {return ((dummy == 0x7FFF)||((dummy+crc)== 0x7FFF));}
00079 
00080   bool checkCRC() const {return crc==calcCRC();}
00081 
00082   unsigned calcCRC() const;
00083 
00084   friend std::ostream & operator<<(std::ostream & os, const CSCCFEBTimeSlice &);
00085 
00086 
00088   unsigned  get_crc()               const {return crc;}
00089   unsigned  get_n_free_sca_blocks() const {return n_free_sca_blocks;}
00090   unsigned  get_lctpipe_count()     const {return lctpipe_count;}
00091   unsigned  get_lctpipe_full()      const {return lctpipe_full;}
00092   unsigned  get_l1pipe_full()       const {return l1pipe_full;}
00093   unsigned  get_lctpipe_empty()     const {return lctpipe_empty;}
00094   unsigned  get_l1pipe_empty()      const {return l1pipe_empty;}
00095   unsigned  get_buffer_warning()    const {return buffer_warning;}
00096   unsigned  get_buffer_count()      const {return buffer_count;}
00097   unsigned  get_L1A_number()        const {return L1A_number;}
00098 
00099  private:
00100   unsigned short theSamples[96];
00101 
00103   unsigned crc : 16;
00104 
00106   unsigned n_free_sca_blocks : 4;
00107   unsigned lctpipe_count : 4;
00108   unsigned lctpipe_full  : 1;
00109   unsigned l1pipe_full   : 1;
00110   unsigned lctpipe_empty : 1;
00111   unsigned l1pipe_empty  : 1;
00112   unsigned blank_space_1 : 4;
00113 
00114 
00116   unsigned buffer_warning : 1;
00117   unsigned buffer_count : 5;
00118   unsigned L1A_number :6;
00119   unsigned blank_space_3 : 4; 
00120 
00122   unsigned dummy : 16;
00123 };
00124 
00125 #endif

Generated on Tue Jun 9 17:34:21 2009 for CMSSW by  doxygen 1.5.4