CMS 3D CMS Logo

CSCALCTTrailer.cc
Go to the documentation of this file.
1 
6 
7 #ifdef LOCAL_UNPACK
8 
9 bool CSCALCTTrailer::debug = false;
10 short unsigned int CSCALCTTrailer::firmwareVersion = 2006;
11 
12 #else
13 
14 std::atomic<bool> CSCALCTTrailer::debug{false};
15 std::atomic<short unsigned int> CSCALCTTrailer::firmwareVersion{2006};
16 
17 #endif
18 
20  bzero(this, sizeInWords() * 2);
21  e0dLine = 0xDE0D;
22  d_0 = 0xD;
23  d_1 = 0xD;
24  zero_0 = 0;
25  zero_1 = 0;
26  d_3 = 0xD;
27  reserved_3 = 1;
28 }
29 
31  bzero(this, sizeInWords() * 2);
32  e0dLine = 0xDE0D;
33  reserved_0 = 0xD;
34  reserved_1 = 0xD;
35  reserved_3 = 1;
36  reserved_4 = 0xD;
37 }
38 
39 CSCALCTTrailer::CSCALCTTrailer(int size, int firmVersion) {
40  if (firmVersion == 2006) {
41  trailer2006.setSize(size);
42  firmwareVersion = 2006;
43  } else if (firmVersion == 2007) {
44  trailer2007.setSize(size);
45  firmwareVersion = 2007;
46  } else {
47  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
48  << "failed to construct: undetermined ALCT firmware version!!" << firmVersion;
49  }
50 }
51 
52 CSCALCTTrailer::CSCALCTTrailer(const unsigned short* buf) {
54  if ((buf[0] == 0xDE0D) && ((buf[1] & 0xF000) == 0xD000)) {
55  firmwareVersion = 2007;
56  } else if ((buf[2] & 0xFFF) == 0xE0D) {
57  firmwareVersion = 2006;
58  } else {
59  edm::LogError("CSCALCTTrailer|CSCRawToDigi")
60  << "failed to construct: undetermined ALCT firmware version!!" << firmwareVersion;
61  }
62 
64 #ifdef LOCAL_UNPACK
65  switch (firmwareVersion) {
66 #else
67  switch (firmwareVersion.load()) {
68 #endif
69  case 2006:
70  trailer2006.setFromBuffer(buf);
71  break;
72  case 2007:
73  trailer2007.setFromBuffer(buf);
74  break;
75  default:
76  edm::LogError("CSCALCTTrailer|CSCRawToDigi") << "couldn't construct: ALCT firmware version is bad/not defined!";
77  break;
78  }
79 }
size
Write out results.
static std::atomic< bool > debug
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer(int size, int firmVersion)
needed for packing
short unsigned int sizeInWords() const