#include <CastorCORData.h>
Public Member Functions | |
void | adoptData (const unsigned short *data, int length) |
void | allocate (int version_to_create=0) |
CastorCORData (const unsigned short *data, int length) | |
CastorCORData (const CastorCORData &) | |
CastorCORData () | |
CastorCORData (int version_to_create) | |
bool | check () const |
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event. | |
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 COR 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 | getFirmwareRevision () const |
Get the COR 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 bits. | |
unsigned int | htrSlot () const |
HcalElectronicsId-style HTR slot. | |
unsigned int | htrTopBottom () const |
HcalElectronicsId-style HTR top/bottom (1=top/0=bottom) | |
bool | isCalibrationStream () const |
Is this event a calibration-stream event? | |
bool | isHistogramEvent () const |
Is this event a histogram event? (do not call standard unpack in this case!!!!!) | |
bool | isPatternRAMEvent () const |
Is this event a pattern-ram event? | |
bool | isUnsuppressed () const |
Is this event an unsuppresed event? | |
CastorCORData & | operator= (const CastorCORData &) |
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) | |
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 |
Obtain the starting and ending pointers for external unpacking of the data. | |
bool | unpackHistogram (int fiber, int fiberchan, int capid, unsigned short *histogram) const |
Unpack special histogramming mode data. | |
bool | wasMarkAndPassZS (int fiber, int fiberchan) const |
Was this channel passed as part of Mark&Pass ZS? | |
~CastorCORData () | |
Static Public Attributes | |
static const int | CHANNELS_PER_SPIGOT = 36 |
static const int | MAXIMUM_SAMPLES_PER_CHANNEL = 20 |
Protected Member Functions | |
void | determineSectionLengths (int &tpWords, int &daqWords, int &headerWords, int &trailerWords, int &triggerWords) const |
Was there an error on the given fiber for this event (only in histogram mode!) | |
void | determineStaticLengths (int &headerWords, int &trailerWords, int &triggerWords) const |
Protected Attributes | |
int | m_formatVersion |
unsigned short * | m_ownData |
const unsigned short * | m_rawConst |
int | m_rawLength |
unsigned short * | m_unpackedData |
Interpretive class for CastorCORDat 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 16 of file CastorCORData.h.
CastorCORData::CastorCORData | ( | ) |
Definition at line 22 of file CastorCORData.cc.
: m_formatVersion(-2), m_rawLength(0), m_rawConst(0), m_ownData(0) { }
CastorCORData::~CastorCORData | ( | ) | [inline] |
Definition at line 22 of file CastorCORData.h.
References m_ownData.
CastorCORData::CastorCORData | ( | int | version_to_create | ) |
Definition at line 29 of file CastorCORData.cc.
References allocate().
: m_formatVersion(version_to_create) { allocate(version_to_create); }
CastorCORData::CastorCORData | ( | const unsigned short * | data, |
int | length | ||
) |
Definition at line 23 of file CastorCORData.cc.
References adoptData(), and m_ownData.
CastorCORData::CastorCORData | ( | const CastorCORData & | hd | ) |
Definition at line 27 of file CastorCORData.cc.
: m_formatVersion(hd.m_formatVersion), m_rawLength(hd.m_rawLength), m_rawConst(hd.m_rawConst), m_ownData(0) { }
void CastorCORData::adoptData | ( | const unsigned short * | data, |
int | length | ||
) |
Definition at line 52 of file CastorCORData.cc.
References runTheMatrix::data, m_formatVersion, m_rawConst, and m_rawLength.
Referenced by CastorCORData(), and CastorCTDCHeader::getSpigotData().
{ m_rawLength=length; m_rawConst=data; if (m_rawLength<5) { m_formatVersion=-2; // invalid! } else { m_formatVersion=(m_rawConst[4]>>12)&0xF; } }
void CastorCORData::allocate | ( | int | version_to_create = 0 | ) |
Definition at line 33 of file CastorCORData.cc.
References m_formatVersion, m_ownData, m_rawConst, and m_rawLength.
Referenced by CastorCORData(), and CastorCtdcPacker::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]; m_rawLength=0; m_rawConst=m_ownData; }
bool CastorCORData::check | ( | ) | const |
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event.
Definition at line 65 of file CastorCORData.cc.
References determineSectionLengths(), m_rawConst, and m_rawLength.
Referenced by CastorCtdcUnpacker::unpack().
{ // length checks // minimum length if (m_rawLength<6+12) return false; // matches wordcount if (m_rawLength!=m_rawConst[m_rawLength-3]) return false; // daq/tp length check int tp, daq, header, trailer, trigger; determineSectionLengths(tp,daq,header,trailer,trigger); if (trigger+daq+header+trailer>m_rawLength) return false; return true; }
void CastorCORData::determineSectionLengths | ( | int & | tpWords, |
int & | daqWords, | ||
int & | headerWords, | ||
int & | trailerWords, | ||
int & | triggerWords | ||
) | const [protected] |
Was there an error on the given fiber for this event (only in histogram mode!)
Definition at line 80 of file CastorCORData.cc.
References m_rawConst, and m_rawLength.
Referenced by check(), and unpack().
{ tpWords=m_rawConst[5]>>8; // should be 8 but could be up to 12 if (m_rawLength>4) daqWords=m_rawConst[m_rawLength-4]&0x7FF; // no zero suppression supported // there are 24 16bit words per time sample // these contain the data from 36 channels // daqWords is number of 16 bit words of qie data // hence #qie data values id daqWords*3/2 headerWords=8; triggerLen=12; // total space reserved for trigger information trailerWords=12; // minimum, may be more... }
void CastorCORData::determineStaticLengths | ( | int & | headerWords, |
int & | trailerWords, | ||
int & | triggerWords | ||
) | const [protected] |
Definition at line 94 of file CastorCORData.cc.
Referenced by pack().
{ headerWords=8; triggerLen=12; // total space reserved for trigger information trailerWords=12; // minimum, may be more... }
unsigned int CastorCORData::getBunchNumber | ( | ) | const [inline] |
Get the HTR bunch number.
Definition at line 96 of file CastorCORData.h.
References m_rawConst.
{ return (m_rawConst[4]&0xFFF); }
unsigned int CastorCORData::getDLLunlock | ( | ) | const [inline] |
Get DLLunlock bits.
Definition at line 145 of file CastorCORData.h.
References m_rawConst.
{ return (m_rawConst[5]>>2)&0x3; }
unsigned int CastorCORData::getErrorsWord | ( | ) | const [inline] |
Get the errors word.
Definition at line 132 of file CastorCORData.h.
References m_rawConst.
Referenced by CastorCTDCHeader::copySpigotData().
{ return m_rawConst[2]&0xFFFF; }
unsigned int CastorCORData::getExtHdr1 | ( | ) | const [inline] |
Get the COR Ext Header words.
Definition at line 187 of file CastorCORData.h.
References m_rawConst.
{ return (m_rawConst[0]);}
unsigned int CastorCORData::getExtHdr2 | ( | ) | const [inline] |
unsigned int CastorCORData::getExtHdr3 | ( | ) | const [inline] |
unsigned int CastorCORData::getExtHdr4 | ( | ) | const [inline] |
unsigned int CastorCORData::getExtHdr5 | ( | ) | const [inline] |
unsigned int CastorCORData::getExtHdr6 | ( | ) | const [inline] |
unsigned int CastorCORData::getExtHdr7 | ( | ) | const [inline] |
unsigned int CastorCORData::getExtHdr8 | ( | ) | const [inline] |
unsigned int CastorCORData::getFib1OrbMsgBCN | ( | ) | const [inline] |
Get the BCN of the Fiber Orbit Messages.
Definition at line 153 of file CastorCORData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-12]&0xFFF); }
unsigned int CastorCORData::getFib2OrbMsgBCN | ( | ) | const [inline] |
Definition at line 156 of file CastorCORData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-11]&0xFFF); }
unsigned int CastorCORData::getFib3OrbMsgBCN | ( | ) | const [inline] |
Definition at line 160 of file CastorCORData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-10]&0xFFF); }
unsigned int CastorCORData::getFib4OrbMsgBCN | ( | ) | const [inline] |
Definition at line 164 of file CastorCORData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-9]&0xFFF); }
unsigned int CastorCORData::getFib5OrbMsgBCN | ( | ) | const [inline] |
Definition at line 168 of file CastorCORData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-8]&0xFFF); }
unsigned int CastorCORData::getFib6OrbMsgBCN | ( | ) | const [inline] |
Definition at line 172 of file CastorCORData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-7]&0xFFF); }
unsigned int CastorCORData::getFib7OrbMsgBCN | ( | ) | const [inline] |
Definition at line 176 of file CastorCORData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-6]&0xFFF); }
unsigned int CastorCORData::getFib8OrbMsgBCN | ( | ) | const [inline] |
Definition at line 180 of file CastorCORData.h.
References m_formatVersion, m_rawConst, and m_rawLength.
{ return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-5]&0xFFF); }
unsigned int CastorCORData::getFirmwareRevision | ( | ) | const |
Get the COR firmware version.
Definition at line 314 of file CastorCORData.cc.
References m_rawConst.
{ return (m_rawConst[6]); }
int CastorCORData::getFormatVersion | ( | ) | const [inline] |
Get the version number of this event.
Definition at line 32 of file CastorCORData.h.
References m_formatVersion.
{ return m_formatVersion; }
void CastorCORData::getHistogramFibers | ( | int & | a, |
int & | b | ||
) | const |
Get the fiber numbers for the data present in this event (only in histogram mode!)
Definition at line 318 of file CastorCORData.cc.
References m_formatVersion, and m_rawConst.
Referenced by 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 CastorCORData::getL1ANumber | ( | ) | const [inline] |
Get the HTR event number.
Definition at line 92 of file CastorCORData.h.
References m_rawConst.
{ return (m_rawConst[0]&0xFF)+(m_rawConst[1]<<8); }
int CastorCORData::getNDD | ( | ) | const |
Get the number of daq data samples per channel when not zero-suppressed.
Definition at line 296 of file CastorCORData.cc.
References m_formatVersion, m_rawConst, and m_rawLength.
{ return (m_formatVersion==-1)?(m_rawConst[m_rawLength-4]>>8):(m_rawConst[m_rawLength-4]>>11); }
int CastorCORData::getNPrecisionWords | ( | ) | const |
Get the total number of precision data 16-bit words.
Definition at line 305 of file CastorCORData.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 CastorCORData::getNPS | ( | ) | const |
Get the number of presamples in daq data.
Definition at line 308 of file CastorCORData.cc.
References m_formatVersion, and m_rawConst.
Referenced by CastorCtdcUnpacker::unpack().
{ return (m_formatVersion==-1)?(0):((m_rawConst[5]>>4)&0xF); }
int CastorCORData::getNTP | ( | ) | const |
Get the number of trigger data samples when not zero-suppressed (not available after FW 4)
Definition at line 299 of file CastorCORData.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 CastorCORData::getOrbitNumber | ( | ) | const |
Get the HTR orbit number.
Definition at line 258 of file CastorCORData.cc.
References m_rawConst.
{ return (m_rawConst[3]>>11); }
unsigned int CastorCORData::getPipelineLength | ( | ) | const |
Get the pipeline length used for this event.
Definition at line 311 of file CastorCORData.cc.
References m_rawConst.
{ return (m_rawConst[7]&0xFF); }
const unsigned short* CastorCORData::getRawData | ( | ) | const [inline] |
Get a pointer to the raw data.
Definition at line 35 of file CastorCORData.h.
References m_rawConst.
Referenced by CastorCTDCHeader::copySpigotData().
{ return m_rawConst; }
const int CastorCORData::getRawLength | ( | ) | const [inline] |
Get the length of the raw data.
Definition at line 38 of file CastorCORData.h.
References m_rawLength.
Referenced by CastorCTDCHeader::copySpigotData(), and CastorCtdcPacker::pack().
{ return m_rawLength; }
unsigned int CastorCORData::getSubmodule | ( | ) | const |
Get the HTR submodule number.
Definition at line 261 of file CastorCORData.cc.
References m_rawConst.
Referenced by htrSlot(), htrTopBottom(), and readoutVMECrateId().
{ return (m_rawConst[3]&0x7FF); }
unsigned int CastorCORData::getTTCready | ( | ) | const [inline] |
Get TTCready bits.
Definition at line 149 of file CastorCORData.h.
References m_rawConst.
{ return m_rawConst[5]&0x3; }
unsigned int CastorCORData::htrSlot | ( | ) | const |
HcalElectronicsId-style HTR slot.
Definition at line 264 of file CastorCORData.cc.
References getSubmodule().
{ const unsigned int smid = getSubmodule(); return ((smid>>1)&0x1F); }
unsigned int CastorCORData::htrTopBottom | ( | ) | const |
HcalElectronicsId-style HTR top/bottom (1=top/0=bottom)
Definition at line 268 of file CastorCORData.cc.
References getSubmodule().
{ const unsigned int smid = getSubmodule(); return (smid&0x01); }
bool CastorCORData::isCalibrationStream | ( | ) | const |
Is this event a calibration-stream event?
Definition at line 276 of file CastorCORData.cc.
References m_formatVersion, and m_rawConst.
{ return (m_formatVersion==-1)?(false):(m_rawConst[2]&0x4000); }
bool CastorCORData::isHistogramEvent | ( | ) | const |
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition at line 293 of file CastorCORData.cc.
References m_formatVersion, and m_rawConst.
Referenced by CastorCtdcUnpacker::unpack(), and unpackHistogram().
{ return (m_formatVersion==-1)?(m_rawConst[2]&0x2):(m_rawConst[2]&0x2000); }
bool CastorCORData::isPatternRAMEvent | ( | ) | const |
Is this event a pattern-ram event?
Definition at line 290 of file CastorCORData.cc.
References m_formatVersion, and m_rawConst.
{ return (m_formatVersion==-1)?(false):(m_rawConst[2]&0x1000); }
bool CastorCORData::isUnsuppressed | ( | ) | const |
Is this event an unsuppresed event?
Definition at line 279 of file CastorCORData.cc.
References m_formatVersion, and m_rawConst.
Referenced by wasMarkAndPassZS().
{ return (m_formatVersion<4)?(false):(m_rawConst[6]&0x8000); }
CastorCORData & CastorCORData::operator= | ( | const CastorCORData & | hd | ) |
Definition at line 43 of file CastorCORData.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 CastorCORData::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 153 of file CastorCORData.cc.
References determineStaticLengths(), j, m_ownData, m_rawLength, MAXIMUM_SAMPLES_PER_CHANNEL, min, and indexGen::s2.
Referenced by CastorCtdcPacker::pack().
{ int tp_words_total=0, daq_words_total=0, headerLen, trailerLen, triggerLen; determineStaticLengths(headerLen,trailerLen,triggerLen); tp_words_total=0; daq_words_total=0; int isample; // trigger words unsigned short* ptr=m_ownData+headerLen; if (tp_samples!=0 && tp_lengths!=0) { for (isample=0; isample<tp_lengths[0] && isample<12; isample++) { ptr[tp_words_total]=tp_samples[isample]; tp_words_total++; } } // daq words ptr=m_ownData+headerLen+triggerLen; int timesamples = std::min (daq_lengths[0]&0x3f,MAXIMUM_SAMPLES_PER_CHANNEL) ; int ts, capid, j; unsigned long dat; unsigned short s1,s2,s3; bool somevalid; for (ts=0; ts<timesamples; ts++){ capid = ts%4; for (j=0; j<12 ; j++) { somevalid = false; if ( daq_lengths[j*3] == 0 || ( daq_lengths[j*3] & 0xc0 ) ) { s1 = 0x400; // ER !DV } else { s1 = daq_samples[(j*3 )*MAXIMUM_SAMPLES_PER_CHANNEL+ts]; somevalid = true; } if ( daq_lengths[j*3+1] == 0 || ( daq_lengths[j*3+1] & 0xc0 ) ) { s2 = 0x400; // ER !DV } else { s2 = daq_samples[(j*3+1)*MAXIMUM_SAMPLES_PER_CHANNEL+ts]; somevalid = true; } if ( daq_lengths[j*3+2] == 0 || ( daq_lengths[j*3+2] & 0xc0 ) ) { s3 = 0x400; // ER !DV } else { s3 = daq_samples[(j*3+2)*MAXIMUM_SAMPLES_PER_CHANNEL+ts]; somevalid = true; } //dat = 0x80000001 // msb is dv for the fibre //| ( daq_samples[(j*3 )*MAXIMUM_SAMPLES_PER_CHANNEL+ts] & 0x1ff ) << 21 //| ( daq_samples[(j*3+1)*MAXIMUM_SAMPLES_PER_CHANNEL+ts] & 0x1ff ) << 11 //| ( daq_samples[(j*3+2)*MAXIMUM_SAMPLES_PER_CHANNEL+ts] & 0x1ff ) << 1 //| ( daq_samples[(j*3 )*MAXIMUM_SAMPLES_PER_CHANNEL+ts] & 0x400 ) << 20 //| ( daq_samples[(j*3+1)*MAXIMUM_SAMPLES_PER_CHANNEL+ts] & 0x400 ) << 10 //| ( daq_samples[(j*3+2)*MAXIMUM_SAMPLES_PER_CHANNEL+ts] & 0x400 ) ; dat = 0x00000001 // msb is dv for the fibre // sample data is ER(1)+CAPID(2)+EXP(2)+Mantissa(5) // daq_samples has ER(1)+DV(1)+CAPID(2)+EXP(2)+Mantissa(5) // should check daq_lengths for the 3 channels here ?? | ( s1 & 0x1ff ) << 21 | ( s2 & 0x1ff ) << 11 | ( s3 & 0x1ff ) << 1 | ( s1 & 0x400 ) << 20 | ( s2 & 0x400 ) << 10 | ( s3 & 0x400 ) ; if ( somevalid ) dat |= 0x80000000; // should we set dv from daq_samples ?? if (do_capid) dat = ( dat & 0xcff3fcff ) | capid << 28 | capid << 18 | capid << 8; ptr[daq_words_total++] = dat >> 16; ptr[daq_words_total++] = dat & 0xffff; } } m_ownData[5]=(tp_words_total<<8)|0x1; unsigned short totalLen=headerLen+12+daq_words_total+trailerLen; m_rawLength=totalLen; m_ownData[totalLen-2]=totalLen/2; // 32-bit words m_ownData[totalLen-3]=totalLen; m_ownData[totalLen-4]=daq_words_total; }
void CastorCORData::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 241 of file CastorCORData.cc.
References m_formatVersion, m_ownData, and m_rawLength.
Referenced by CastorCtdcPacker::pack().
{ m_ownData[0]=L1Anumber&0xFF; m_ownData[1]=(L1Anumber&0xFFFF00)>>8; m_ownData[2]=0x8000; // Version is valid, no error bits - status bits need definition m_ownData[3]=((orbitn&0x1F)<<11)|(submodule&0x7FF); m_ownData[4]=((m_formatVersion&0xF)<<12)|(bcn&0xFFF); m_ownData[5]|=((nps&0xF)<<4)|0x1; m_ownData[6]=((firmwareRev&0x70000)>>3)|(firmwareRev&0x1FFF); m_ownData[7]=(pipeline&0xFF) | ((ndd&0x1F)<<8); 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; }
unsigned int CastorCORData::readoutVMECrateId | ( | ) | const |
HcalElectronicsId-style VME crate number.
Definition at line 272 of file CastorCORData.cc.
References getSubmodule().
{ const unsigned int smid = getSubmodule(); return ((smid>>6)&0x1F); }
void CastorCORData::unpack | ( | unsigned char * | daq_lengths, |
unsigned short * | daq_samples, | ||
unsigned char * | tp_lengths, | ||
unsigned short * | tp_samples | ||
) | 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 dataUnpack 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 102 of file CastorCORData.cc.
References CHANNELS_PER_SPIGOT, determineSectionLengths(), j, m_rawConst, and MAXIMUM_SAMPLES_PER_CHANNEL.
Referenced by CastorCtdcUnpacker::unpack().
{ if (daq_lengths!=0) memset(daq_lengths,0,CHANNELS_PER_SPIGOT); if (tp_lengths!=0) memset(tp_lengths,0,1); int tp_words_total, daq_words_total, headerLen, trailerLen, triggerLen; determineSectionLengths(tp_words_total,daq_words_total,headerLen,trailerLen,triggerLen); 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++) { tp_samples[tp_lengths[0]]=tpBase[wordPtr]; tp_lengths[0]++; } } const unsigned short* daqBase=m_rawConst+headerLen+triggerLen; unsigned long dat; // process the DAQ words int lastCapid=0; int ts,dv; int tsamples = daq_words_total/24; if (daq_lengths!=0) { for ( ts = 0; ts < tsamples; ts++ ) { for (int j=0; j<12 ; j++) { dat = daqBase[(ts*12+j)*2]<<16 | daqBase[(ts*12+j)*2+1]; dv = ( dat & 0x80000000 ) >> 31; daq_samples[(j*3) *MAXIMUM_SAMPLES_PER_CHANNEL+ts]= (( dat & 0x40000000 ) >> 20 ) | (( dat & 0x3fe00000 ) >> 21 ) | ( dv << 9 ); daq_samples[(j*3+1)*MAXIMUM_SAMPLES_PER_CHANNEL+ts]= (( dat & 0x00100000 ) >> 10 ) | (( dat & 0x000ff800 ) >> 11 ) | ( dv << 9 ); daq_samples[(j*3+2)*MAXIMUM_SAMPLES_PER_CHANNEL+ts]= (( dat & 0x00000400 ) ) | (( dat & 0x000003fe ) >> 1 ) | ( dv << 9 ); } } // now loop over channels - set daq_lengths with error bits int ichan; for ( ichan = 0; ichan<CHANNELS_PER_SPIGOT; ichan++) { daq_lengths[ichan]=tsamples; for ( ts = 0; ts < tsamples; ts++ ) { int erdv =(daq_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+ts] & 0x600 ) >> 9; int capid=(daq_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+ts] & 0x180 ) >> 7; if ( erdv!=1 || ( ts!=0 && (capid!=((lastCapid+1)%4)))) { daq_lengths[ichan]|=0x80; } lastCapid=capid; } } } }
bool CastorCORData::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 330 of file CastorCORData.cc.
References getHistogramFibers(), i, isHistogramEvent(), m_formatVersion, m_rawConst, and evf::evtn::offset().
{ // 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 CastorCORData::wasMarkAndPassZS | ( | int | fiber, |
int | fiberchan | ||
) | const |
Was this channel passed as part of Mark&Pass ZS?
Definition at line 282 of file CastorCORData.cc.
References isUnsuppressed(), m_formatVersion, m_rawConst, m_rawLength, and edm::shift.
{ if (fiber<1 || fiber>8 || fiberchan<0 || fiberchan>2) return false; if (!isUnsuppressed() || m_formatVersion<5) return false; unsigned short val=(fiber<5)?(m_rawConst[m_rawLength-12]):(m_rawConst[m_rawLength-11]); int shift=(((fiber-1)%4)*3)+fiberchan; return ((val>>shift)&0x1)!=0; }
const int CastorCORData::CHANNELS_PER_SPIGOT = 36 [static] |
Definition at line 18 of file CastorCORData.h.
Referenced by CastorCtdcPacker::pack(), unpack(), and CastorCtdcUnpacker::unpack().
int CastorCORData::m_formatVersion [protected] |
Definition at line 222 of file CastorCORData.h.
Referenced by adoptData(), allocate(), getFib1OrbMsgBCN(), getFib2OrbMsgBCN(), getFib3OrbMsgBCN(), getFib4OrbMsgBCN(), getFib5OrbMsgBCN(), getFib6OrbMsgBCN(), getFib7OrbMsgBCN(), getFib8OrbMsgBCN(), getFormatVersion(), getHistogramFibers(), getNDD(), getNPrecisionWords(), getNPS(), getNTP(), isCalibrationStream(), isHistogramEvent(), isPatternRAMEvent(), isUnsuppressed(), operator=(), packHeaderTrailer(), unpackHistogram(), and wasMarkAndPassZS().
unsigned short* CastorCORData::m_ownData [protected] |
Definition at line 225 of file CastorCORData.h.
Referenced by allocate(), CastorCORData(), operator=(), pack(), packHeaderTrailer(), and ~CastorCORData().
const unsigned short* CastorCORData::m_rawConst [protected] |
Definition at line 224 of file CastorCORData.h.
Referenced by adoptData(), allocate(), check(), determineSectionLengths(), getBunchNumber(), getDLLunlock(), getErrorsWord(), getExtHdr1(), getExtHdr2(), getExtHdr3(), getExtHdr4(), getExtHdr5(), getExtHdr6(), getExtHdr7(), getExtHdr8(), getFib1OrbMsgBCN(), getFib2OrbMsgBCN(), getFib3OrbMsgBCN(), getFib4OrbMsgBCN(), getFib5OrbMsgBCN(), getFib6OrbMsgBCN(), getFib7OrbMsgBCN(), getFib8OrbMsgBCN(), getFirmwareRevision(), getHistogramFibers(), getL1ANumber(), getNDD(), getNPrecisionWords(), getNPS(), getNTP(), getOrbitNumber(), getPipelineLength(), getRawData(), getSubmodule(), getTTCready(), isCalibrationStream(), isHistogramEvent(), isPatternRAMEvent(), isUnsuppressed(), operator=(), unpack(), unpackHistogram(), and wasMarkAndPassZS().
int CastorCORData::m_rawLength [protected] |
Definition at line 223 of file CastorCORData.h.
Referenced by adoptData(), allocate(), check(), determineSectionLengths(), getFib1OrbMsgBCN(), getFib2OrbMsgBCN(), getFib3OrbMsgBCN(), getFib4OrbMsgBCN(), getFib5OrbMsgBCN(), getFib6OrbMsgBCN(), getFib7OrbMsgBCN(), getFib8OrbMsgBCN(), getNDD(), getNPrecisionWords(), getNTP(), getRawLength(), operator=(), pack(), packHeaderTrailer(), and wasMarkAndPassZS().
unsigned short* CastorCORData::m_unpackedData [protected] |
Definition at line 226 of file CastorCORData.h.
const int CastorCORData::MAXIMUM_SAMPLES_PER_CHANNEL = 20 [static] |
Definition at line 19 of file CastorCORData.h.
Referenced by CastorCtdcPacker::pack(), pack(), unpack(), and CastorCtdcUnpacker::unpack().