Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef EventFilter_CSCRawToDigi_CSCDMBHeader_h
0002 #define EventFilter_CSCRawToDigi_CSCDMBHeader_h
0003 
0004 #include <cassert>
0005 #include <iosfwd>
0006 #include <cstring>  // bzero
0007 #include <memory>
0008 #include "FWCore/Utilities/interface/Exception.h"
0009 #include "DataFormats/CSCDigi/interface/CSCDMBStatusDigi.h"
0010 #include "EventFilter/CSCRawToDigi/interface/CSCVDMBHeaderFormat.h"
0011 
0012 struct CSCDMBHeader2005;
0013 struct CSCDMBHeader2013;
0014 
0015 class CSCDMBHeader {
0016 public:
0017   CSCDMBHeader(uint16_t firmware_version = 2005);
0018 
0019   CSCDMBHeader(const uint16_t* buf, uint16_t firmware_version = 2005);
0020 
0021   bool cfebAvailable(unsigned icfeb) { return (theHeaderFormat->cfebAvailable() >> icfeb) & 1; }
0022 
0023   void addCFEB(int icfeb) { theHeaderFormat->addCFEB(icfeb); }
0024   void addNCLCT() { theHeaderFormat->addNCLCT(); };
0025 
0026   void addNALCT() { theHeaderFormat->addNALCT(); };
0027   void setBXN(int bxn) { theHeaderFormat->setBXN(bxn); };
0028   void setL1A(int l1a) { theHeaderFormat->setL1A(l1a); };
0029   void setL1A24(int l1a) { theHeaderFormat->setL1A24(l1a); };
0030   void setCrateAddress(int crate, int dmbId) { theHeaderFormat->setCrateAddress(crate, dmbId); };
0031   void setdmbID(int newDMBID) { theHeaderFormat->setdmbID(newDMBID); };
0032   void setdmbVersion(unsigned int version) { theHeaderFormat->setdmbVersion(version); };
0033 
0034   unsigned cfebActive() const { return theHeaderFormat->cfebActive(); };
0035   unsigned crateID() const { return theHeaderFormat->crateID(); };
0036   unsigned dmbID() const { return theHeaderFormat->dmbID(); };
0037   unsigned bxn() const { return theHeaderFormat->bxn(); };
0038   unsigned bxn12() const { return theHeaderFormat->bxn12(); };
0039   unsigned l1a() const { return theHeaderFormat->l1a(); };
0040   unsigned l1a24() const { return theHeaderFormat->l1a24(); };
0041   unsigned cfebAvailable() const { return theHeaderFormat->cfebAvailable(); };
0042   unsigned nalct() const { return theHeaderFormat->nalct(); };
0043   unsigned nclct() const { return theHeaderFormat->nclct(); };
0044   unsigned cfebMovlp() const { return theHeaderFormat->cfebMovlp(); };
0045   unsigned dmbCfebSync() const { return theHeaderFormat->dmbCfebSync(); };
0046   unsigned activeDavMismatch() const { return theHeaderFormat->activeDavMismatch(); };
0047 
0048   unsigned sizeInWords() const { return theHeaderFormat->sizeInWords(); };
0049   unsigned format_version() const { return theHeaderFormat->format_version(); };
0050 
0051   bool check() const { return theHeaderFormat->check(); };
0052 
0053   unsigned short* data() { return theHeaderFormat->data(); };
0054   unsigned short* data() const { return theHeaderFormat->data(); };
0055 
0056   //ostream & operator<<(ostream &, const CSCDMBHeader &);
0057 
0058   /// will throw if the cast fails
0059   CSCDMBHeader2005 dmbHeader2005() const;
0060   CSCDMBHeader2013 dmbHeader2013() const;
0061 
0062 private:
0063   std::shared_ptr<CSCVDMBHeaderFormat> theHeaderFormat;
0064   int theFirmwareVersion;
0065 };
0066 
0067 #endif