00001 00005 #include "EventFilter/CSCRawToDigi/interface/CSCALCTTrailer.h" 00006 00007 bool CSCALCTTrailer::debug=false; 00008 short unsigned int CSCALCTTrailer::firmwareVersion=2006; 00009 00010 CSCALCTTrailer2006::CSCALCTTrailer2006() { 00011 bzero(this, sizeInWords()*2); 00012 e0dLine = 0xDE0D; 00013 d_0=0xD; 00014 d_1=0xD; 00015 zero_0 = 0; 00016 zero_1 = 0; 00017 d_3 = 0xD; 00018 reserved_3 = 1; 00019 } 00020 00021 00022 CSCALCTTrailer2007::CSCALCTTrailer2007() { 00023 bzero(this, sizeInWords()*2); 00024 e0dLine = 0xDE0D; 00025 reserved_0 = 0xD; 00026 reserved_1 = 0xD; 00027 reserved_3 = 1; 00028 reserved_4 = 0xD; 00029 } 00030 00031 00032 00033 CSCALCTTrailer::CSCALCTTrailer(int size, int firmVersion) 00034 { 00035 if(firmVersion == 2006) 00036 { 00037 trailer2006.setSize(size); 00038 firmwareVersion = 2006; 00039 } 00040 else if (firmVersion == 2007) 00041 { 00042 trailer2007.setSize(size); 00043 firmwareVersion = 2007; 00044 } 00045 else { 00046 edm::LogError("CSCALCTTrailer|CSCRawToDigi") <<"failed to construct: undetermined ALCT firmware version!!" << firmVersion; 00047 } 00048 00049 } 00050 00051 CSCALCTTrailer::CSCALCTTrailer(const unsigned short * buf){ 00053 if ((buf[0]==0xDE0D)&&((buf[1]&0xF000)==0xD000)) { 00054 firmwareVersion=2007; 00055 } 00056 else if ( (buf[2]&0xFFF)==0xE0D ) { 00057 firmwareVersion=2006; 00058 } 00059 else { 00060 edm::LogError("CSCALCTTrailer|CSCRawToDigi") <<"failed to construct: undetermined ALCT firmware version!!" << firmwareVersion; 00061 } 00062 00064 switch (firmwareVersion) { 00065 case 2006: 00066 memcpy(&trailer2006, buf, trailer2006.sizeInWords()*2); 00067 break; 00068 case 2007: 00069 memcpy(&trailer2007, buf, trailer2007.sizeInWords()*2); 00070 break; 00071 default: 00072 edm::LogError("CSCALCTTrailer|CSCRawToDigi") 00073 <<"couldn't construct: ALCT firmware version is bad/not defined!"; 00074 break; 00075 } 00076 }