CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/EventFilter/CSCRawToDigi/interface/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   //@@ Tim: This seems wrong to me so just pull it
00045   //@@  void setDMBDAV(int dmbId) {dmb_full_ |= (1 << dmbId);}
00046   unsigned dmb_warn() const { return dmb_warn_; }  
00047   unsigned dmb_full() const { return dmb_full_; }
00048   unsigned reserved() const { return whatever; } 
00049 
00050   
00051   
00052  private:
00053   
00055   unsigned trailer2_1 : 16;
00056   unsigned trailer2_2 : 16;
00057   unsigned trailer2_3 : 16;
00058   unsigned trailer2_4 : 16;
00059 
00061   unsigned dmb_warn_   : 16;
00062   unsigned dmb_full_   : 16;
00063   unsigned errorstat_  : 32;
00064 
00065   // DDU2004
00066   //  unsigned reserved_bits     : 4;
00067   //unsigned ddu_tts_status    : 4;
00068   //unsigned event_status      : 8;
00069   //unsigned event_crc         : 16;
00070   //
00071 
00072   //DDU2000
00073   //unsigned s_link_status  : 4;
00074   //unsigned crc_check_word : 16;
00075   //unsigned whatever       : 4;
00076   //unsigned event_status   : 8;
00077   //
00078 
00079   //the following bits change their meaning in DDU2004
00080   unsigned word1 : 4;
00081   unsigned word2 : 4;
00082   unsigned word3 : 4;
00083   unsigned word4 : 4;
00084 
00085   unsigned word5 : 4;
00086   unsigned word6 : 4;
00087   unsigned word7 : 4;
00088   unsigned word8 : 4;
00089 
00090 
00093   unsigned word_count_        : 24;
00094   unsigned whatever           : 4;
00096   unsigned cms_directive_0xA  : 4;
00097 
00098 };
00099 #endif