File indexing completed on 2024-04-06 12:10:22
0001 #ifndef EventFilter_CSCRawToDigi_CSCDMBTrailer2013_h
0002 #define EventFilter_CSCRawToDigi_CSCDMBTrailer2013_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 #include <iostream>
0038 #include "DataFormats/CSCDigi/interface/CSCDMBStatusDigi.h"
0039 #include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader.h"
0040 #include "EventFilter/CSCRawToDigi/interface/CSCVDMBTrailerFormat.h"
0041
0042 struct CSCDMBTrailer2013 : public CSCVDMBTrailerFormat {
0043
0044 CSCDMBTrailer2013() {
0045 bzero(data(), sizeInWords() * 2);
0046 bits.ddu_code_1 = bits.ddu_code_2 = bits.ddu_code_3 = bits.ddu_code_4 = 0xF;
0047 bits.ddu_code_5 = bits.ddu_code_6 = bits.ddu_code_7 = bits.ddu_code_8 = 0xE;
0048 }
0049
0050 CSCDMBTrailer2013(const uint16_t *buf) { memcpy(data(), buf, sizeInWords() * 2); }
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 void setEventInformation(const CSCDMBHeader &dmbHeader) override {
0061 bits.dmb_id = dmbHeader.dmbID();
0062 bits.crate_id = dmbHeader.crateID();
0063 bits.dmb_l1a = dmbHeader.l1a();
0064 bits.dmb_bxn = dmbHeader.bxn();
0065 };
0066
0067 unsigned crateID() const override { return bits.crate_id; };
0068 unsigned dmbID() const override { return bits.dmb_id; };
0069
0070 unsigned dmb_l1a() const override { return bits.dmb_l1a; };
0071 unsigned dmb_bxn() const override { return bits.dmb_bxn; };
0072
0073 unsigned alct_endtimeout() const override { return bits.alct_endtimeout; };
0074 unsigned tmb_endtimeout() const override { return bits.tmb_endtimeout; };
0075 unsigned cfeb_endtimeout() const override { return bits.cfeb_endtimeout; };
0076
0077 unsigned alct_starttimeout() const override { return bits.alct_starttimeout; };
0078 unsigned tmb_starttimeout() const override { return bits.tmb_starttimeout; };
0079 unsigned cfeb_starttimeout() const override { return bits.cfeb_starttimeout; };
0080
0081 unsigned cfeb_movlp() const override { return bits.cfeb_movlp; };
0082 unsigned dmb_l1pipe() const override { return bits.dmb_l1pipe; };
0083
0084
0085 unsigned alct_empty() const override { return 0; };
0086 unsigned tmb_empty() const override { return 0; };
0087 unsigned cfeb_empty() const override { return 0; };
0088
0089 unsigned alct_half() const override { return bits.alct_half; };
0090 unsigned tmb_half() const override { return bits.tmb_half; };
0091 unsigned cfeb_half() const override { return bits.cfeb_half; };
0092
0093 unsigned alct_full() const override { return bits.alct_full; };
0094 unsigned tmb_full() const override { return bits.tmb_full; };
0095 unsigned cfeb_full() const override { return (bits.cfeb_full_lowo | (bits.cfeb_full_hiwo << 3)); };
0096
0097 unsigned crc22() const override { return (bits.dmb_crc_1 | (bits.dmb_crc_2 << 11)); };
0098 unsigned crc_lo_parity() const override { return bits.dmb_parity_1; };
0099 unsigned crc_hi_parity() const override { return bits.dmb_parity_2; };
0100
0101 unsigned short *data() override { return (unsigned short *)(&bits); }
0102 unsigned short *data() const override { return (unsigned short *)(&bits); }
0103
0104 bool check() const override {
0105 return bits.ddu_code_1 == 0xF && bits.ddu_code_2 == 0xF && bits.ddu_code_3 == 0xF && bits.ddu_code_4 == 0xF &&
0106 bits.ddu_code_5 == 0xE && bits.ddu_code_6 == 0xE && bits.ddu_code_7 == 0xE && bits.ddu_code_8 == 0xE;
0107 }
0108
0109 unsigned sizeInWords() const override { return 8; }
0110
0111 struct {
0112
0113 unsigned dmb_l1a : 6;
0114 unsigned dmb_bxn : 5;
0115 unsigned alct_endtimeout : 1;
0116 unsigned ddu_code_1 : 4;
0117
0118
0119 unsigned cfeb_endtimeout : 7;
0120 unsigned cfeb_movlp : 5;
0121 unsigned ddu_code_2 : 4;
0122
0123
0124 unsigned dmb_l1pipe : 8;
0125 unsigned tmb_starttimeout : 1;
0126 unsigned cfeb_full_lowo : 3;
0127 unsigned ddu_code_3 : 4;
0128
0129
0130 unsigned cfeb_full_hiwo : 4;
0131 unsigned cfeb_starttimeout : 7;
0132 unsigned alct_starttimeout : 1;
0133 unsigned ddu_code_4 : 4;
0134
0135
0136 unsigned cfeb_half : 7;
0137 unsigned tmb_endtimeout : 1;
0138 unsigned tmb_half : 1;
0139 unsigned alct_half : 1;
0140 unsigned tmb_full : 1;
0141 unsigned alct_full : 1;
0142 unsigned ddu_code_5 : 4;
0143
0144
0145 unsigned dmb_id : 4;
0146 unsigned crate_id : 8;
0147 unsigned ddu_code_6 : 4;
0148
0149
0150 unsigned dmb_crc_1 : 11;
0151 unsigned dmb_parity_1 : 1;
0152 unsigned ddu_code_7 : 4;
0153
0154
0155 unsigned dmb_crc_2 : 11;
0156 unsigned dmb_parity_2 : 1;
0157 unsigned ddu_code_8 : 4;
0158 } bits;
0159 };
0160
0161 #endif