Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:22

0001 // Authors Rick W and Alex T 9/24/94
0002 //
0003 #ifndef EventFilter_CSCRawToDigi_CSCDCCTrailer_h
0004 #define EventFilter_CSCRawToDigi_CSCDCCTrailer_h
0005 
0006 #include <iostream>
0007 #include <cstdint>
0008 #include <cstring>  // bzero
0009 #include "DataFormats/CSCDigi/interface/CSCDCCStatusDigi.h"
0010 
0011 /** documented at  http://www.physics.ohio-state.edu/~cms/ddu/ddu2.html
0012  */
0013 
0014 struct CSCDCCTrailer {
0015   CSCDCCTrailer() {
0016     bzero(this, sizeInWords() * 2);
0017     dcc_trail1 = 0xEF;
0018     EOE_1 = 0XA;
0019     XXXX_1 = 0X0;  //@@ Actually a reserved bit. We should not test on it.
0020   }
0021 
0022   CSCDCCTrailer(const CSCDCCStatusDigi& digi) { memcpy(this, digi.trailer(), sizeInWords() * 2); }
0023 
0024   void setFromBuffer(uint16_t const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0025 
0026   /// for reference www.physics.ohio-state.edu/%7Ecms/dcc/outdatafmt.html
0027   /// dcc_trail1 should be EF
0028   unsigned fifo_status : 8;
0029   unsigned ddu_data_status2 : 24;
0030   unsigned ddu_data_status1 : 16;
0031   unsigned readout_time : 8;
0032   unsigned dcc_trail1 : 8;
0033 
0034   /// this line defined by CMS CDF
0035   /// http://cmsdoc.cern.ch/cms/TRIDAS/horizontal/
0036   unsigned dollardollar : 1;
0037   unsigned Tx : 3;
0038   unsigned TTS : 4;
0039   unsigned Evt_stat : 4;
0040   unsigned XXXX_2 : 4;
0041   unsigned CRC : 16;
0042   unsigned Evt_lgth : 24;
0043   unsigned XXXX_1 : 4;
0044   unsigned EOE_1 : 4;
0045 
0046   static unsigned sizeInWords() { return 8; }
0047   //@@ The XXXX_1 is a reserved bit in CMS format - we really should not be testing it
0048   bool check() const { return (dcc_trail1 == 0xEF) && (EOE_1 == 0XA) && (XXXX_1 == 0X0); }
0049   unsigned short* data() { return (unsigned short*)this; }
0050 };
0051 #endif