File indexing completed on 2024-04-06 12:10:25
0001
0002
0003
0004
0005 #include "EventFilter/CSCRawToDigi/interface/CSCALCTTrailer.h"
0006
0007 #ifdef LOCAL_UNPACK
0008
0009 bool CSCALCTTrailer::debug = false;
0010 short unsigned int CSCALCTTrailer::firmwareVersion = 2006;
0011
0012 #else
0013
0014 std::atomic<bool> CSCALCTTrailer::debug{false};
0015 std::atomic<short unsigned int> CSCALCTTrailer::firmwareVersion{2006};
0016
0017 #endif
0018
0019 CSCALCTTrailer2006::CSCALCTTrailer2006() {
0020 bzero(this, sizeInWords() * 2);
0021 e0dLine = 0xDE0D;
0022 d_0 = 0xD;
0023 d_1 = 0xD;
0024 zero_0 = 0;
0025 zero_1 = 0;
0026 d_3 = 0xD;
0027 reserved_3 = 1;
0028 }
0029
0030 CSCALCTTrailer2007::CSCALCTTrailer2007() {
0031 bzero(this, sizeInWords() * 2);
0032 e0dLine = 0xDE0D;
0033 reserved_0 = 0xD;
0034 reserved_1 = 0xD;
0035 reserved_3 = 1;
0036 reserved_4 = 0xD;
0037 }
0038
0039 CSCALCTTrailer::CSCALCTTrailer(int size, int firmVersion) {
0040 if (firmVersion == 2006) {
0041 trailer2006.setSize(size);
0042 firmwareVersion = 2006;
0043 } else if (firmVersion == 2007) {
0044 trailer2007.setSize(size);
0045 firmwareVersion = 2007;
0046 } else {
0047 edm::LogError("CSCALCTTrailer|CSCRawToDigi")
0048 << "failed to construct: undetermined ALCT firmware version!!" << firmVersion;
0049 }
0050 }
0051
0052 CSCALCTTrailer::CSCALCTTrailer(const unsigned short* buf) {
0053
0054 if ((buf[0] == 0xDE0D) && ((buf[1] & 0xF000) == 0xD000)) {
0055 firmwareVersion = 2007;
0056 } else if ((buf[2] & 0xFFF) == 0xE0D) {
0057 firmwareVersion = 2006;
0058 } else {
0059 edm::LogError("CSCALCTTrailer|CSCRawToDigi")
0060 << "failed to construct: undetermined ALCT firmware version!!" << firmwareVersion;
0061 }
0062
0063
0064 #ifdef LOCAL_UNPACK
0065 switch (firmwareVersion) {
0066 #else
0067 switch (firmwareVersion.load()) {
0068 #endif
0069 case 2006:
0070 trailer2006.setFromBuffer(buf);
0071 break;
0072 case 2007:
0073 trailer2007.setFromBuffer(buf);
0074 break;
0075 default:
0076 edm::LogError("CSCALCTTrailer|CSCRawToDigi") << "couldn't construct: ALCT firmware version is bad/not defined!";
0077 break;
0078 }
0079 }