#include <HcalHTRData.h>
Public Member Functions | |
void | adoptData (const unsigned short *data, int length) |
void | allocate (int version_to_create=0) |
bool | check () const |
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event. | |
void | dataPointers (const unsigned short **daq_first, const unsigned short **daq_last, const unsigned short **tp_first, const unsigned short **tp_last) const |
Obtain the starting and ending pointers for external unpacking of the data. | |
unsigned int | getBunchNumber () const |
Get the HTR bunch number. | |
unsigned int | getDLLunlock () const |
Get DLLunlock bits. | |
unsigned int | getErrorsWord () const |
Get the errors word. | |
unsigned int | getExtHdr1 () const |
Get the HTR Ext Header words. | |
unsigned int | getExtHdr2 () const |
unsigned int | getExtHdr3 () const |
unsigned int | getExtHdr4 () const |
unsigned int | getExtHdr5 () const |
unsigned int | getExtHdr6 () const |
unsigned int | getExtHdr7 () const |
unsigned int | getExtHdr8 () const |
unsigned int | getFib1OrbMsgBCN () const |
Get the BCN of the Fiber Orbit Messages. | |
unsigned int | getFib2OrbMsgBCN () const |
unsigned int | getFib3OrbMsgBCN () const |
unsigned int | getFib4OrbMsgBCN () const |
unsigned int | getFib5OrbMsgBCN () const |
unsigned int | getFib6OrbMsgBCN () const |
unsigned int | getFib7OrbMsgBCN () const |
unsigned int | getFib8OrbMsgBCN () const |
unsigned int | getFibOrbMsgBCN (int fiber) const |
Get the BCN of the Fiber Orbit Messages. | |
int | getFirmwareFlavor () const |
Get the HTR firmware flavor. | |
unsigned int | getFirmwareRevision () const |
Get the HTR firmware version. | |
int | getFormatVersion () const |
Get the version number of this event. | |
void | getHistogramFibers (int &a, int &b) const |
Get the fiber numbers for the data present in this event (only in histogram mode!) | |
unsigned int | getL1ANumber () const |
Get the HTR event number. | |
int | getNDD () const |
Get the number of daq data samples per channel when not zero-suppressed. | |
int | getNPrecisionWords () const |
Get the total number of precision data 16-bit words. | |
int | getNPS () const |
Get the number of presamples in daq data. | |
int | getNTP () const |
Get the number of trigger data samples when not zero-suppressed (not available after FW 4) | |
unsigned int | getOrbitNumber () const |
Get the HTR orbit number. | |
unsigned int | getPipelineLength () const |
Get the pipeline length used for this event. | |
const unsigned short * | getRawData () const |
Get a pointer to the raw data. | |
const int | getRawLength () const |
Get the length of the raw data. | |
unsigned int | getSubmodule () const |
Get the HTR submodule number. | |
unsigned int | getTTCready () const |
Get TTCready bit. | |
HcalHTRData (const HcalHTRData &) | |
HcalHTRData (const unsigned short *data, int length) | |
HcalHTRData () | |
HcalHTRData (int version_to_create) | |
unsigned int | htrSlot () const |
HcalElectronicsId-style HTR slot. | |
unsigned int | htrTopBottom () const |
HcalElectronicsId-style HTR top/bottom (1=top/0=bottom) | |
bool | isBusy () const |
bool | isCalibrationStream () const |
Is this event a calibration-stream event? | |
bool | isEmptyEvent () const |
bool | isHistogramEvent () const |
Is this event a histogram event? (do not call standard unpack in this case!!!!!) | |
bool | isOverflowWarning () const |
bool | isPatternRAMEvent () const |
Is this event a pattern-ram event? | |
bool | isUnsuppressed () const |
Is this event an unsuppresed event? | |
HcalHTRData & | operator= (const HcalHTRData &) |
void | pack (unsigned char *daq_lengths, unsigned short *daq_samples, unsigned char *tp_lengths, unsigned short *tp_samples, bool do_capid=false) |
Unpack the HTR data into TP and DAQ data sorted by channel. | |
void | packHeaderTrailer (int L1Anumber, int bcn, int submodule, int orbitn, int pipeline, int ndd, int nps, int firmwareRev=0) |
pack header and trailer (call _after_ pack) | |
void | packUnsuppressed (const bool *mp) |
pack trailer with Mark and Pass bits | |
unsigned int | readoutVMECrateId () const |
HcalElectronicsId-style VME crate number. | |
void | unpack (unsigned char *daq_lengths, unsigned short *daq_samples, unsigned char *tp_lengths, unsigned short *tp_samples) const |
Unpack the HTR data into TP and DAQ data sorted by channel. | |
bool | unpackHistogram (int fiber, int fiberchan, int capid, unsigned short *histogram) const |
Unpack special histogramming mode data. | |
bool | wasHistogramError (int ifiber) const |
Was there an error on the given fiber for this event (only in histogram mode!) | |
bool | wasMarkAndPassZS (int fiber, int fiberchan) const |
Was this channel passed as part of Mark&Pass ZS? | |
bool | wasMarkAndPassZSTP (int slb, int slbchan) const |
Was this channel passed as part of Mark&Pass ZS? | |
uint32_t | zsBunchMask () const |
ZS Bunch Mask (if available) | |
~HcalHTRData () | |
Static Public Member Functions | |
static bool | is_channel_header (unsigned short value) |
check top bit to see if this is a compact format channel header word | |
static bool | unpack_per_channel_header (unsigned short, int &flav, int &error_flags, int &capid0, int &channelid) |
Unpack a per-channel header word (compact format) | |
Static Public Attributes | |
static const int | CHANNELS_PER_SPIGOT = 24 |
static const int | FORMAT_VERSION_COMPACT_DATA = 6 |
static const int | MAXIMUM_SAMPLES_PER_CHANNEL = 20 |
Protected Member Functions | |
void | determineSectionLengths (int &tpWords, int &daqWords, int &headerWords, int &trailerWords) const |
void | determineStaticLengths (int &headerWords, int &trailerWords) const |
Protected Attributes | |
int | m_formatVersion |
unsigned short * | m_ownData |
const unsigned short * | m_rawConst |
int | m_rawLength |
Interpretive class for HcalHTRData Since this class requires external specification of the length of the data, it is implemented as an interpreter, rather than a cast-able header class.
Definition at line 18 of file HcalHTRData.h.
HcalHTRData::HcalHTRData | ( | ) |
Definition at line 17 of file HcalHTRData.cc.
: m_formatVersion(-2), m_rawLength(0), m_rawConst(0), m_ownData(0) { }
HcalHTRData::~HcalHTRData | ( | ) | [inline] |
Definition at line 25 of file HcalHTRData.h.
References m_ownData.
HcalHTRData::HcalHTRData | ( | int | version_to_create | ) |
Definition at line 24 of file HcalHTRData.cc.
References allocate().
: m_formatVersion(version_to_create) { allocate(version_to_create); }
HcalHTRData::HcalHTRData | ( | const unsigned short * | data, |
int | length | ||
) |
Definition at line 18 of file HcalHTRData.cc.
References adoptData(), and m_ownData.
HcalHTRData::HcalHTRData | ( | const HcalHTRData & | hd | ) |
Definition at line 22 of file HcalHTRData.cc.
: m_formatVersion(hd.m_formatVersion), m_rawLength(hd.m_rawLength), m_rawConst(hd.m_rawConst), m_ownData(0) { }
void HcalHTRData::adoptData | ( | const unsigned short * | data, |
int | length | ||
) |
Definition at line 49 of file HcalHTRData.cc.
References data, m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalDTCHeader::getSlotData(), HcalDCCHeader::getSpigotData(), and HcalHTRData().
{ m_rawLength=length; m_rawConst=data; if (m_rawLength<5) { m_formatVersion=-2; // invalid! } else { // determine format version if ((m_rawConst[2]&0x8000)==0) m_formatVersion=-1; // original format before versions else m_formatVersion=(m_rawConst[4]>>12)&0xF; } }
void HcalHTRData::allocate | ( | int | version_to_create = 0 | ) |
Definition at line 28 of file HcalHTRData.cc.
References m_formatVersion, m_ownData, m_rawConst, and m_rawLength.
Referenced by HcalHTRData(), HcalPacker::pack(), and CastorPacker::pack().
{ m_formatVersion=version_to_create; // the needed space is for the biggest possible event... const int needed=0x200; // create a buffer big enough... m_ownData=new unsigned short[needed]; // clear isn't really necessary, but it makes valgrind happy memset(m_ownData,0,sizeof(unsigned short)*needed); m_rawLength=0; m_rawConst=m_ownData; }
bool HcalHTRData::check | ( | void | ) | const |
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event.
Definition at line 64 of file HcalHTRData.cc.
References determineSectionLengths(), isHistogramEvent(), m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalTriggerPrimitiveAlgo::runFEFormatError(), HcalRawDataMonitor::unpack(), CastorUnpacker::unpack(), CastorDataIntegrityMonitor::unpack(), and HcalUnpacker::unpack().
{ if (m_formatVersion==-1) { // length checks // minimum length if (m_rawLength<6+12) return false; // matches wordcount if (m_rawLength!=m_rawConst[m_rawLength-3]) return false; // empty event check if (m_rawConst[2]&0x20) return false; } else { // length checks // minimum length if (m_rawLength<8+4) return false; if (m_formatVersion<=3) { // matches wordcount if (m_rawLength!=m_rawConst[m_rawLength-3]) { if (isHistogramEvent() && m_rawConst[m_rawLength-3]==786) { // known bug! } else return false; } } else { // eventually add CRC check } // empty event check (redundant...) if (m_rawConst[2]&0x4) return false; } if (!isHistogramEvent()) { // daq/tp length check int tp, daq, header, trailer; determineSectionLengths(tp,daq,header,trailer); if (tp+daq+header+trailer>m_rawLength) return false; } return true; }
void HcalHTRData::dataPointers | ( | const unsigned short ** | daq_first, |
const unsigned short ** | daq_last, | ||
const unsigned short ** | tp_first, | ||
const unsigned short ** | tp_last | ||
) | const |
Obtain the starting and ending pointers for external unpacking of the data.
daq_first | Pointer to a pointer to the start of the DAQ data |
daq_last | Pointer to a pointer to the end of the DAQ data |
tp_first | Pointer to a pointer to the start of the TP data |
tp_last | Pointer to a pointer to the end of the TP data |
Definition at line 155 of file HcalHTRData.cc.
References determineSectionLengths(), and m_rawConst.
Referenced by HcalRawDataMonitor::unpack(), HcalTTPUnpacker::unpack(), CastorUnpacker::unpack(), and HcalUnpacker::unpack().
{ int tp_words_total, daq_words_total, headerLen, trailerLen; determineSectionLengths(tp_words_total,daq_words_total,headerLen,trailerLen); *tp_first=m_rawConst+headerLen; *tp_last=*tp_first+(tp_words_total-1); *daq_first=*tp_last+1; *daq_last=*daq_first+(daq_words_total-1); }
void HcalHTRData::determineSectionLengths | ( | int & | tpWords, |
int & | daqWords, | ||
int & | headerWords, | ||
int & | trailerWords | ||
) | const [protected] |
Definition at line 127 of file HcalHTRData.cc.
References CHANNELS_PER_SPIGOT, m_formatVersion, m_rawConst, and m_rawLength.
Referenced by check(), dataPointers(), and unpack().
{ if (m_formatVersion==-1) { tpWords=m_rawConst[5]>>8; daqWords=CHANNELS_PER_SPIGOT*(m_rawConst[m_rawLength-4]>>8); // always 24 channels, no zero suppresion headerWords=6; trailerWords=12; } else { tpWords=m_rawConst[5]>>8; if (m_rawLength>4) daqWords=m_rawConst[m_rawLength-4]&0x7FF; // zero suppression supported headerWords=8; trailerWords=4; // minimum, may be more... } }
void HcalHTRData::determineStaticLengths | ( | int & | headerWords, |
int & | trailerWords | ||
) | const [protected] |
Definition at line 142 of file HcalHTRData.cc.
References m_formatVersion.
Referenced by pack().
{ if (m_formatVersion==-1) { headerWords=6; trailerWords=12; } else if (m_formatVersion<5) { headerWords=8; trailerWords=4; // minimum, may be more... } else { headerWords=8; trailerWords=12; // minimum, may be more... } }
unsigned int HcalHTRData::getBunchNumber | ( | ) | const [inline] |
Get the HTR bunch number.
Definition at line 116 of file HcalHTRData.h.
References m_rawConst.
Referenced by HcalRawDataMonitor::HTRPrint(), and HcalRawDataMonitor::unpack().
{ return (m_rawConst[4]&0xFFF); }
unsigned int HcalHTRData::getDLLunlock | ( | ) | const [inline] |
Get DLLunlock bits.
Definition at line 171 of file HcalHTRData.h.
References m_rawConst.
{ return (m_rawConst[5]>>1)&0x3; }
unsigned int HcalHTRData::getErrorsWord | ( | ) | const [inline] |
Get the errors word.
Definition at line 158 of file HcalHTRData.h.
References m_rawConst.
Referenced by HcalDCCHeader::copySpigotData(), HcalRawDataMonitor::HTRPrint(), HcalTriggerPrimitiveAlgo::runFEFormatError(), and HcalRawDataMonitor::unpack().
{ return m_rawConst[2]&0xFFFF; }
unsigned int HcalHTRData::getExtHdr1 | ( | ) | const [inline] |
Get the HTR Ext Header words.
Definition at line 218 of file HcalHTRData.h.
References m_rawConst.
{ return (m_rawConst[0]);}
unsigned int HcalHTRData::getExtHdr2 | ( | ) | const [inline] |
unsigned int HcalHTRData::getExtHdr3 | ( | ) | const [inline] |
unsigned int HcalHTRData::getExtHdr4 | ( | ) | const [inline] |
unsigned int HcalHTRData::getExtHdr5 | ( | ) | const [inline] |
unsigned int HcalHTRData::getExtHdr6 | ( | ) | const [inline] |
Definition at line 228 of file HcalHTRData.h.
References m_rawConst.
Referenced by HcalRawDataMonitor::unpack(), and HcalEEUSMonitor::unpack().
{ return (m_rawConst[5]);}
unsigned int HcalHTRData::getExtHdr7 | ( | ) | const [inline] |
Definition at line 230 of file HcalHTRData.h.
References m_rawConst.
Referenced by HcalRawDataMonitor::unpack().
{ return (m_rawConst[6]);}
unsigned int HcalHTRData::getExtHdr8 | ( | ) | const [inline] |
unsigned int HcalHTRData::getFib1OrbMsgBCN | ( | ) | const [inline] |
Get the BCN of the Fiber Orbit Messages.
Definition at line 184 of file HcalHTRData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalRawDataMonitor::HTRPrint(), and HcalRawDataMonitor::unpack().
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-12]&0xFFF); }
unsigned int HcalHTRData::getFib2OrbMsgBCN | ( | ) | const [inline] |
Definition at line 187 of file HcalHTRData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalRawDataMonitor::HTRPrint(), and HcalRawDataMonitor::unpack().
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-11]&0xFFF); }
unsigned int HcalHTRData::getFib3OrbMsgBCN | ( | ) | const [inline] |
Definition at line 191 of file HcalHTRData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalRawDataMonitor::HTRPrint(), and HcalRawDataMonitor::unpack().
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-10]&0xFFF); }
unsigned int HcalHTRData::getFib4OrbMsgBCN | ( | ) | const [inline] |
Definition at line 195 of file HcalHTRData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalRawDataMonitor::HTRPrint(), and HcalRawDataMonitor::unpack().
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-9]&0xFFF); }
unsigned int HcalHTRData::getFib5OrbMsgBCN | ( | ) | const [inline] |
Definition at line 199 of file HcalHTRData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalRawDataMonitor::HTRPrint(), and HcalRawDataMonitor::unpack().
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-8]&0xFFF); }
unsigned int HcalHTRData::getFib6OrbMsgBCN | ( | ) | const [inline] |
Definition at line 203 of file HcalHTRData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalRawDataMonitor::HTRPrint(), and HcalRawDataMonitor::unpack().
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-7]&0xFFF); }
unsigned int HcalHTRData::getFib7OrbMsgBCN | ( | ) | const [inline] |
Definition at line 207 of file HcalHTRData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalRawDataMonitor::HTRPrint(), and HcalRawDataMonitor::unpack().
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-6]&0xFFF); }
unsigned int HcalHTRData::getFib8OrbMsgBCN | ( | ) | const [inline] |
Definition at line 211 of file HcalHTRData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalRawDataMonitor::HTRPrint(), and HcalRawDataMonitor::unpack().
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-5]&0xFFF); }
unsigned int HcalHTRData::getFibOrbMsgBCN | ( | int | fiber | ) | const [inline] |
Get the BCN of the Fiber Orbit Messages.
Definition at line 179 of file HcalHTRData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalUnpacker_impl::unpack(), CastorUnpacker_impl::unpack(), and HcalUnpacker_impl::unpack_compact().
{ return (m_formatVersion==-1 || fiber<1 || fiber>8)?(0):(m_rawConst[m_rawLength-12+(fiber-1)]&0xFFF); }
int HcalHTRData::getFirmwareFlavor | ( | ) | const |
Get the HTR firmware flavor.
Definition at line 411 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by HLTHcalNZSFilter::hltFilter(), CastorUnpacker::unpack(), HcalTTPUnpacker::unpack(), and HcalUnpacker::unpack().
{ return (m_formatVersion<2)?(-1):((m_rawConst[7]>>8)&0xFF); }
unsigned int HcalHTRData::getFirmwareRevision | ( | ) | const |
Get the HTR firmware version.
Definition at line 408 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by HcalRawDataMonitor::unpack(), and HcalTTPUnpacker::unpack().
{ return (m_formatVersion==-1)?(0):((m_rawConst[6]&0x1FFF)+((m_rawConst[6]&0xE000)<<3)); }
int HcalHTRData::getFormatVersion | ( | ) | const [inline] |
Get the version number of this event.
Definition at line 35 of file HcalHTRData.h.
References m_formatVersion.
Referenced by HcalRawDataMonitor::unpack(), CastorUnpacker::unpack(), and HcalUnpacker::unpack().
{ return m_formatVersion; }
void HcalHTRData::getHistogramFibers | ( | int & | a, |
int & | b | ||
) | const |
Get the fiber numbers for the data present in this event (only in histogram mode!)
Definition at line 415 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by HcalUnpacker::unpack(), and unpackHistogram().
{ a=-1; b=-1; if (m_formatVersion==-1) { a=((m_rawConst[2]&0x0F00)>>8); b=((m_rawConst[2]&0xF000)>>12); } else { a=((m_rawConst[5]&0x0F00)>>8); b=((m_rawConst[5]&0xF000)>>12); } }
unsigned int HcalHTRData::getL1ANumber | ( | ) | const [inline] |
Get the HTR event number.
Definition at line 112 of file HcalHTRData.h.
References m_rawConst.
Referenced by HcalRawDataMonitor::HTRPrint(), and HcalRawDataMonitor::unpack().
{ return (m_rawConst[0]&0xFF)+(m_rawConst[1]<<8); }
int HcalHTRData::getNDD | ( | ) | const |
Get the number of daq data samples per channel when not zero-suppressed.
Definition at line 390 of file HcalHTRData.cc.
References m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalDigiMonitor::analyze(), HcalRawDataMonitor::unpack(), and HcalTTPUnpacker::unpack().
{ return (m_formatVersion==-1)?(m_rawConst[m_rawLength-4]>>8):(m_rawConst[m_rawLength-4]>>11); }
int HcalHTRData::getNPrecisionWords | ( | ) | const |
Get the total number of precision data 16-bit words.
Definition at line 399 of file HcalHTRData.cc.
References m_formatVersion, m_rawConst, and m_rawLength.
{ return (m_formatVersion==-1)?(m_rawConst[m_rawLength-4]&0xFF):(m_rawConst[m_rawLength-4]&0x7FF); }
int HcalHTRData::getNPS | ( | ) | const |
Get the number of presamples in daq data.
Definition at line 402 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by HcalTTPUnpacker::unpack(), CastorUnpacker::unpack(), and HcalUnpacker::unpack().
{ return (m_formatVersion==-1)?(0):((m_rawConst[5]>>3)&0x1F); }
int HcalHTRData::getNTP | ( | ) | const |
Get the number of trigger data samples when not zero-suppressed (not available after FW 4)
Definition at line 393 of file HcalHTRData.cc.
References m_formatVersion, m_rawConst, and m_rawLength.
{ int retval=-1; if (m_formatVersion==-1) retval=m_rawConst[m_rawLength-4]&0xFF; else if (m_formatVersion<3) retval=m_rawConst[m_rawLength-4]>>11; return retval; }
unsigned int HcalHTRData::getOrbitNumber | ( | ) | const |
Get the HTR orbit number.
Definition at line 326 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by HcalRawDataMonitor::unpack().
{ switch (m_formatVersion) { case (-1) : return (m_rawConst[3]>>8); case (0) : return (m_rawConst[3]>>10); default : return (m_rawConst[3]>>11); } }
unsigned int HcalHTRData::getPipelineLength | ( | ) | const |
Get the pipeline length used for this event.
Definition at line 405 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by HcalTTPUnpacker::unpack().
{ return (m_formatVersion==-1)?(m_rawConst[2]>>8):(m_rawConst[7]&0xFF); }
const unsigned short* HcalHTRData::getRawData | ( | ) | const [inline] |
Get a pointer to the raw data.
Definition at line 38 of file HcalHTRData.h.
References m_rawConst.
Referenced by HcalDTCHeader::copySlotData(), HcalDCCHeader::copySpigotData(), HcalRawDataMonitor::unpack(), and HcalEEUSMonitor::unpack().
{ return m_rawConst; }
const int HcalHTRData::getRawLength | ( | ) | const [inline] |
Get the length of the raw data.
Definition at line 41 of file HcalHTRData.h.
References m_rawLength.
Referenced by HcalDTCHeader::copySlotData(), HcalDCCHeader::copySpigotData(), HcalPacker::pack(), CastorPacker::pack(), HcalRawDataMonitor::unpack(), and HcalEEUSMonitor::unpack().
{ return m_rawLength; }
unsigned int HcalHTRData::getSubmodule | ( | ) | const |
Get the HTR submodule number.
Definition at line 333 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by htrSlot(), htrTopBottom(), readoutVMECrateId(), HcalTTPUnpacker::unpack(), CastorUnpacker::unpack(), and HcalUnpacker::unpack().
{ switch (m_formatVersion) { case (-1) : return (m_rawConst[3]&0xFF); case (0) : return (m_rawConst[3]&0x3FF); default : return (m_rawConst[3]&0x7FF); } }
unsigned int HcalHTRData::getTTCready | ( | ) | const [inline] |
Get TTCready bit.
Definition at line 175 of file HcalHTRData.h.
References m_rawConst.
{ return m_rawConst[5]&0x1; }
unsigned int HcalHTRData::htrSlot | ( | ) | const |
HcalElectronicsId-style HTR slot.
Definition at line 340 of file HcalHTRData.cc.
References getSubmodule().
Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalRawDataMonitor::HTRPrint(), HcalTriggerPrimitiveAlgo::runFEFormatError(), and HcalRawDataMonitor::unpack().
{ const unsigned int smid = getSubmodule(); return ((smid>>1)&0x1F); }
unsigned int HcalHTRData::htrTopBottom | ( | ) | const |
HcalElectronicsId-style HTR top/bottom (1=top/0=bottom)
Definition at line 344 of file HcalHTRData.cc.
References getSubmodule().
Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalRawDataMonitor::HTRPrint(), HcalTriggerPrimitiveAlgo::runFEFormatError(), and HcalRawDataMonitor::unpack().
{ const unsigned int smid = getSubmodule(); return (smid&0x01); }
static bool HcalHTRData::is_channel_header | ( | unsigned short | value | ) | [inline, static] |
check top bit to see if this is a compact format channel header word
Definition at line 92 of file HcalHTRData.h.
Referenced by HcalRawDataMonitor::unpack(), HcalUnpacker::unpack(), and HcalUnpacker_impl::unpack_compact().
{ return (value&0x8000)!=0; }
bool HcalHTRData::isBusy | ( | ) | const |
Definition at line 119 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by HcalUnpacker::unpack().
{ if (m_formatVersion==-1) { return false; // too old to care. } else { return (m_rawConst[2]&0x2)!=0; } }
bool HcalHTRData::isCalibrationStream | ( | ) | const |
Is this event a calibration-stream event?
Definition at line 352 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
{ return (m_formatVersion==-1)?(false):(m_rawConst[2]&0x4000); }
bool HcalHTRData::isEmptyEvent | ( | ) | const |
Definition at line 102 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by HcalEmptyEventFilter::filter(), and HcalUnpacker::unpack().
{ if (m_formatVersion==-1) { return (m_rawConst[2]&0x20)!=0; } else { return (m_rawConst[2]&0x4)!=0; } }
bool HcalHTRData::isHistogramEvent | ( | ) | const |
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition at line 387 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by check(), HcalMonitorModule::CheckSubdetectorStatus(), HcalTriggerPrimitiveAlgo::runFEFormatError(), HcalRawDataMonitor::unpack(), CastorUnpacker::unpack(), CastorDataIntegrityMonitor::unpack(), HcalEEUSMonitor::unpack(), HcalUnpacker::unpack(), unpackHistogram(), and wasHistogramError().
{ return (m_formatVersion==-1)?(m_rawConst[2]&0x2):(m_rawConst[2]&0x2000); }
bool HcalHTRData::isOverflowWarning | ( | ) | const |
Definition at line 111 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by HcalUnpacker::unpack().
{ if (m_formatVersion==-1) { return false; // too old to care. } else { return (m_rawConst[2]&0x1)!=0; } }
bool HcalHTRData::isPatternRAMEvent | ( | ) | const |
Is this event a pattern-ram event?
Definition at line 384 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
{ return (m_formatVersion==-1)?(false):(m_rawConst[2]&0x1000); }
bool HcalHTRData::isUnsuppressed | ( | ) | const |
Is this event an unsuppresed event?
Definition at line 355 of file HcalHTRData.cc.
References m_formatVersion, and m_rawConst.
Referenced by DQMHcalPhiSymAlCaReco::analyze(), HLTHcalNZSFilter::hltFilter(), HcalNZSMonitor::processEvent(), CastorUnpacker::unpack(), HcalUnpacker_impl::unpack(), HcalUnpacker::unpack(), CastorUnpacker_impl::unpack(), HcalUnpacker_impl::unpack_compact(), wasMarkAndPassZS(), wasMarkAndPassZSTP(), and zsBunchMask().
{ return (m_formatVersion<4)?(false):(m_rawConst[6]&0x8000); }
HcalHTRData & HcalHTRData::operator= | ( | const HcalHTRData & | hd | ) |
Definition at line 40 of file HcalHTRData.cc.
References m_formatVersion, m_ownData, m_rawConst, and m_rawLength.
{ if (m_ownData==0) { m_formatVersion=hd.m_formatVersion; m_rawLength=hd.m_rawLength; m_rawConst=hd.m_rawConst; } return (*this); }
void HcalHTRData::pack | ( | unsigned char * | daq_lengths, |
unsigned short * | daq_samples, | ||
unsigned char * | tp_lengths, | ||
unsigned short * | tp_samples, | ||
bool | do_capid = false |
||
) |
Unpack the HTR data into TP and DAQ data sorted by channel.
daq_lengths | unsigned char[24] of lengths |
daq_samples | unsigned short [24*20] of data |
tp_lengths | unsigned char[24] of lengths |
tp_samples | unsigned short [24*20] of data |
Definition at line 226 of file HcalHTRData.cc.
References CHANNELS_PER_SPIGOT, determineStaticLengths(), i, m_formatVersion, m_ownData, m_rawLength, and MAXIMUM_SAMPLES_PER_CHANNEL.
Referenced by HcalPacker::pack(), and CastorPacker::pack().
{ int tp_words_total=0, daq_words_total=0, headerLen, trailerLen; determineStaticLengths(headerLen,trailerLen); tp_words_total=0; daq_words_total=0; int ichan,isample; // trigger primitive words unsigned short* ptr=m_ownData+headerLen; if (tp_samples!=0 && tp_lengths!=0) { for (ichan=0; ichan<24; ichan++) { unsigned short chanid=((ichan%3)+((ichan/3)<<2))<<11; for (isample=0; isample<tp_lengths[ichan] && isample<MAXIMUM_SAMPLES_PER_CHANNEL; isample++) { ptr[tp_words_total]=chanid|(tp_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+isample]&0x3FF); tp_words_total++; } } } // daq words ptr=m_ownData+headerLen+tp_words_total; for (ichan=0; ichan<24; ichan++) { unsigned short chanid=((ichan%3)+((ichan/3)<<2))<<11; for (isample=0; isample<daq_lengths[ichan] && isample<MAXIMUM_SAMPLES_PER_CHANNEL; isample++) { unsigned short basedata=daq_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+isample]&0x3FF; if (do_capid) basedata=(basedata&0x7F)|(0x200)|((isample%4)<<7); ptr[daq_words_total]=chanid|basedata; daq_words_total++; } } unsigned short totalLen; if (m_formatVersion==-1) { m_ownData[5]=(tp_words_total<<8)|0x1; totalLen=headerLen+tp_words_total+daq_words_total+trailerLen; m_rawLength=totalLen; m_ownData[totalLen-3]=totalLen; m_ownData[totalLen-4]=(tp_words_total/CHANNELS_PER_SPIGOT)|((daq_words_total/CHANNELS_PER_SPIGOT)<<8); } else { m_ownData[5]=(tp_words_total<<8)|0x1; totalLen=headerLen+tp_words_total+daq_words_total+trailerLen; if ((totalLen%2)==1) { m_ownData[totalLen-4]=0xFFFF; // parity word totalLen++; // round to even number of 16-bit words } m_rawLength=totalLen; m_ownData[totalLen-2]=totalLen/2; // 32-bit words m_ownData[totalLen-3]=totalLen; m_ownData[totalLen-4]=daq_words_total; } if (trailerLen==12) { // initialize extra trailer words if present for (int i=12; i>4; i--) m_ownData[totalLen-i]=0; } }
void HcalHTRData::packHeaderTrailer | ( | int | L1Anumber, |
int | bcn, | ||
int | submodule, | ||
int | orbitn, | ||
int | pipeline, | ||
int | ndd, | ||
int | nps, | ||
int | firmwareRev = 0 |
||
) |
pack header and trailer (call _after_ pack)
Definition at line 285 of file HcalHTRData.cc.
References m_formatVersion, m_ownData, and m_rawLength.
Referenced by HcalPacker::pack(), and CastorPacker::pack().
{ m_ownData[0]=L1Anumber&0xFF; m_ownData[1]=(L1Anumber&0xFFFF00)>>8; if (m_formatVersion==-1) { m_ownData[2]=((pipeline&0x7F)<<8); // no error bits m_ownData[3]=((orbitn&0xFF)<<8)|(submodule&0xFF); m_ownData[4]=bcn&0xFFF; // m_ownData[5]&=0xFF01; } else { m_ownData[2]=0x8000; // Version is valid, no error bits if (m_formatVersion==0) m_ownData[3]=((orbitn&0x3F)<<10)|(submodule&0x3FF); else m_ownData[3]=((orbitn&0x1F)<<11)|(submodule&0x7FF); m_ownData[4]=((m_formatVersion&0xF)<<12)|(bcn&0xFFF); m_ownData[5]|=((nps&0x1F)<<3)|0x1; m_ownData[6]=((firmwareRev&0x70000)>>3)|(firmwareRev&0x1FFF); m_ownData[7]=pipeline&0xFF; m_ownData[m_rawLength-4]&=0x7FF; m_ownData[m_rawLength-4]|=(ndd&0x1F)<<11; } m_ownData[m_rawLength-2]=m_rawLength/2; // 32-bit words m_ownData[m_rawLength-1]=(L1Anumber&0xFF)<<8; }
void HcalHTRData::packUnsuppressed | ( | const bool * | mp | ) |
pack trailer with Mark and Pass bits
Definition at line 310 of file HcalHTRData.cc.
References m_formatVersion, m_ownData, and m_rawLength.
Referenced by HcalPacker::pack().
{ if (m_formatVersion<4) return; for (int fiber=1; fiber<=8; fiber++) { for (int fiberchan=0; fiberchan<=2; fiberchan++) { int linchan=(fiber-1)*3+fiberchan; unsigned short& val=m_ownData[m_rawLength-12+(linchan/8)]; if (mp[linchan]) val|=1<<(linchan%8); } } // set the unsupressed bit m_ownData[6]|=0x8000; }
unsigned int HcalHTRData::readoutVMECrateId | ( | ) | const |
HcalElectronicsId-style VME crate number.
Definition at line 348 of file HcalHTRData.cc.
References getSubmodule().
Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalRawDataMonitor::HTRPrint(), HcalTriggerPrimitiveAlgo::runFEFormatError(), and HcalRawDataMonitor::unpack().
{ const unsigned int smid = getSubmodule(); return ((smid>>6)&0x1F); }
void HcalHTRData::unpack | ( | unsigned char * | daq_lengths, |
unsigned short * | daq_samples, | ||
unsigned char * | tp_lengths, | ||
unsigned short * | tp_samples | ||
) | const |
Unpack the HTR data into TP and DAQ data sorted by channel.
daq_lengths | unsigned char[24] of lengths. High bit set indicates error with this channel |
daq_samples | unsigned short [24*20] of data |
tp_lengths | unsigned char[24] of lengths |
tp_samples | unsigned short [24*20] of data |
Definition at line 174 of file HcalHTRData.cc.
References channelDecoder, CHANNELS_PER_SPIGOT, determineSectionLengths(), m_rawConst, and MAXIMUM_SAMPLES_PER_CHANNEL.
{ if (daq_lengths!=0) memset(daq_lengths,0,CHANNELS_PER_SPIGOT); if (tp_lengths!=0) memset(tp_lengths,0,CHANNELS_PER_SPIGOT); // currently, the major differences between the versions are // -1 : 6 word header, no zero suppression, trailer setup // 0 : 8 word header, zero suppression, int tp_words_total, daq_words_total, headerLen, trailerLen; determineSectionLengths(tp_words_total,daq_words_total,headerLen,trailerLen); // printf("%d %d %d %d\n",tp_words_total,daq_words_total,headerLen,trailerLen); int wordPtr; const unsigned short* tpBase=m_rawConst+headerLen; // process the trigger primitive words if (tp_lengths!=0) { for (wordPtr=0; wordPtr<tp_words_total; wordPtr++) { int ichan=channelDecoder[tpBase[wordPtr]>>11]; if (ichan>=24) continue; tp_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+tp_lengths[ichan]]=tpBase[wordPtr]&0x3ff; tp_lengths[ichan]++; } } const unsigned short* daqBase=m_rawConst+headerLen+tp_words_total; // process the DAQ words [ assumes that data from one channel will always be together ] int lastChan=-1; int lastCapid=0; if (daq_lengths!=0) { for (wordPtr=0; wordPtr<daq_words_total; wordPtr++) { int ichan=channelDecoder[daqBase[wordPtr]>>11]; if (ichan>=24) continue; int capid=(daqBase[wordPtr]&0x180)>>7; int erdv=(daqBase[wordPtr]&0x600)>>9; if (erdv!=0x1 || (lastChan==ichan && (capid!=((lastCapid+1)%4)))) { daq_lengths[ichan]|=0x80; } lastChan=ichan; lastCapid=capid; int useLength=daq_lengths[ichan]&0x1F; // printf("%d %d\n",ichan,useLength); daq_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+useLength]=daqBase[wordPtr]&0x3ff; daq_lengths[ichan]=(useLength+1)|(daq_lengths[ichan]&0xE0); // keep the error bits } } }
bool HcalHTRData::unpack_per_channel_header | ( | unsigned short | header, |
int & | flav, | ||
int & | error_flags, | ||
int & | capid0, | ||
int & | channelid | ||
) | [static] |
Unpack a per-channel header word (compact format)
Definition at line 435 of file HcalHTRData.cc.
Referenced by HcalRawDataMonitor::unpack(), HcalUnpacker::unpack(), and HcalUnpacker_impl::unpack_compact().
{
flav=(header>>12)&0x7;
error_flags=(header>>10)&0x3;
capid0=(header>>8)&0x3;
channelid=(header)&0xFF;
return (header&0x8000)!=0;
}
bool HcalHTRData::unpackHistogram | ( | int | fiber, |
int | fiberchan, | ||
int | capid, | ||
unsigned short * | histogram | ||
) | const |
Unpack special histogramming mode data.
fiber | |
fiberchan | |
capid | Capacitor id for which to extract a histogram |
histogram | unsigned int[32] into which the data should be deposited |
Definition at line 443 of file HcalHTRData.cc.
References getHistogramFibers(), i, isHistogramEvent(), m_formatVersion, m_rawConst, and evf::evtn::offset().
Referenced by HcalUnpacker::unpack().
{ // check for histogram mode if (!isHistogramEvent()) return false; int fiber1, fiber2; getHistogramFibers(fiber1,fiber2); if (fiber1!=myfiber && fiber2!=myfiber) return false; if (m_formatVersion==-1) { int offset=6+mysc*4*32+capid*32; if (myfiber==fiber2) offset+=3*4*32; // skip to the second half... for (int i=0; i<32; i++) histogram[i]=m_rawConst[offset+i]; return true; } else { int offset=8+mysc*4*32+capid*32; if (myfiber==fiber2) offset+=3*4*32; // skip to the second half... for (int i=0; i<32; i++) histogram[i]=m_rawConst[offset+i]; return true; } }
bool HcalHTRData::wasHistogramError | ( | int | ifiber | ) | const |
Was there an error on the given fiber for this event (only in histogram mode!)
Definition at line 427 of file HcalHTRData.cc.
References isHistogramEvent(), and m_rawConst.
{ bool retval=!isHistogramEvent(); if (!retval) { retval=((m_rawConst[7])&(1<<ifiber))!=0; } return retval; }
bool HcalHTRData::wasMarkAndPassZS | ( | int | fiber, |
int | fiberchan | ||
) | const |
Was this channel passed as part of Mark&Pass ZS?
Definition at line 358 of file HcalHTRData.cc.
References isUnsuppressed(), m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalUnpacker_impl::unpack(), CastorUnpacker_impl::unpack(), and HcalUnpacker_impl::unpack_compact().
{ if (fiber<1 || fiber>8 || fiberchan<0 || fiberchan>2) return false; if (!isUnsuppressed() || m_formatVersion<5) return false; int linchan=(fiber-1)*3+fiberchan; unsigned short val=m_rawConst[m_rawLength-12+(linchan/8)]; return ((val>>(linchan%8))&0x1)!=0; }
bool HcalHTRData::wasMarkAndPassZSTP | ( | int | slb, |
int | slbchan | ||
) | const |
Was this channel passed as part of Mark&Pass ZS?
Definition at line 366 of file HcalHTRData.cc.
References isUnsuppressed(), m_formatVersion, m_rawConst, and m_rawLength.
Referenced by CastorUnpacker::unpack(), and HcalUnpacker::unpack().
{ if (slb<1 || slb>6 || slbchan<0 || slbchan>3) return false; if (!isUnsuppressed() || m_formatVersion<5) return false; int linchan=(slb-1)*4+slbchan; unsigned short val=m_rawConst[m_rawLength-12+(linchan/8)]; return ((val>>(linchan%8))&0x100)!=0; }
uint32_t HcalHTRData::zsBunchMask | ( | ) | const |
ZS Bunch Mask (if available)
Definition at line 375 of file HcalHTRData.cc.
References isUnsuppressed(), m_formatVersion, m_rawConst, and m_rawLength.
Referenced by HcalUnpacker_impl::unpack(), CastorUnpacker_impl::unpack(), and HcalUnpacker_impl::unpack_compact().
{ uint32_t mask=0; if (isUnsuppressed() && m_formatVersion>=5) { mask=m_rawConst[m_rawLength-5]| ((m_rawConst[m_rawLength-6]&0xF000)<<4); } return mask; }
const int HcalHTRData::CHANNELS_PER_SPIGOT = 24 [static] |
Definition at line 20 of file HcalHTRData.h.
Referenced by determineSectionLengths(), HcalRawDataMonitor::label_xChanns(), HcalPacker::pack(), pack(), CastorPacker::pack(), and unpack().
const int HcalHTRData::FORMAT_VERSION_COMPACT_DATA = 6 [static] |
Definition at line 22 of file HcalHTRData.h.
Referenced by HcalUnpacker::unpack().
int HcalHTRData::m_formatVersion [protected] |
Definition at line 253 of file HcalHTRData.h.
Referenced by adoptData(), allocate(), check(), determineSectionLengths(), determineStaticLengths(), getFib1OrbMsgBCN(), getFib2OrbMsgBCN(), getFib3OrbMsgBCN(), getFib4OrbMsgBCN(), getFib5OrbMsgBCN(), getFib6OrbMsgBCN(), getFib7OrbMsgBCN(), getFib8OrbMsgBCN(), getFibOrbMsgBCN(), getFirmwareFlavor(), getFirmwareRevision(), getFormatVersion(), getHistogramFibers(), getNDD(), getNPrecisionWords(), getNPS(), getNTP(), getOrbitNumber(), getPipelineLength(), getSubmodule(), isBusy(), isCalibrationStream(), isEmptyEvent(), isHistogramEvent(), isOverflowWarning(), isPatternRAMEvent(), isUnsuppressed(), operator=(), pack(), packHeaderTrailer(), packUnsuppressed(), unpackHistogram(), wasMarkAndPassZS(), wasMarkAndPassZSTP(), and zsBunchMask().
unsigned short* HcalHTRData::m_ownData [protected] |
Definition at line 256 of file HcalHTRData.h.
Referenced by allocate(), HcalHTRData(), operator=(), pack(), packHeaderTrailer(), packUnsuppressed(), and ~HcalHTRData().
const unsigned short* HcalHTRData::m_rawConst [protected] |
Definition at line 255 of file HcalHTRData.h.
Referenced by adoptData(), allocate(), check(), dataPointers(), determineSectionLengths(), getBunchNumber(), getDLLunlock(), getErrorsWord(), getExtHdr1(), getExtHdr2(), getExtHdr3(), getExtHdr4(), getExtHdr5(), getExtHdr6(), getExtHdr7(), getExtHdr8(), getFib1OrbMsgBCN(), getFib2OrbMsgBCN(), getFib3OrbMsgBCN(), getFib4OrbMsgBCN(), getFib5OrbMsgBCN(), getFib6OrbMsgBCN(), getFib7OrbMsgBCN(), getFib8OrbMsgBCN(), getFibOrbMsgBCN(), getFirmwareFlavor(), getFirmwareRevision(), getHistogramFibers(), getL1ANumber(), getNDD(), getNPrecisionWords(), getNPS(), getNTP(), getOrbitNumber(), getPipelineLength(), getRawData(), getSubmodule(), getTTCready(), isBusy(), isCalibrationStream(), isEmptyEvent(), isHistogramEvent(), isOverflowWarning(), isPatternRAMEvent(), isUnsuppressed(), operator=(), unpack(), unpackHistogram(), wasHistogramError(), wasMarkAndPassZS(), wasMarkAndPassZSTP(), and zsBunchMask().
int HcalHTRData::m_rawLength [protected] |
Definition at line 254 of file HcalHTRData.h.
Referenced by adoptData(), allocate(), check(), determineSectionLengths(), getFib1OrbMsgBCN(), getFib2OrbMsgBCN(), getFib3OrbMsgBCN(), getFib4OrbMsgBCN(), getFib5OrbMsgBCN(), getFib6OrbMsgBCN(), getFib7OrbMsgBCN(), getFib8OrbMsgBCN(), getFibOrbMsgBCN(), getNDD(), getNPrecisionWords(), getNTP(), getRawLength(), operator=(), pack(), packHeaderTrailer(), packUnsuppressed(), wasMarkAndPassZS(), wasMarkAndPassZSTP(), and zsBunchMask().
const int HcalHTRData::MAXIMUM_SAMPLES_PER_CHANNEL = 20 [static] |
Definition at line 21 of file HcalHTRData.h.
Referenced by HcalPacker::pack(), pack(), CastorPacker::pack(), and unpack().