Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:14:36

0001 /* CSCDDUHeader 4/24/03 A.Tumanov
0002  * documented at  http://www.physics.ohio-state.edu/~cms/ddu/
0003  */
0004 
0005 #ifndef EventFilter_CSCRawToDigi_CSCDDUHeader_h
0006 #define EventFilter_CSCRawToDigi_CSCDDUHeader_h
0007 #include "DataFormats/CSCDigi/interface/CSCDDUStatusDigi.h"
0008 #include <cstring>
0009 #include <cstdint>
0010 
0011 class CSCDDUHeader {
0012 public:
0013   CSCDDUHeader();
0014   CSCDDUHeader(unsigned bx, unsigned l1num, unsigned sourceId, unsigned fmt_version = 0x6);
0015   CSCDDUHeader(const CSCDDUStatusDigi& digi) { memcpy(this, digi.header(), sizeInWords() * 2); }
0016 
0017   void setFromBuffer(uint16_t const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0018 
0019   // Getters
0020   int s_link_status() const { return s_link_status_; }
0021   int format_version() const { return format_version_; }
0022   int source_id() const { return source_id_; }
0023   int bxnum() const { return bxnum_; }
0024   int lvl1num() const { return lvl1num_; }
0025   int event_type() const { return event_type_; }
0026   int ncsc() const { return ncsc_; }
0027   int dmb_dav() const { return dmb_dav_; }
0028   int dmb_full() const { return dmb_full_; }
0029   int live_cscs() const { return live_cscs_; }
0030   int output_path_status() const { return output_path_; }
0031   static unsigned sizeInWords() { return 12; }
0032 
0033   // Setters
0034   void setDMBDAV(int dduInput);
0035   void setSourceId(unsigned sourceId) { source_id_ = sourceId; }
0036   void setFormatVersion(unsigned version) { format_version_ = version & 0xF; }
0037   void setBXN(unsigned bxn) { bxnum_ = bxn & 0xFFF; }
0038   void setL1A(unsigned l1a) { lvl1num_ = l1a & 0xFFFFFF; }
0039   void setEventType(unsigned evt_type) { event_type_ = evt_type & 0xF; }
0040   void setTTSStatus(unsigned status) { tts_status_ = status & 0xF; }
0041   void setBOEStatus(unsigned status) { boe_status_ = status & 0x7F; }
0042   void setOutputPathStatus(unsigned status) { output_path_ = status & 0xFF; }
0043 
0044   unsigned short* data() { return (unsigned short*)this; }
0045   bool check() const;
0046 
0047   // gets some data filled by the event data
0048   friend class CSCDDUEventData;
0049 
0050 private:
0051   /// initializes constants
0052   void init();
0053 
0054   unsigned s_link_status_ : 4;
0055   unsigned format_version_ : 4;
0056   unsigned source_id_ : 12;
0057   unsigned bxnum_ : 12;
0058 
0059   unsigned lvl1num_ : 24;
0060   unsigned event_type_ : 4;
0061   /// should always be 5
0062   unsigned bit64_ : 4;
0063 
0064   /// should be 8000/0001/8000
0065   unsigned dmb_full_ : 16;
0066   unsigned header2_1_ : 16;
0067   unsigned header2_2_ : 16;
0068   unsigned header2_3_ : 16;
0069 
0070   unsigned ncsc_ : 4;
0071   unsigned tts_status_ : 4;
0072   unsigned boe_status_ : 8;
0073   unsigned dmb_dav_ : 16;
0074   unsigned output_path_ : 16;
0075   unsigned live_cscs_ : 16;
0076 };
0077 #endif