File indexing completed on 2024-04-06 12:10:22
0001 #ifndef EventFilter_CSCRawToDigi_CSCDDUEventData_h
0002 #define EventFilter_CSCRawToDigi_CSCDDUEventData_h
0003
0004
0005
0006
0007
0008
0009
0010 #include <vector>
0011 #include "EventFilter/CSCRawToDigi/interface/CSCEventData.h"
0012 #include "EventFilter/CSCRawToDigi/interface/CSCDDUHeader.h"
0013 #include "EventFilter/CSCRawToDigi/interface/CSCDDUTrailer.h"
0014 #include "EventFilter/CSCRawToDigi/interface/CSCDCCHeader.h"
0015 #include "EventFilter/CSCRawToDigi/interface/CSCDCCTrailer.h"
0016 #include "EventFilter/CSCRawToDigi/interface/CSCDCCExaminer.h"
0017 #include <boost/dynamic_bitset.hpp>
0018
0019 class CSCDDUEventData {
0020 public:
0021 explicit CSCDDUEventData(const CSCDDUHeader &);
0022
0023
0024
0025 explicit CSCDDUEventData(const uint16_t *buf, CSCDCCExaminer *examiner = nullptr);
0026
0027 ~CSCDDUEventData();
0028
0029 static void setDebug(bool value) { debug = value; }
0030 static void setErrorMask(unsigned int value) { errMask = value; }
0031
0032
0033 const std::vector<CSCEventData> &cscData() const { return theData; }
0034
0035 CSCDDUHeader header() const { return theDDUHeader; }
0036 CSCDDUTrailer trailer() const { return theDDUTrailer; }
0037 uint16_t trailer0() const { return theDDUTrailer0; }
0038
0039 CSCDCCHeader dccHeader() const { return theDCCHeader; }
0040 CSCDCCTrailer dccTrailer() const { return theDCCTrailer; }
0041
0042
0043 void add(CSCEventData &, int dmbId, int dduInput, unsigned int format_version = 2005);
0044
0045
0046 long unsigned int errorstat;
0047
0048 bool check() const;
0049
0050
0051
0052 void decodeStatus(int status) const;
0053 void decodeStatus() const;
0054 int sizeInWords() const { return theSizeInWords; }
0055 int size() const { return theSizeInWords * 16; }
0056
0057
0058 boost::dynamic_bitset<> pack();
0059
0060 #ifdef LOCAL_UNPACK
0061 static bool debug;
0062 static unsigned int errMask;
0063 #else
0064 static std::atomic<bool> debug;
0065 static std::atomic<unsigned int> errMask;
0066 #endif
0067
0068
0069 protected:
0070 void unpack_data(const uint16_t *buf, CSCDCCExaminer *examiner = nullptr);
0071 CSCDCCHeader theDCCHeader;
0072 CSCDDUHeader theDDUHeader;
0073
0074 std::vector<CSCEventData> theData;
0075 CSCDDUTrailer theDDUTrailer;
0076 CSCDCCTrailer theDCCTrailer;
0077 uint16_t theDDUTrailer0;
0078 int theSizeInWords;
0079 uint16_t theFormatVersion;
0080 };
0081
0082 #endif