CMS 3D CMS Logo

CSCDDUTrailer.h

Go to the documentation of this file.
00001 #ifndef CSCDDUTrailer_h
00002 #define CSCDDUTrailer_h
00003 
00004 #include <iostream>
00005 #include <string.h> // bzero
00006 #include "DataFormats/CSCDigi/interface/CSCDDUStatusDigi.h"
00007 
00013 class CSCDDUTrailer {
00014 
00015  public:
00016 
00017   CSCDDUTrailer() 
00018     {
00019       bzero(this, sizeInWords()*2);
00020       trailer2_1 = trailer2_2 = trailer2_4 = 0x8000;
00021       trailer2_3 = 0xFFFF;
00022     }
00023   CSCDDUTrailer(const CSCDDUStatusDigi & digi)
00024     {
00025       memcpy(this, digi.trailer(), sizeInWords()*2);
00026     }
00027   
00028   static unsigned sizeInWords() {return 12;}
00029   
00030   bool check() const {
00031     //std::cout << std:: hex << "DDUTRAILER CHECK " << trailer2_1 << " " 
00032     //      << trailer2_2  << " " << trailer2_3 << " " 
00033     //      << trailer2_4 << std:: dec << std::endl;
00034     return trailer2_1 == 0x8000 && trailer2_2 == 0x8000
00035                    && trailer2_3 == 0xFFFF && trailer2_4 == 0x8000;}
00036 
00037   unsigned short * data() {return (unsigned short *) this;}
00038   
00039   //These are accessors to use for calling private members    
00040   
00041   unsigned errorstat() const { return errorstat_; }
00042   unsigned wordcount() const { return word_count_; }  
00043   void setWordCount(unsigned wordcount) {word_count_ = wordcount;}
00044   void setDMBDAV(int dmbId) {dmb_full_ |= (1 << dmbId);}
00045   unsigned dmb_warn() const { return dmb_warn_; }  
00046   unsigned dmb_full() const { return dmb_full_; }
00047   unsigned reserved() const { return whatever; } 
00048 
00049   
00050   
00051  private:
00052   
00054   unsigned trailer2_1 : 16;
00055   unsigned trailer2_2 : 16;
00056   unsigned trailer2_3 : 16;
00057   unsigned trailer2_4 : 16;
00058 
00060   unsigned dmb_warn_   : 16;
00061   unsigned dmb_full_   : 16;
00062   unsigned errorstat_  : 32;
00063 
00064   // DDU2004
00065   //  unsigned reserved_bits     : 4;
00066   //unsigned ddu_tts_status    : 4;
00067   //unsigned event_status      : 8;
00068   //unsigned event_crc         : 16;
00069   //
00070 
00071   //DDU2000
00072   //unsigned s_link_status  : 4;
00073   //unsigned crc_check_word : 16;
00074   //unsigned whatever       : 4;
00075   //unsigned event_status   : 8;
00076   //
00077 
00078   //the following bits change their meaning in DDU2004
00079   unsigned word1 : 4;
00080   unsigned word2 : 4;
00081   unsigned word3 : 4;
00082   unsigned word4 : 4;
00083 
00084   unsigned word5 : 4;
00085   unsigned word6 : 4;
00086   unsigned word7 : 4;
00087   unsigned word8 : 4;
00088 
00089 
00092   unsigned word_count_        : 24;
00093   unsigned whatever           : 4;
00095   unsigned cms_directive_0xA  : 4;
00096 
00097 };
00098 #endif

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