#include <EventFilter/HcalRawToDigi/interface/HcalTTPData.h>
Public Types | |
typedef std::vector< bool > | AlgoBits |
typedef std::vector< bool > | InputBits |
Public Member Functions | |
bool | check () const |
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event. | |
HcalTTPData (const HcalTTPData &) | |
HcalTTPData (const unsigned short *data, int length) | |
HcalTTPData (int version_to_create) | |
HcalTTPData () | |
HcalTTPData & | operator= (const HcalTTPData &) |
void | unpack (std::vector< InputBits > &ivs, std::vector< AlgoBits > &avs) const |
Static Public Attributes | |
static const int | TTP_ALGOBITS = 24 |
static const int | TTP_INPUTS = 72 |
Private Member Functions | |
void | determineSectionLengths (int &dataWords, int &headerWords, int &trailerWords) const |
Definition at line 19 of file HcalTTPData.h.
typedef std::vector<bool> HcalTTPData::AlgoBits |
Definition at line 37 of file HcalTTPData.h.
typedef std::vector<bool> HcalTTPData::InputBits |
Definition at line 36 of file HcalTTPData.h.
HcalTTPData::HcalTTPData | ( | ) |
HcalTTPData::HcalTTPData | ( | int | version_to_create | ) |
HcalTTPData::HcalTTPData | ( | const unsigned short * | data, | |
int | length | |||
) |
HcalTTPData::HcalTTPData | ( | const HcalTTPData & | hd | ) |
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event.
Reimplemented from HcalHTRData.
Definition at line 32 of file HcalTTPData.cc.
References determineSectionLengths(), header, HcalHTRData::isHistogramEvent(), HcalHTRData::m_formatVersion, HcalHTRData::m_rawConst, and HcalHTRData::m_rawLength.
00032 { 00033 if (m_formatVersion==-1) { 00034 // length checks 00035 // minimum length 00036 if (m_rawLength<6+12) return false; 00037 // matches wordcount 00038 if (m_rawLength!=m_rawConst[m_rawLength-3]) return false; 00039 // empty event check 00040 if (m_rawConst[2]&0x20) return false; 00041 } else { 00042 // length checks 00043 // minimum length 00044 if (m_rawLength<8+4) return false; 00045 if (m_formatVersion<=3) { 00046 // matches wordcount 00047 if (m_rawLength!=m_rawConst[m_rawLength-3]) { 00048 if (isHistogramEvent() && m_rawConst[m_rawLength-3]==786) { 00049 // known bug! 00050 } else 00051 return false; 00052 } 00053 } else { 00054 // eventually add CRC check 00055 } 00056 // empty event check (redundant...) 00057 if (m_rawConst[2]&0x4) return false; 00058 } 00059 00060 // daq/tp length check 00061 int daq, header, trailer; 00062 determineSectionLengths(daq,header,trailer); 00063 if (daq+header+trailer>m_rawLength) return false; 00064 00065 return true; 00066 }
void HcalTTPData::determineSectionLengths | ( | int & | dataWords, | |
int & | headerWords, | |||
int & | trailerWords | |||
) | const [private] |
Definition at line 102 of file HcalTTPData.cc.
References HcalHTRData::m_rawConst, and HcalHTRData::m_rawLength.
Referenced by check(), and unpack().
00102 { 00103 headerWords=8; 00104 trailerWords=4; // minimum, may be more... 00105 if (m_rawLength>4) 00106 dataWords=m_rawConst[m_rawLength-4]&0x7FF; // zero suppression supported 00107 else dataWords=0; 00108 }
HcalTTPData & HcalTTPData::operator= | ( | const HcalTTPData & | hd | ) |
Definition at line 20 of file HcalTTPData.cc.
References HcalHTRData::m_formatVersion, HcalHTRData::m_ownData, HcalHTRData::m_rawConst, and HcalHTRData::m_rawLength.
00020 { 00021 if (m_ownData==0) { 00022 m_formatVersion=hd.m_formatVersion; 00023 m_rawLength=hd.m_rawLength; 00024 m_rawConst=hd.m_rawConst; 00025 } 00026 return (*this); 00027 }
Definition at line 73 of file HcalTTPData.cc.
References copyBits(), determineSectionLengths(), dummy1, dummy2, dw, i, HcalHTRData::m_rawConst, TTP_ALGOBITS, TTP_INPUTS, and tw.
00073 { 00074 ivs.clear(); 00075 avs.clear(); 00076 00077 int dw, hw, tw; 00078 InputBits dummy1(TTP_INPUTS); 00079 AlgoBits dummy2(TTP_ALGOBITS); 00080 determineSectionLengths(dw,hw,tw); 00081 00082 const unsigned short* workptr=m_rawConst+hw; 00083 for (int i=0; i<dw; i++) { 00084 switch (i%6) { 00085 case 0: 00086 ivs.push_back(dummy1); 00087 copyBits(workptr[i], ivs.back(),0); 00088 break; 00089 case 1: copyBits(workptr[i], ivs.back(), 16); break; 00090 case 2: copyBits(workptr[i], ivs.back(), 32); break; 00091 case 3: copyBits(workptr[i], ivs.back(), 48); break; 00092 case 4: 00093 copyBits(workptr[i], ivs.back(), 64,8); 00094 avs.push_back(dummy2); 00095 copyBits(workptr[i],avs.back(),0,8,8); 00096 break; 00097 case 5: copyBits(workptr[i], avs.back(), 8); break; 00098 } 00099 } 00100 }
const int HcalTTPData::TTP_ALGOBITS = 24 [static] |
const int HcalTTPData::TTP_INPUTS = 72 [static] |