CMS 3D CMS Logo

HcalHTRData Class Reference

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. More...

#include <EventFilter/HcalRawToDigi/interface/HcalHTRData.h>

Inheritance diagram for HcalHTRData:

HcalTTPData

List of all members.

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)
 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
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 (int version_to_create)
 HcalHTRData ()
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?
HcalHTRDataoperator= (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)
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?
 ~HcalHTRData ()

Static Public Attributes

static const int CHANNELS_PER_SPIGOT = 24
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


Detailed Description

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.

Date
2008/10/24 12:50:58
Revision
1.12
Author:
J. Mans - UMD

Definition at line 16 of file HcalHTRData.h.


Constructor & Destructor Documentation

HcalHTRData::HcalHTRData (  ) 

Definition at line 16 of file HcalHTRData.cc.

HcalHTRData::~HcalHTRData (  )  [inline]

Definition at line 22 of file HcalHTRData.h.

References m_ownData.

00022 { if (m_ownData!=0) delete [] m_ownData; }

HcalHTRData::HcalHTRData ( int  version_to_create  ) 

Definition at line 23 of file HcalHTRData.cc.

References allocate().

00024                                               : m_formatVersion(version_to_create) {
00025   allocate(version_to_create);

HcalHTRData::HcalHTRData ( const unsigned short *  data,
int  length 
)

Definition at line 17 of file HcalHTRData.cc.

00017                          : m_formatVersion(-2), m_rawLength(0), m_rawConst(0), m_ownData(0) { }
00018 HcalHTRData::HcalHTRData(const unsigned short* data, int length) {
00019   adoptData(data,length);
00020   m_ownData=0;

HcalHTRData::HcalHTRData ( const HcalHTRData hd  ) 

Definition at line 21 of file HcalHTRData.cc.


Member Function Documentation

void HcalHTRData::adoptData ( const unsigned short *  data,
int  length 
)

Definition at line 46 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDCCHeader::getSpigotData().

00047                                                                   {
00048   m_rawLength=length;
00049   m_rawConst=data;
00050   if (m_rawLength<5) {
00051     m_formatVersion=-2; // invalid!
00052   } else {
00053     // determine format version
00054     if ((m_rawConst[2]&0x8000)==0) m_formatVersion=-1; // original format before versions
00055     else m_formatVersion=(m_rawConst[4]>>12)&0xF;
00056   }

void HcalHTRData::allocate ( int  version_to_create = 0  ) 

Definition at line 27 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, m_rawConst, and m_rawLength.

Referenced by HcalHTRData(), HcalPacker::pack(), and CastorPacker::pack().

00028                                                 {
00029   m_formatVersion=version_to_create;
00030   // the needed space is for the biggest possible event...
00031   const int needed=0x200;
00032   // create a buffer big enough...
00033   m_ownData=new unsigned short[needed];
00034   m_rawLength=0;
00035   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.

Reimplemented in HcalTTPData.

Definition at line 61 of file HcalHTRData.cc.

References determineSectionLengths(), header, isHistogramEvent(), m_formatVersion, m_rawConst, m_rawLength, and tp.

Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalDataFormatMonitor::unpack(), CastorUnpacker::unpack(), and HcalUnpacker::unpack().

00062                               {
00063   if (m_formatVersion==-1) {
00064     // length checks
00065     //  minimum length
00066     if (m_rawLength<6+12) return false;
00067     //  matches wordcount
00068     if (m_rawLength!=m_rawConst[m_rawLength-3]) return false;
00069     // empty event check
00070     if (m_rawConst[2]&0x20) return false;
00071   } else {
00072     // length checks
00073     //  minimum length
00074     if (m_rawLength<8+4) return false;
00075     if (m_formatVersion<=3) {
00076       //  matches wordcount
00077       if (m_rawLength!=m_rawConst[m_rawLength-3]) {
00078         if (isHistogramEvent() && m_rawConst[m_rawLength-3]==786) {
00079           // known bug!
00080         } else
00081           return false;
00082       }
00083     } else { 
00084       // eventually add CRC check
00085     }
00086     // empty event check (redundant...)
00087     if (m_rawConst[2]&0x4) return false;
00088   }
00089 
00090   if (!isHistogramEvent()) {
00091     // daq/tp length check
00092     int tp, daq, header, trailer;
00093     determineSectionLengths(tp,daq,header,trailer);
00094     if (tp+daq+header+trailer>m_rawLength) return false;
00095   }
00096 
00097   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 
)

Obtain the starting and ending pointers for external unpacking of the data.

Parameters:
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 124 of file HcalHTRData.cc.

References determineSectionLengths(), and m_rawConst.

Referenced by HcalDataFormatMonitor::unpack(), CastorUnpacker::unpack(), and HcalUnpacker::unpack().

00128                                                                {
00129   int tp_words_total, daq_words_total, headerLen, trailerLen;
00130   determineSectionLengths(tp_words_total,daq_words_total,headerLen,trailerLen);
00131 
00132   *tp_first=m_rawConst+headerLen;
00133   *tp_last=*tp_first+(tp_words_total-1);
00134   *daq_first=*tp_last+1;
00135   *daq_last=*daq_first+(daq_words_total-1);

void HcalHTRData::determineSectionLengths ( int tpWords,
int daqWords,
int headerWords,
int trailerWords 
) const [protected]

Definition at line 99 of file HcalHTRData.cc.

References CHANNELS_PER_SPIGOT, m_formatVersion, m_rawConst, and m_rawLength.

Referenced by check(), dataPointers(), and unpack().

00100                                                                                                                 {
00101   if (m_formatVersion==-1) {
00102     tpWords=m_rawConst[5]>>8;
00103     daqWords=CHANNELS_PER_SPIGOT*(m_rawConst[m_rawLength-4]>>8); // always 24 channels, no zero suppresion
00104     headerWords=6;
00105     trailerWords=12;
00106   } else {
00107     tpWords=m_rawConst[5]>>8;
00108     if (m_rawLength>4) 
00109       daqWords=m_rawConst[m_rawLength-4]&0x7FF; // zero suppression supported
00110     headerWords=8;
00111     trailerWords=4; // minimum, may be more...
00112   }

void HcalHTRData::determineStaticLengths ( int headerWords,
int trailerWords 
) const [protected]

Definition at line 114 of file HcalHTRData.cc.

References m_formatVersion.

Referenced by pack().

00115                                                                                   {
00116   if (m_formatVersion==-1) {
00117     headerWords=6;
00118     trailerWords=12;
00119   } else {
00120     headerWords=8;
00121     trailerWords=4; // minimum, may be more...
00122   }

unsigned int HcalHTRData::getBunchNumber (  )  const [inline]

Get the HTR bunch number.

Definition at line 96 of file HcalHTRData.h.

References m_rawConst.

Referenced by HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00096                                              { 
00097     return (m_rawConst[4]&0xFFF); 
00098   }

unsigned int HcalHTRData::getDLLunlock (  )  const [inline]

Get DLLunlock bits.

Definition at line 147 of file HcalHTRData.h.

References m_rawConst.

00147                                            { 
00148     return (m_rawConst[5]>>1)&0x3; }

unsigned int HcalHTRData::getErrorsWord (  )  const [inline]

Get the errors word.

Definition at line 134 of file HcalHTRData.h.

References m_rawConst.

Referenced by HcalDCCHeader::copySpigotData(), HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00134                                             { 
00135     return m_rawConst[2]&0xFFFF; }

unsigned int HcalHTRData::getExtHdr1 (  )  const [inline]

Get the HTR Ext Header words.

Definition at line 189 of file HcalHTRData.h.

References m_rawConst.

00189                                          { 
00190     return (m_rawConst[0]);}

unsigned int HcalHTRData::getExtHdr2 (  )  const [inline]

Definition at line 191 of file HcalHTRData.h.

References m_rawConst.

00191                                          { 
00192     return (m_rawConst[1]); }

unsigned int HcalHTRData::getExtHdr3 (  )  const [inline]

Definition at line 193 of file HcalHTRData.h.

References m_rawConst.

00193                                          { 
00194     return (m_rawConst[2]);} 

unsigned int HcalHTRData::getExtHdr4 (  )  const [inline]

Definition at line 195 of file HcalHTRData.h.

References m_rawConst.

00195                                          { 
00196     return (m_rawConst[3]); }

unsigned int HcalHTRData::getExtHdr5 (  )  const [inline]

Definition at line 197 of file HcalHTRData.h.

References m_rawConst.

00197                                          { 
00198     return (m_rawConst[4]);} 

unsigned int HcalHTRData::getExtHdr6 (  )  const [inline]

Definition at line 199 of file HcalHTRData.h.

References m_rawConst.

Referenced by HcalDataFormatMonitor::unpack(), and HcalEEUSMonitor::unpack().

00199                                          { 
00200     return (m_rawConst[5]);} 

unsigned int HcalHTRData::getExtHdr7 (  )  const [inline]

Definition at line 201 of file HcalHTRData.h.

References m_rawConst.

00201                                          { 
00202     return (m_rawConst[6]);} 

unsigned int HcalHTRData::getExtHdr8 (  )  const [inline]

Definition at line 203 of file HcalHTRData.h.

References m_rawConst.

00203                                          { 
00204     return (m_rawConst[7]);}  

unsigned int HcalHTRData::getFib1OrbMsgBCN (  )  const [inline]

Get the BCN of the Fiber Orbit Messages.

Definition at line 155 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00155                                                {
00156   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-12]&0xFFF);
00157 }

unsigned int HcalHTRData::getFib2OrbMsgBCN (  )  const [inline]

Definition at line 158 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00158                                                {
00159   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-11]&0xFFF);
00160 }

unsigned int HcalHTRData::getFib3OrbMsgBCN (  )  const [inline]

Definition at line 162 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00162                                                {
00163   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-10]&0xFFF);
00164 }

unsigned int HcalHTRData::getFib4OrbMsgBCN (  )  const [inline]

Definition at line 166 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00166                                                {
00167   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-9]&0xFFF);
00168 }

unsigned int HcalHTRData::getFib5OrbMsgBCN (  )  const [inline]

Definition at line 170 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00170                                                {
00171   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-8]&0xFFF);
00172 }

unsigned int HcalHTRData::getFib6OrbMsgBCN (  )  const [inline]

Definition at line 174 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00174                                                {
00175   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-7]&0xFFF);
00176 }

unsigned int HcalHTRData::getFib7OrbMsgBCN (  )  const [inline]

Definition at line 178 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00178                                                {
00179   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-6]&0xFFF);
00180 }

unsigned int HcalHTRData::getFib8OrbMsgBCN (  )  const [inline]

Definition at line 182 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00182                                                {
00183   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-5]&0xFFF);
00184 }

int HcalHTRData::getFirmwareFlavor (  )  const

Get the HTR firmware flavor.

Definition at line 342 of file HcalHTRData.cc.

Referenced by HcalUnpacker::unpack().

00343                                          {
00344   return (m_formatVersion<2)?(-1):((m_rawConst[7]>>8)&0xFF);

unsigned int HcalHTRData::getFirmwareRevision (  )  const

Get the HTR firmware version.

Definition at line 339 of file HcalHTRData.cc.

Referenced by HcalDataFormatMonitor::unpack().

00340                                                     {
00341   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 32 of file HcalHTRData.h.

References m_formatVersion.

Referenced by HcalUnpacker::unpack().

00032 { 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 346 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by HcalUnpacker::unpack(), and unpackHistogram().

00347                                                          {
00348   a=-1;
00349   b=-1;
00350   if (m_formatVersion==-1) {
00351     a=((m_rawConst[2]&0x0F00)>>8);
00352     b=((m_rawConst[2]&0xF000)>>12);
00353   } else {
00354     a=((m_rawConst[5]&0x0F00)>>8);
00355     b=((m_rawConst[5]&0xF000)>>12);
00356   }

unsigned int HcalHTRData::getL1ANumber (  )  const [inline]

Get the HTR event number.

Definition at line 92 of file HcalHTRData.h.

References m_rawConst.

Referenced by HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00092                                            { 
00093     return (m_rawConst[0]&0xFF)+(m_rawConst[1]<<8); 
00094   }

int HcalHTRData::getNDD (  )  const

Get the number of daq data samples per channel when not zero-suppressed.

Definition at line 321 of file HcalHTRData.cc.

Referenced by HcalDataFormatMonitor::unpack().

00322                               {
00323   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 330 of file HcalHTRData.cc.

00331                                           {
00332   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 333 of file HcalHTRData.cc.

Referenced by CastorUnpacker::unpack(), and HcalUnpacker::unpack().

00334                               {
00335   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 324 of file HcalHTRData.cc.

00325                               {
00326   int retval=-1;
00327   if (m_formatVersion==-1) retval=m_rawConst[m_rawLength-4]&0xFF;
00328   else if (m_formatVersion<3) retval=m_rawConst[m_rawLength-4]>>11;
00329   return retval;

unsigned int HcalHTRData::getOrbitNumber (  )  const

Get the HTR orbit number.

Definition at line 275 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by HcalDataFormatMonitor::unpack().

00276                                                { 
00277   switch (m_formatVersion) {
00278   case (-1) : return (m_rawConst[3]>>8);
00279   case (0) : return (m_rawConst[3]>>10);
00280   default : return (m_rawConst[3]>>11);
00281   }

unsigned int HcalHTRData::getPipelineLength (  )  const

Get the pipeline length used for this event.

Definition at line 336 of file HcalHTRData.cc.

00337                                                   {
00338   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 35 of file HcalHTRData.h.

References m_rawConst.

Referenced by HcalDCCHeader::copySpigotData(), HcalDataFormatMonitor::unpack(), and HcalEEUSMonitor::unpack().

00035 { return m_rawConst; }

const int HcalHTRData::getRawLength (  )  const [inline]

Get the length of the raw data.

Definition at line 38 of file HcalHTRData.h.

References m_rawLength.

Referenced by HcalDCCHeader::copySpigotData(), HcalPacker::pack(), CastorPacker::pack(), HcalDataFormatMonitor::unpack(), and HcalEEUSMonitor::unpack().

00038 { return m_rawLength; }

unsigned int HcalHTRData::getSubmodule (  )  const

Get the HTR submodule number.

Definition at line 282 of file HcalHTRData.cc.

Referenced by CastorUnpacker::unpack(), and HcalUnpacker::unpack().

00283                                              {
00284   switch (m_formatVersion) {
00285   case (-1) : return (m_rawConst[3]&0xFF);
00286   case (0) : return (m_rawConst[3]&0x3FF);
00287   default : return (m_rawConst[3]&0x7FF);
00288   }

unsigned int HcalHTRData::getTTCready (  )  const [inline]

Get TTCready bit.

Definition at line 151 of file HcalHTRData.h.

References m_rawConst.

00151                                           { 
00152     return m_rawConst[5]&0x1; }

unsigned int HcalHTRData::htrSlot (  )  const

HcalElectronicsId-style HTR slot.

Definition at line 289 of file HcalHTRData.cc.

Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00290                                        {
00291   const unsigned int smid = getSubmodule();
00292   return ((smid>>1)&0x1F);

unsigned int HcalHTRData::htrTopBottom (  )  const

HcalElectronicsId-style HTR top/bottom (1=top/0=bottom).

Definition at line 293 of file HcalHTRData.cc.

Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00294                                             {
00295   const unsigned int smid = getSubmodule();
00296   return (smid&0x01);

bool HcalHTRData::isCalibrationStream (  )  const

Is this event a calibration-stream event?

Definition at line 301 of file HcalHTRData.cc.

00302                                             {
00303   return (m_formatVersion==-1)?(false):(m_rawConst[2]&0x4000);

bool HcalHTRData::isHistogramEvent (  )  const

Is this event a histogram event? (do not call standard unpack in this case!!!!!).

Definition at line 318 of file HcalHTRData.cc.

Referenced by HcalTTPData::check(), check(), HcalMonitorModule::CheckSubdetectorStatus(), HcalDataFormatMonitor::unpack(), CastorUnpacker::unpack(), HcalEEUSMonitor::unpack(), HcalUnpacker::unpack(), unpackHistogram(), and wasHistogramError().

00319                                          {
00320   return (m_formatVersion==-1)?(m_rawConst[2]&0x2):(m_rawConst[2]&0x2000);

bool HcalHTRData::isPatternRAMEvent (  )  const

Is this event a pattern-ram event?

Definition at line 315 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

00316                                           {
00317   return (m_formatVersion==-1)?(false):(m_rawConst[2]&0x1000);

bool HcalHTRData::isUnsuppressed (  )  const

Is this event an unsuppresed event?

Definition at line 304 of file HcalHTRData.cc.

00305                                        {
00306   return (m_formatVersion<4)?(false):(m_rawConst[6]&0x8000);

HcalHTRData & HcalHTRData::operator= ( const HcalHTRData hd  ) 

Definition at line 37 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, m_rawConst, and m_rawLength.

00038                                                          {
00039   if (m_ownData==0) {
00040     m_formatVersion=hd.m_formatVersion;
00041     m_rawLength=hd.m_rawLength;
00042     m_rawConst=hd.m_rawConst;
00043   }
00044   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.

Parameters:
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 195 of file HcalHTRData.cc.

References CHANNELS_PER_SPIGOT, determineStaticLengths(), m_formatVersion, m_ownData, m_rawLength, MAXIMUM_SAMPLES_PER_CHANNEL, and ptr.

Referenced by HcalPacker::pack(), and CastorPacker::pack().

00197                                                                                              {
00198   
00199   int tp_words_total=0, daq_words_total=0, headerLen, trailerLen;
00200   determineStaticLengths(headerLen,trailerLen);
00201 
00202   tp_words_total=0;
00203   daq_words_total=0;
00204   int ichan,isample;
00205 
00206   // trigger primitive words
00207   unsigned short* ptr=m_ownData+headerLen;
00208   if (tp_samples!=0 && tp_lengths!=0) {
00209     for (ichan=0; ichan<24; ichan++) {
00210       unsigned short chanid=((ichan%3)+((ichan/3)<<2))<<11;
00211       for (isample=0; isample<tp_lengths[ichan] && isample<MAXIMUM_SAMPLES_PER_CHANNEL; isample++) {
00212         ptr[tp_words_total]=chanid|(tp_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+isample]&0x3FF);
00213         tp_words_total++;
00214       }
00215     }
00216   }
00217 
00218   // daq words
00219   ptr=m_ownData+headerLen+tp_words_total;
00220   for (ichan=0; ichan<24; ichan++) {
00221     unsigned short chanid=((ichan%3)+((ichan/3)<<2))<<11;
00222     for (isample=0; isample<daq_lengths[ichan] && isample<MAXIMUM_SAMPLES_PER_CHANNEL; isample++) {
00223       unsigned short basedata=daq_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+isample]&0x3FF;
00224       if (do_capid) basedata=(basedata&0x7F)|(0x200)|((isample%4)<<7);
00225       ptr[daq_words_total]=chanid|basedata;
00226       daq_words_total++;
00227     }
00228   }
00229 
00230   if (m_formatVersion==-1) {
00231     m_ownData[5]=(tp_words_total<<8)|0x1;
00232     unsigned short totalLen=headerLen+tp_words_total+daq_words_total+trailerLen;
00233     m_rawLength=totalLen;
00234     m_ownData[totalLen-3]=totalLen;
00235     m_ownData[totalLen-4]=(tp_words_total/CHANNELS_PER_SPIGOT)|((daq_words_total/CHANNELS_PER_SPIGOT)<<8);
00236   } else {
00237     m_ownData[5]=(tp_words_total<<8)|0x1;
00238     unsigned short totalLen=headerLen+tp_words_total+daq_words_total+trailerLen;
00239     if ((totalLen%2)==1) {
00240       m_ownData[totalLen-4]=0xFFFF; // parity word
00241       totalLen++; // round to even number of 16-bit words
00242     }
00243     m_rawLength=totalLen;
00244     m_ownData[totalLen-2]=totalLen/2; // 32-bit words
00245     m_ownData[totalLen-3]=totalLen;
00246     m_ownData[totalLen-4]=daq_words_total;
00247   }
00248 

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 250 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, and m_rawLength.

Referenced by HcalPacker::pack(), and CastorPacker::pack().

00251                                                                                                                                       {
00252   m_ownData[0]=L1Anumber&0xFF;
00253   m_ownData[1]=(L1Anumber&0xFFFF00)>>8;
00254   if (m_formatVersion==-1) {
00255     m_ownData[2]=((pipeline&0x7F)<<8); // no error bits
00256     m_ownData[3]=((orbitn&0xFF)<<8)|(submodule&0xFF);
00257     m_ownData[4]=bcn&0xFFF;
00258     //    m_ownData[5]&=0xFF01;
00259   } else {
00260     m_ownData[2]=0x8000; // Version is valid, no error bits
00261     if (m_formatVersion==0) 
00262       m_ownData[3]=((orbitn&0x3F)<<10)|(submodule&0x3FF);
00263     else 
00264       m_ownData[3]=((orbitn&0x1F)<<11)|(submodule&0x7FF);
00265     m_ownData[4]=((m_formatVersion&0xF)<<12)|(bcn&0xFFF);
00266     m_ownData[5]|=((nps&0x1F)<<3)|0x1;
00267     m_ownData[6]=((firmwareRev&0x70000)>>3)|(firmwareRev&0x1FFF);
00268     m_ownData[7]=pipeline&0xFF;
00269     m_ownData[m_rawLength-4]&=0x7FF;
00270     m_ownData[m_rawLength-4]|=(ndd&0x1F)<<11;
00271   }
00272   m_ownData[m_rawLength-2]=m_rawLength/2; // 32-bit words
00273   m_ownData[m_rawLength-1]=(L1Anumber&0xFF)<<8;

unsigned int HcalHTRData::readoutVMECrateId (  )  const

HcalElectronicsId-style VME crate number.

Definition at line 297 of file HcalHTRData.cc.

Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalDataFormatMonitor::HTRPrint(), and HcalDataFormatMonitor::unpack().

00298                                                  {
00299   const unsigned int smid = getSubmodule();
00300   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.

Parameters:
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 143 of file HcalHTRData.cc.

References channelDecoder, CHANNELS_PER_SPIGOT, determineSectionLengths(), m_rawConst, and MAXIMUM_SAMPLES_PER_CHANNEL.

00145                                                                                       {
00146 
00147   if (daq_lengths!=0) memset(daq_lengths,0,CHANNELS_PER_SPIGOT);
00148   if (tp_lengths!=0) memset(tp_lengths,0,CHANNELS_PER_SPIGOT);
00149 
00150   // currently, the major differences between the versions are
00151   //  -1 : 6 word header, no zero suppression, trailer setup
00152   //   0 : 8 word header, zero suppression, 
00153 
00154   int tp_words_total, daq_words_total, headerLen, trailerLen;
00155   determineSectionLengths(tp_words_total,daq_words_total,headerLen,trailerLen);
00156 
00157   //  printf("%d %d %d %d\n",tp_words_total,daq_words_total,headerLen,trailerLen);
00158   int wordPtr;
00159   const unsigned short* tpBase=m_rawConst+headerLen;
00160   // process the trigger primitive words
00161   if (tp_lengths!=0) {
00162     for (wordPtr=0; wordPtr<tp_words_total; wordPtr++) {
00163       int ichan=channelDecoder[tpBase[wordPtr]>>11];
00164       if (ichan>=24) continue;
00165       tp_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+tp_lengths[ichan]]=tpBase[wordPtr]&0x3ff;
00166       tp_lengths[ichan]++;
00167     }
00168   }
00169  
00170   const unsigned short* daqBase=m_rawConst+headerLen+tp_words_total;
00171   // process the DAQ words [ assumes that data from one channel will always be together ]
00172   int lastChan=-1;
00173   int lastCapid=0;
00174   if (daq_lengths!=0) {
00175     for (wordPtr=0; wordPtr<daq_words_total; wordPtr++) {
00176       int ichan=channelDecoder[daqBase[wordPtr]>>11];
00177       if (ichan>=24) continue;
00178       int capid=(daqBase[wordPtr]&0x180)>>7;
00179       int erdv=(daqBase[wordPtr]&0x600)>>9;
00180       if (erdv!=0x1 || 
00181           (lastChan==ichan && (capid!=((lastCapid+1)%4)))) {
00182         daq_lengths[ichan]|=0x80;
00183       } 
00184       lastChan=ichan;
00185       lastCapid=capid;
00186 
00187       int useLength=daq_lengths[ichan]&0x1F;
00188       //     printf("%d %d\n",ichan,useLength);
00189       daq_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+useLength]=daqBase[wordPtr]&0x3ff;
00190       daq_lengths[ichan]=(useLength+1)|(daq_lengths[ichan]&0xE0); // keep the error bits
00191     }
00192   }
00193 

bool HcalHTRData::unpackHistogram ( int  fiber,
int  fiberchan,
int  capid,
unsigned short *  histogram 
) const

Unpack special histogramming mode data.

Parameters:
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 366 of file HcalHTRData.cc.

References getHistogramFibers(), i, isHistogramEvent(), m_formatVersion, m_rawConst, and offset.

Referenced by HcalUnpacker::unpack().

00367                                                                                                    {
00368   // check for histogram mode
00369   if (!isHistogramEvent()) return false;
00370 
00371   int fiber1, fiber2;
00372   getHistogramFibers(fiber1,fiber2);
00373   if (fiber1!=myfiber && fiber2!=myfiber) return false;
00374 
00375   if (m_formatVersion==-1) {
00376     int offset=6+mysc*4*32+capid*32;
00377     if (myfiber==fiber2) offset+=3*4*32; // skip to the second half...
00378     for (int i=0; i<32; i++)
00379       histogram[i]=m_rawConst[offset+i];
00380     return true;
00381   } else {
00382     int offset=8+mysc*4*32+capid*32;
00383     if (myfiber==fiber2) offset+=3*4*32; // skip to the second half...
00384     for (int i=0; i<32; i++)
00385       histogram[i]=m_rawConst[offset+i];
00386     return true;
00387   }

bool HcalHTRData::wasHistogramError ( int  ifiber  )  const

Was there an error on the given fiber for this event (only in histogram mode!).

Definition at line 358 of file HcalHTRData.cc.

References isHistogramEvent(), and m_rawConst.

00359                                                     {
00360   bool retval=!isHistogramEvent();
00361   if (!retval) {
00362     retval=((m_rawConst[7])&(1<<ifiber))!=0;
00363   }
00364   return retval;

bool HcalHTRData::wasMarkAndPassZS ( int  fiber,
int  fiberchan 
) const

Was this channel passed as part of Mark&Pass ZS?

Definition at line 307 of file HcalHTRData.cc.

00308                                                                  {
00309   if (fiber<1 || fiber>8 || fiberchan<0 || fiberchan>2) return false;
00310   if (!isUnsuppressed() || m_formatVersion<5) return false;
00311   unsigned short val=(fiber<5)?(m_rawConst[m_rawLength-12]):(m_rawConst[m_rawLength-11]);
00312   int shift=(((fiber-1)%4)*3)+fiberchan;
00313   return ((val>>shift)&0x1)!=0;


Member Data Documentation

const int HcalHTRData::CHANNELS_PER_SPIGOT = 24 [static]

Definition at line 18 of file HcalHTRData.h.

Referenced by determineSectionLengths(), HcalDataFormatMonitor::label_xChanns(), pack(), HcalPacker::pack(), CastorPacker::pack(), and unpack().

int HcalHTRData::m_formatVersion [protected]

Definition at line 224 of file HcalHTRData.h.

Referenced by adoptData(), allocate(), HcalTTPData::check(), check(), determineSectionLengths(), determineStaticLengths(), getFib1OrbMsgBCN(), getFib2OrbMsgBCN(), getFib3OrbMsgBCN(), getFib4OrbMsgBCN(), getFib5OrbMsgBCN(), getFib6OrbMsgBCN(), getFib7OrbMsgBCN(), getFib8OrbMsgBCN(), getFormatVersion(), getHistogramFibers(), getOrbitNumber(), isPatternRAMEvent(), operator=(), HcalTTPData::operator=(), pack(), packHeaderTrailer(), and unpackHistogram().

unsigned short* HcalHTRData::m_ownData [protected]

Definition at line 227 of file HcalHTRData.h.

Referenced by allocate(), operator=(), HcalTTPData::operator=(), pack(), packHeaderTrailer(), and ~HcalHTRData().

const unsigned short* HcalHTRData::m_rawConst [protected]

Definition at line 226 of file HcalHTRData.h.

Referenced by adoptData(), allocate(), HcalTTPData::check(), check(), dataPointers(), determineSectionLengths(), HcalTTPData::determineSectionLengths(), getBunchNumber(), getDLLunlock(), getErrorsWord(), getExtHdr1(), getExtHdr2(), getExtHdr3(), getExtHdr4(), getExtHdr5(), getExtHdr6(), getExtHdr7(), getExtHdr8(), getFib1OrbMsgBCN(), getFib2OrbMsgBCN(), getFib3OrbMsgBCN(), getFib4OrbMsgBCN(), getFib5OrbMsgBCN(), getFib6OrbMsgBCN(), getFib7OrbMsgBCN(), getFib8OrbMsgBCN(), getHistogramFibers(), getL1ANumber(), getOrbitNumber(), getRawData(), getTTCready(), isPatternRAMEvent(), operator=(), HcalTTPData::operator=(), unpack(), HcalTTPData::unpack(), unpackHistogram(), and wasHistogramError().

int HcalHTRData::m_rawLength [protected]

Definition at line 225 of file HcalHTRData.h.

Referenced by adoptData(), allocate(), HcalTTPData::check(), check(), determineSectionLengths(), HcalTTPData::determineSectionLengths(), getFib1OrbMsgBCN(), getFib2OrbMsgBCN(), getFib3OrbMsgBCN(), getFib4OrbMsgBCN(), getFib5OrbMsgBCN(), getFib6OrbMsgBCN(), getFib7OrbMsgBCN(), getFib8OrbMsgBCN(), getRawLength(), operator=(), HcalTTPData::operator=(), pack(), and packHeaderTrailer().

const int HcalHTRData::MAXIMUM_SAMPLES_PER_CHANNEL = 20 [static]

Definition at line 19 of file HcalHTRData.h.

Referenced by pack(), HcalPacker::pack(), CastorPacker::pack(), and unpack().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:23:43 2009 for CMSSW by  doxygen 1.5.4