Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef EventFilter_CSCRawToDigi_CSCDMBHeader2005_h
0002 #define EventFilter_CSCRawToDigi_CSCDMBHeader2005_h
0003 
0004 #include <cassert>
0005 #include <iosfwd>
0006 #include <cstring>  // bzero
0007 #include "DataFormats/CSCDigi/interface/CSCDMBStatusDigi.h"
0008 #include "EventFilter/CSCRawToDigi/interface/CSCVDMBHeaderFormat.h"
0009 
0010 struct CSCDMBHeader2005 : public CSCVDMBHeaderFormat {
0011   // public:
0012 
0013   CSCDMBHeader2005();
0014 
0015   CSCDMBHeader2005(const uint16_t *buf);
0016   /*
0017   CSCDMBHeader2005(const CSCDMBStatusDigi & digi)
0018     {
0019       memcpy(this, digi.header(), sizeInWords()*2);
0020     }
0021 */
0022   bool cfebAvailable(unsigned icfeb) override;
0023 
0024   void addCFEB(int icfeb) override;
0025   void addNCLCT() override;
0026   void addNALCT() override;
0027   void setBXN(int bxn) override;
0028   void setL1A(int l1a) override;
0029   void setL1A24(int l1a) override;
0030   void setCrateAddress(int crate, int dmbId) override;
0031   void setdmbID(int newDMBID) override { bits.dmb_id = newDMBID; }
0032   void setdmbVersion(unsigned int version) override {}
0033 
0034   unsigned cfebActive() const override { return bits.cfeb_active; }
0035   unsigned crateID() const override;
0036   unsigned dmbID() const override;
0037   unsigned bxn() const override;
0038   unsigned bxn12() const override;
0039   unsigned l1a() const override;
0040   unsigned l1a24() const override;
0041   unsigned cfebAvailable() const override;
0042   unsigned nalct() const override;
0043   unsigned nclct() const override;
0044   unsigned cfebMovlp() const override;
0045   unsigned dmbCfebSync() const override;
0046   unsigned activeDavMismatch() const override;
0047   unsigned format_version() const override;
0048 
0049   unsigned sizeInWords() const override;
0050 
0051   bool check() const override;
0052 
0053   unsigned short *data() override { return (unsigned short *)(&bits); }
0054   unsigned short *data() const override { return (unsigned short *)(&bits); }
0055 
0056   //ostream & operator<<(ostream &, const CSCDMBHeader2005 &);
0057 
0058   // private:
0059 
0060   struct {
0061     /// 1st Header word
0062     unsigned dmb_l1a_lowo : 12;
0063     /// constant, should be 1001
0064     unsigned newddu_code_1 : 4;
0065 
0066     /// 2nd Header word
0067     unsigned dmb_l1a_hiwo : 12;
0068     /// constant, should be 1001
0069     unsigned newddu_code_2 : 4;
0070 
0071     /// 3rd Header word
0072     unsigned cfeb_dav_1 : 5;
0073     unsigned cfeb_active : 5;
0074     unsigned alct_dav_4 : 1;
0075     unsigned tmb_dav_4 : 1;
0076     /// constant, should be 1001
0077     unsigned newddu_code_3 : 4;
0078 
0079     /// 4th Header word
0080     unsigned dmb_bxn1 : 12;
0081     /// constant, should be 1001
0082     unsigned newddu_code_4 : 4;
0083 
0084     /// 5th Header word
0085     unsigned cfeb_dav : 5;             //5
0086     unsigned alct_dav_1 : 1;           // start 1
0087     unsigned active_dav_mismatch : 1;  // new
0088     unsigned tmb_dav_1 : 1;
0089     unsigned active_dav_mismatch_2 : 1;  // new
0090     unsigned alct_dav_2 : 1;
0091     unsigned active_dav_mismatch_3 : 1;  // new
0092     unsigned tmb_dav_2 : 1;
0093     /// constant, should be '1010'
0094     unsigned ddu_code_1 : 4;
0095 
0096     /// 6th Header word
0097     unsigned dmb_id : 4;
0098     unsigned dmb_crate : 8;
0099     /// constant, should be '1010'
0100     unsigned ddu_code_2 : 4;
0101 
0102     /// 7th Header word
0103     unsigned dmb_bxn : 7;
0104     /// the time sample for this event has multiple overlaps
0105     /// with samples from previous events
0106     unsigned cfeb_movlp : 5;
0107     /// constant, should be '1010'
0108     unsigned ddu_code_3 : 4;
0109 
0110     /// 8th Header word
0111     unsigned dmb_l1a : 8;
0112     unsigned dmb_cfeb_sync : 4;
0113     /// constant, should be '1010'
0114     unsigned ddu_code_4 : 4;
0115   } bits;
0116 };
0117 
0118 #endif