Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /// 01/20/05 A.Tumanov
0002 
0003 #ifndef EventFilter_CSCRawToDigi_CSCDCCEventData_h
0004 #define EventFilter_CSCRawToDigi_CSCDCCEventData_h
0005 
0006 #include <vector>
0007 #include <boost/dynamic_bitset.hpp>
0008 #include "EventFilter/CSCRawToDigi/interface/CSCDDUEventData.h"
0009 #include "EventFilter/CSCRawToDigi/interface/CSCDCCHeader.h"
0010 #include "EventFilter/CSCRawToDigi/interface/CSCDCCTrailer.h"
0011 #include "EventFilter/CSCRawToDigi/interface/CSCDCCExaminer.h"
0012 
0013 class CSCDCCEventData {
0014 public:
0015   CSCDCCEventData(int sourceId, int nDDUs, int bx, int l1a);
0016   /// buf may need to stay pinned in memory as long
0017   /// as this data is used.  Not sure
0018   explicit CSCDCCEventData(const uint16_t* buf, CSCDCCExaminer* examiner = nullptr);
0019 
0020   ~CSCDCCEventData();
0021 
0022   static void setDebug(bool value) { debug = value; }
0023 
0024   /// accessor to dduData
0025   const std::vector<CSCDDUEventData>& dduData() const { return theDDUData; }
0026   std::vector<CSCDDUEventData>& dduData() { return theDDUData; }
0027 
0028   CSCDCCHeader dccHeader() const { return theDCCHeader; }
0029   CSCDCCTrailer dccTrailer() const { return theDCCTrailer; }
0030 
0031   /// for making events.  Sets the bxnum and lvl1num inside the chamber event
0032   //void add(CSCEventData &);
0033 
0034   bool check() const;
0035 
0036   /// prints out the error associated with this status
0037   /// from the header or trailer
0038   int sizeInWords() const { return theSizeInWords; }
0039 
0040   void addChamber(
0041       CSCEventData& chamber, int dduID, int dduSlot, int dduInput, int dmbID, uint16_t format_version = 2005);
0042 
0043   ///packs data into bits
0044   boost::dynamic_bitset<> pack();
0045 
0046 #ifdef LOCAL_UNPACK
0047   static bool debug;
0048 #else
0049   static std::atomic<bool> debug;
0050 #endif
0051 
0052 protected:
0053   void unpack_data(const uint16_t* buf, CSCDCCExaminer* examiner = nullptr);
0054   CSCDCCHeader theDCCHeader;
0055   // DDUData is unpacked and stored in this vector
0056   std::vector<CSCDDUEventData> theDDUData;
0057   CSCDCCTrailer theDCCTrailer;
0058   int theSizeInWords;
0059 };
0060 
0061 #endif