00001 // -*- C++ -*- 00002 // 00003 // Package: CSCTFTBRawFormat 00004 // Module: CSCTFTBFrontHeader 00005 // 00006 // Description: Contains front block header information 00007 // (see SP Data format) 00008 // 00009 // Implementation: 00010 // <Notes on implementation> 00011 // 00012 // Author: Lindsey Gray 00013 // Created: 13.1.2005 00014 // 00015 // $Id: CSCTFTBFrontHeader.cc,v 1.1 2007/04/26 23:39:19 kkotov Exp $ 00016 00017 // System include files 00018 00019 // Package include files 00020 #include "EventFilter/CSCTFRawToDigi/src/CSCTFTBFrontHeader.h" 00021 00022 // External package include files 00023 00024 // STL classes 00025 00026 // Constants, enums and typedefs 00027 00028 // CVS-based strings (Id and Tag with which file was checked out) 00029 static const char* const kIdString = "$Id: CSCTFTBFrontHeader.cc,v 1.1 2007/04/26 23:39:19 kkotov Exp $"; 00030 static const char* const kTagString = "$Name: V02-15-07 $"; 00031 00032 // Static data member definitions 00033 00034 // Constructors and destructor 00035 00036 CSCTFTBFrontHeader::CSCTFTBFrontHeader(): 00037 zero1_(0), 00038 zero2_(0) 00039 {} 00040 00041 CSCTFTBFrontHeader::CSCTFTBFrontHeader(const CSCTFTBFrontHeader& parent) 00042 { 00043 memcpy(this,&parent,size()*sizeof(unsigned short)); 00044 } 00045 00046 CSCTFTBFrontHeader::~CSCTFTBFrontHeader() 00047 {} 00048 00050 unsigned CSCTFTBFrontHeader::getVPBit(unsigned int frontFPGA, unsigned int link) const 00051 { 00052 frontFPGA = (frontFPGA >5 || frontFPGA < 1) ? 1 : frontFPGA; 00053 link = (link >3 || link < 1) ? 1 : link; 00054 unsigned shift = ( (frontFPGA-1)*3 + (link-1) ); 00055 return (vld_patrn_ & (1<<shift)) >> shift; 00056 } 00057 00059 unsigned CSCTFTBFrontHeader::getSEBit(unsigned int frontFPGA, unsigned int link) const 00060 { 00061 frontFPGA = (frontFPGA >5 || frontFPGA < 1) ? 1 : frontFPGA; 00062 link = (link >3 || link < 1) ? 1 : link; 00063 unsigned shift = ( (frontFPGA-1)*3 + (link-1) ); 00064 return (synch_err_ & (1<<shift)) >> shift; 00065 } 00066 00067 std::ostream & operator<<(std::ostream & stream, const CSCTFTBFrontHeader & hdr) 00068 { 00069 if(hdr.validPattern()) 00070 { 00071 stream << "\tFront Header Data:\n"; 00072 stream << "\t Valid Pattern Bits : " << std::hex << hdr.validPattern() 00073 << std::endl; 00074 stream << "\t Synch Error Bits : " << std::hex << hdr.synchError() 00075 <<std::endl; 00076 } 00077 return stream; 00078 }