File indexing completed on 2024-04-06 12:10:22
0001 #ifndef EventFilter_CSCRawToDigi_CSCDDUTrailer_h
0002 #define EventFilter_CSCRawToDigi_CSCDDUTrailer_h
0003
0004 #include <iostream>
0005 #include <cstdint>
0006 #include <cstring> // bzero
0007 #include "DataFormats/CSCDigi/interface/CSCDDUStatusDigi.h"
0008
0009
0010
0011
0012 class CSCDDUTrailer {
0013 public:
0014 CSCDDUTrailer() {
0015 bzero(this, sizeInWords() * 2);
0016 trailer2_1 = trailer2_2 = trailer2_4 = 0x8000;
0017 trailer2_3 = 0xFFFF;
0018 }
0019 CSCDDUTrailer(const CSCDDUStatusDigi& digi) { memcpy(this, digi.trailer(), sizeInWords() * 2); }
0020
0021 void setFromBuffer(uint16_t const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0022
0023 static unsigned sizeInWords() { return 12; }
0024
0025 bool check() const {
0026
0027
0028
0029 return trailer2_1 == 0x8000 && trailer2_2 == 0x8000 && trailer2_3 == 0xFFFF && trailer2_4 == 0x8000;
0030 }
0031
0032 unsigned short* data() { return (unsigned short*)this; }
0033
0034
0035
0036 unsigned errorstat() const { return errorstat_; }
0037 unsigned wordcount() const { return word_count_; }
0038 void setWordCount(unsigned wordcount) { word_count_ = wordcount; }
0039
0040
0041 unsigned dmb_warn() const { return dmb_warn_; }
0042 unsigned dmb_full() const { return dmb_full_; }
0043 unsigned reserved() const { return whatever; }
0044
0045 private:
0046
0047 unsigned trailer2_1 : 16;
0048 unsigned trailer2_2 : 16;
0049 unsigned trailer2_3 : 16;
0050 unsigned trailer2_4 : 16;
0051
0052
0053 unsigned dmb_warn_ : 16;
0054 unsigned dmb_full_ : 16;
0055 unsigned errorstat_ : 32;
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072 unsigned word1 : 4;
0073 unsigned word2 : 4;
0074 unsigned word3 : 4;
0075 unsigned word4 : 4;
0076
0077 unsigned word5 : 4;
0078 unsigned word6 : 4;
0079 unsigned word7 : 4;
0080 unsigned word8 : 4;
0081
0082
0083
0084 unsigned word_count_ : 24;
0085 unsigned whatever : 4;
0086
0087 unsigned cms_directive_0xA : 4;
0088 };
0089 #endif