CMS 3D CMS Logo

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