CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
HcalHTRData Class Reference

#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. More...
 
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. More...
 
unsigned int getBunchNumber () const
 Get the HTR bunch number. More...
 
unsigned int getDLLunlock () const
 Get DLLunlock bits. More...
 
unsigned int getErrorsWord () const
 Get the errors word. More...
 
unsigned int getExtHdr1 () const
 Get the HTR Ext Header words. More...
 
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. More...
 
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. More...
 
int getFirmwareFlavor () const
 Get the HTR firmware flavor. More...
 
unsigned int getFirmwareRevision () const
 Get the HTR firmware version. More...
 
int getFormatVersion () const
 Get the version number of this event. More...
 
void getHistogramFibers (int &a, int &b) const
 Get the fiber numbers for the data present in this event (only in histogram mode!) More...
 
unsigned int getL1ANumber () const
 Get the HTR event number. More...
 
int getNDD () const
 Get the number of daq data samples per channel when not zero-suppressed. More...
 
int getNPrecisionWords () const
 Get the total number of precision data 16-bit words. More...
 
int getNPS () const
 Get the number of presamples in daq data. More...
 
int getNTP () const
 Get the number of trigger data samples when not zero-suppressed (not available after FW 4) More...
 
unsigned int getOrbitNumber () const
 Get the HTR orbit number. More...
 
unsigned int getPipelineLength () const
 Get the pipeline length used for this event. More...
 
const unsigned short * getRawData () const
 Get a pointer to the raw data. More...
 
const int getRawLength () const
 Get the length of the raw data. More...
 
unsigned int getSubmodule () const
 Get the HTR submodule number. More...
 
unsigned int getTTCready () const
 Get TTCready bit. More...
 
 HcalHTRData ()
 
 HcalHTRData (int version_to_create)
 
 HcalHTRData (const unsigned short *data, int length)
 
 HcalHTRData (const HcalHTRData &)
 
unsigned int htrSlot () const
 HcalElectronicsId-style HTR slot. More...
 
unsigned int htrTopBottom () const
 HcalElectronicsId-style HTR top/bottom (1=top/0=bottom) More...
 
bool isBusy () const
 
bool isCalibrationStream () const
 Is this event a calibration-stream event? More...
 
bool isEmptyEvent () const
 
bool isHistogramEvent () const
 Is this event a histogram event? (do not call standard unpack in this case!!!!!) More...
 
bool isOverflowWarning () const
 
bool isPatternRAMEvent () const
 Is this event a pattern-ram event? More...
 
bool isUnsuppressed () const
 Is this event an unsuppresed event? More...
 
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. More...
 
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) More...
 
void packUnsuppressed (const bool *mp)
 pack trailer with Mark and Pass bits More...
 
unsigned int readoutVMECrateId () const
 HcalElectronicsId-style VME crate number. More...
 
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. More...
 
bool unpackHistogram (int fiber, int fiberchan, int capid, unsigned short *histogram) const
 Unpack special histogramming mode data. More...
 
bool wasHistogramError (int ifiber) const
 Was there an error on the given fiber for this event (only in histogram mode!) More...
 
bool wasMarkAndPassZS (int fiber, int fiberchan) const
 Was this channel passed as part of Mark&Pass ZS? More...
 
bool wasMarkAndPassZSTP (int slb, int slbchan) const
 Was this channel passed as part of Mark&Pass ZS? More...
 
uint32_t zsBunchMask () const
 ZS Bunch Mask (if available) More...
 
 ~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 More...
 
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) More...
 

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
 

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:
2012/06/04 11:26:21
Revision:
1.18
Author
J. Mans - UMD

Definition at line 18 of file HcalHTRData.h.

Constructor & Destructor Documentation

HcalHTRData::HcalHTRData ( )

Definition at line 17 of file HcalHTRData.cc.

17 : m_formatVersion(-2), m_rawLength(0), m_rawConst(0), m_ownData(0) { }
unsigned short * m_ownData
Definition: HcalHTRData.h:256
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
HcalHTRData::~HcalHTRData ( )
inline

Definition at line 25 of file HcalHTRData.h.

References m_ownData.

25 { if (m_ownData!=0) delete [] m_ownData; }
unsigned short * m_ownData
Definition: HcalHTRData.h:256
HcalHTRData::HcalHTRData ( int  version_to_create)

Definition at line 24 of file HcalHTRData.cc.

References allocate().

24  : m_formatVersion(version_to_create) {
25  allocate(version_to_create);
26 }
int m_formatVersion
Definition: HcalHTRData.h:253
void allocate(int version_to_create=0)
Definition: HcalHTRData.cc:28
HcalHTRData::HcalHTRData ( const unsigned short *  data,
int  length 
)

Definition at line 18 of file HcalHTRData.cc.

References adoptData(), and m_ownData.

18  {
19  adoptData(data,length);
20  m_ownData=0;
21 }
unsigned short * m_ownData
Definition: HcalHTRData.h:256
void adoptData(const unsigned short *data, int length)
Definition: HcalHTRData.cc:49
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
HcalHTRData::HcalHTRData ( const HcalHTRData hd)

Definition at line 22 of file HcalHTRData.cc.

unsigned short * m_ownData
Definition: HcalHTRData.h:256
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255

Member Function Documentation

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 HcalDCCHeader::getSpigotData(), and HcalHTRData().

49  {
50  m_rawLength=length;
52  if (m_rawLength<5) {
53  m_formatVersion=-2; // invalid!
54  } else {
55  // determine format version
56  if ((m_rawConst[2]&0x8000)==0) m_formatVersion=-1; // original format before versions
57  else m_formatVersion=(m_rawConst[4]>>12)&0xF;
58  }
59 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
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(), CastorPacker::pack(), and HcalPacker::pack().

28  {
29  m_formatVersion=version_to_create;
30  // the needed space is for the biggest possible event...
31  const int needed=0x200;
32  // create a buffer big enough...
33  m_ownData=new unsigned short[needed];
34  // clear isn't really necessary, but it makes valgrind happy
35  memset(m_ownData,0,sizeof(unsigned short)*needed);
36  m_rawLength=0;
38 }
unsigned short * m_ownData
Definition: HcalHTRData.h:256
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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(), errorMatrix2Lands::header, isHistogramEvent(), m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalTriggerPrimitiveAlgo::runFEFormatError(), CastorDataIntegrityMonitor::unpack(), CastorUnpacker::unpack(), HcalUnpacker::unpack(), and HcalRawDataMonitor::unpack().

64  {
65  if (m_formatVersion==-1) {
66  // length checks
67  // minimum length
68  if (m_rawLength<6+12) return false;
69  // matches wordcount
70  if (m_rawLength!=m_rawConst[m_rawLength-3]) return false;
71  // empty event check
72  if (m_rawConst[2]&0x20) return false;
73  } else {
74  // length checks
75  // minimum length
76  if (m_rawLength<8+4) return false;
77  if (m_formatVersion<=3) {
78  // matches wordcount
80  if (isHistogramEvent() && m_rawConst[m_rawLength-3]==786) {
81  // known bug!
82  } else
83  return false;
84  }
85  } else {
86  // eventually add CRC check
87  }
88  // empty event check (redundant...)
89  if (m_rawConst[2]&0x4) return false;
90  }
91 
92  if (!isHistogramEvent()) {
93  // daq/tp length check
94  int tp, daq, header, trailer;
95  determineSectionLengths(tp,daq,header,trailer);
96  if (tp+daq+header+trailer>m_rawLength) return false;
97  }
98 
99  return true;
100 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:387
void determineSectionLengths(int &tpWords, int &daqWords, int &headerWords, int &trailerWords) const
Definition: HcalHTRData.cc:127
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.

Parameters
daq_firstPointer to a pointer to the start of the DAQ data
daq_lastPointer to a pointer to the end of the DAQ data
tp_firstPointer to a pointer to the start of the TP data
tp_lastPointer 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 HcalTTPUnpacker::unpack(), CastorUnpacker::unpack(), HcalUnpacker::unpack(), and HcalRawDataMonitor::unpack().

158  {
159  int tp_words_total, daq_words_total, headerLen, trailerLen;
160  determineSectionLengths(tp_words_total,daq_words_total,headerLen,trailerLen);
161 
162  *tp_first=m_rawConst+headerLen;
163  *tp_last=*tp_first+(tp_words_total-1);
164  *daq_first=*tp_last+1;
165  *daq_last=*daq_first+(daq_words_total-1);
166 }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
void determineSectionLengths(int &tpWords, int &daqWords, int &headerWords, int &trailerWords) const
Definition: HcalHTRData.cc:127
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().

127  {
128  if (m_formatVersion==-1) {
129  tpWords=m_rawConst[5]>>8;
130  daqWords=CHANNELS_PER_SPIGOT*(m_rawConst[m_rawLength-4]>>8); // always 24 channels, no zero suppresion
131  headerWords=6;
132  trailerWords=12;
133  } else {
134  tpWords=m_rawConst[5]>>8;
135  if (m_rawLength>4)
136  daqWords=m_rawConst[m_rawLength-4]&0x7FF; // zero suppression supported
137  headerWords=8;
138  trailerWords=4; // minimum, may be more...
139  }
140 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
static const int CHANNELS_PER_SPIGOT
Definition: HcalHTRData.h:20
void HcalHTRData::determineStaticLengths ( int &  headerWords,
int &  trailerWords 
) const
protected

Definition at line 142 of file HcalHTRData.cc.

References m_formatVersion.

Referenced by pack().

142  {
143  if (m_formatVersion==-1) {
144  headerWords=6;
145  trailerWords=12;
146  } else if (m_formatVersion<5) {
147  headerWords=8;
148  trailerWords=4; // minimum, may be more...
149  } else {
150  headerWords=8;
151  trailerWords=12; // minimum, may be more...
152  }
153 }
int m_formatVersion
Definition: HcalHTRData.h:253
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().

116  {
117  return (m_rawConst[4]&0xFFF);
118  }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
unsigned int HcalHTRData::getDLLunlock ( ) const
inline

Get DLLunlock bits.

Definition at line 171 of file HcalHTRData.h.

References m_rawConst.

171  {
172  return (m_rawConst[5]>>1)&0x3; }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

158  {
159  return m_rawConst[2]&0xFFFF; }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
unsigned int HcalHTRData::getExtHdr1 ( ) const
inline

Get the HTR Ext Header words.

Definition at line 218 of file HcalHTRData.h.

References m_rawConst.

218  {
219  return (m_rawConst[0]);}
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
unsigned int HcalHTRData::getExtHdr2 ( ) const
inline

Definition at line 220 of file HcalHTRData.h.

References m_rawConst.

220  {
221  return (m_rawConst[1]); }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
unsigned int HcalHTRData::getExtHdr3 ( ) const
inline

Definition at line 222 of file HcalHTRData.h.

References m_rawConst.

222  {
223  return (m_rawConst[2]);}
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
unsigned int HcalHTRData::getExtHdr4 ( ) const
inline

Definition at line 224 of file HcalHTRData.h.

References m_rawConst.

224  {
225  return (m_rawConst[3]); }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
unsigned int HcalHTRData::getExtHdr5 ( ) const
inline

Definition at line 226 of file HcalHTRData.h.

References m_rawConst.

226  {
227  return (m_rawConst[4]);}
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
unsigned int HcalHTRData::getExtHdr6 ( ) const
inline

Definition at line 228 of file HcalHTRData.h.

References m_rawConst.

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

228  {
229  return (m_rawConst[5]);}
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
unsigned int HcalHTRData::getExtHdr7 ( ) const
inline

Definition at line 230 of file HcalHTRData.h.

References m_rawConst.

Referenced by HcalRawDataMonitor::unpack().

230  {
231  return (m_rawConst[6]);}
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
unsigned int HcalHTRData::getExtHdr8 ( ) const
inline

Definition at line 232 of file HcalHTRData.h.

References m_rawConst.

232  {
233  return (m_rawConst[7]);}
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

184  {
185  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-12]&0xFFF);
186 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

187  {
188  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-11]&0xFFF);
189 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

191  {
192  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-10]&0xFFF);
193 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

195  {
196  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-9]&0xFFF);
197 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

199  {
200  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-8]&0xFFF);
201 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

203  {
204  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-7]&0xFFF);
205 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

207  {
208  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-6]&0xFFF);
209 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

211  {
212  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-5]&0xFFF);
213 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

179  {
180  return (m_formatVersion==-1 || fiber<1 || fiber>8)?(0):(m_rawConst[m_rawLength-12+(fiber-1)]&0xFFF);
181  }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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(), HcalTTPUnpacker::unpack(), CastorUnpacker::unpack(), and HcalUnpacker::unpack().

411  {
412  return (m_formatVersion<2)?(-1):((m_rawConst[7]>>8)&0xFF);
413 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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 HcalTTPUnpacker::unpack(), and HcalRawDataMonitor::unpack().

408  {
409  return (m_formatVersion==-1)?(0):((m_rawConst[6]&0x1FFF)+((m_rawConst[6]&0xE000)<<3));
410 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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 CastorUnpacker::unpack(), HcalUnpacker::unpack(), and HcalRawDataMonitor::unpack().

35 { return m_formatVersion; }
int m_formatVersion
Definition: HcalHTRData.h:253
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().

415  {
416  a=-1;
417  b=-1;
418  if (m_formatVersion==-1) {
419  a=((m_rawConst[2]&0x0F00)>>8);
420  b=((m_rawConst[2]&0xF000)>>12);
421  } else {
422  a=((m_rawConst[5]&0x0F00)>>8);
423  b=((m_rawConst[5]&0xF000)>>12);
424  }
425 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
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().

112  {
113  return (m_rawConst[0]&0xFF)+(m_rawConst[1]<<8);
114  }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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(), HcalTTPUnpacker::unpack(), and HcalRawDataMonitor::unpack().

390  {
391  return (m_formatVersion==-1)?(m_rawConst[m_rawLength-4]>>8):(m_rawConst[m_rawLength-4]>>11);
392 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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.

399  {
400  return (m_formatVersion==-1)?(m_rawConst[m_rawLength-4]&0xFF):(m_rawConst[m_rawLength-4]&0x7FF);
401 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

402  {
403  return (m_formatVersion==-1)?(0):((m_rawConst[5]>>3)&0x1F);
404 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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.

393  {
394  int retval=-1;
395  if (m_formatVersion==-1) retval=m_rawConst[m_rawLength-4]&0xFF;
396  else if (m_formatVersion<3) retval=m_rawConst[m_rawLength-4]>>11;
397  return retval;
398 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

326  {
327  switch (m_formatVersion) {
328  case (-1) : return (m_rawConst[3]>>8);
329  case (0) : return (m_rawConst[3]>>10);
330  default : return (m_rawConst[3]>>11);
331  }
332 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

405  {
406  return (m_formatVersion==-1)?(m_rawConst[2]>>8):(m_rawConst[7]&0xFF);
407 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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 HcalDCCHeader::copySpigotData(), HcalEEUSMonitor::unpack(), and HcalRawDataMonitor::unpack().

38 { return m_rawConst; }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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 HcalDCCHeader::copySpigotData(), CastorPacker::pack(), HcalPacker::pack(), HcalEEUSMonitor::unpack(), and HcalRawDataMonitor::unpack().

41 { 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().

333  {
334  switch (m_formatVersion) {
335  case (-1) : return (m_rawConst[3]&0xFF);
336  case (0) : return (m_rawConst[3]&0x3FF);
337  default : return (m_rawConst[3]&0x7FF);
338  }
339 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
unsigned int HcalHTRData::getTTCready ( ) const
inline

Get TTCready bit.

Definition at line 175 of file HcalHTRData.h.

References m_rawConst.

175  {
176  return m_rawConst[5]&0x1; }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

340  {
341  const unsigned int smid = getSubmodule();
342  return ((smid>>1)&0x1F);
343 }
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:333
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().

344  {
345  const unsigned int smid = getSubmodule();
346  return (smid&0x01);
347 }
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:333
static bool HcalHTRData::is_channel_header ( unsigned short  value)
inlinestatic

check top bit to see if this is a compact format channel header word

Definition at line 92 of file HcalHTRData.h.

Referenced by HcalUnpacker::unpack(), HcalRawDataMonitor::unpack(), and HcalUnpacker_impl::unpack_compact().

92 { return (value&0x8000)!=0; }
bool HcalHTRData::isBusy ( ) const

Definition at line 119 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController::navigate(), and HcalUnpacker::unpack().

119  {
120  if (m_formatVersion==-1) {
121  return false; // too old to care.
122  } else {
123  return (m_rawConst[2]&0x2)!=0;
124  }
125 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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.

352  {
353  return (m_formatVersion==-1)?(false):(m_rawConst[2]&0x4000);
354 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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().

102  {
103  if (m_formatVersion==-1) {
104  return (m_rawConst[2]&0x20)!=0;
105  } else {
106  return (m_rawConst[2]&0x4)!=0;
107  }
108 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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(), CastorDataIntegrityMonitor::unpack(), CastorUnpacker::unpack(), HcalUnpacker::unpack(), HcalEEUSMonitor::unpack(), HcalRawDataMonitor::unpack(), unpackHistogram(), and wasHistogramError().

387  {
388  return (m_formatVersion==-1)?(m_rawConst[2]&0x2):(m_rawConst[2]&0x2000);
389 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
bool HcalHTRData::isOverflowWarning ( ) const

Definition at line 111 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by HcalUnpacker::unpack().

111  {
112  if (m_formatVersion==-1) {
113  return false; // too old to care.
114  } else {
115  return (m_rawConst[2]&0x1)!=0;
116  }
117 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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.

384  {
385  return (m_formatVersion==-1)?(false):(m_rawConst[2]&0x1000);
386 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
bool HcalHTRData::isUnsuppressed ( ) const
HcalHTRData & HcalHTRData::operator= ( const HcalHTRData hd)

Definition at line 40 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, m_rawConst, and m_rawLength.

40  {
41  if (m_ownData==0) {
45  }
46  return (*this);
47 }
unsigned short * m_ownData
Definition: HcalHTRData.h:256
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
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_lengthsunsigned char[24] of lengths
daq_samplesunsigned short [24*20] of data
tp_lengthsunsigned char[24] of lengths
tp_samplesunsigned 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 pyrootRender.interactiveRender::draw(), CastorPacker::pack(), and HcalPacker::pack().

227  {
228 
229  int tp_words_total=0, daq_words_total=0, headerLen, trailerLen;
230  determineStaticLengths(headerLen,trailerLen);
231 
232  tp_words_total=0;
233  daq_words_total=0;
234  int ichan,isample;
235 
236  // trigger primitive words
237  unsigned short* ptr=m_ownData+headerLen;
238  if (tp_samples!=0 && tp_lengths!=0) {
239  for (ichan=0; ichan<24; ichan++) {
240  unsigned short chanid=((ichan%3)+((ichan/3)<<2))<<11;
241  for (isample=0; isample<tp_lengths[ichan] && isample<MAXIMUM_SAMPLES_PER_CHANNEL; isample++) {
242  ptr[tp_words_total]=chanid|(tp_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+isample]&0x3FF);
243  tp_words_total++;
244  }
245  }
246  }
247 
248  // daq words
249  ptr=m_ownData+headerLen+tp_words_total;
250  for (ichan=0; ichan<24; ichan++) {
251  unsigned short chanid=((ichan%3)+((ichan/3)<<2))<<11;
252  for (isample=0; isample<daq_lengths[ichan] && isample<MAXIMUM_SAMPLES_PER_CHANNEL; isample++) {
253  unsigned short basedata=daq_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+isample]&0x3FF;
254  if (do_capid) basedata=(basedata&0x7F)|(0x200)|((isample%4)<<7);
255  ptr[daq_words_total]=chanid|basedata;
256  daq_words_total++;
257  }
258  }
259  unsigned short totalLen;
260  if (m_formatVersion==-1) {
261  m_ownData[5]=(tp_words_total<<8)|0x1;
262  totalLen=headerLen+tp_words_total+daq_words_total+trailerLen;
263  m_rawLength=totalLen;
264  m_ownData[totalLen-3]=totalLen;
265  m_ownData[totalLen-4]=(tp_words_total/CHANNELS_PER_SPIGOT)|((daq_words_total/CHANNELS_PER_SPIGOT)<<8);
266  } else {
267  m_ownData[5]=(tp_words_total<<8)|0x1;
268  totalLen=headerLen+tp_words_total+daq_words_total+trailerLen;
269  if ((totalLen%2)==1) {
270  m_ownData[totalLen-4]=0xFFFF; // parity word
271  totalLen++; // round to even number of 16-bit words
272  }
273  m_rawLength=totalLen;
274  m_ownData[totalLen-2]=totalLen/2; // 32-bit words
275  m_ownData[totalLen-3]=totalLen;
276  m_ownData[totalLen-4]=daq_words_total;
277  }
278  if (trailerLen==12) { // initialize extra trailer words if present
279  for (int i=12; i>4; i--)
280  m_ownData[totalLen-i]=0;
281  }
282 
283 }
unsigned short * m_ownData
Definition: HcalHTRData.h:256
int i
Definition: DBlmapReader.cc:9
int m_formatVersion
Definition: HcalHTRData.h:253
void determineStaticLengths(int &headerWords, int &trailerWords) const
Definition: HcalHTRData.cc:142
static const int CHANNELS_PER_SPIGOT
Definition: HcalHTRData.h:20
static const int MAXIMUM_SAMPLES_PER_CHANNEL
Definition: HcalHTRData.h:21
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 CastorPacker::pack(), and HcalPacker::pack().

285  {
286  m_ownData[0]=L1Anumber&0xFF;
287  m_ownData[1]=(L1Anumber&0xFFFF00)>>8;
288  if (m_formatVersion==-1) {
289  m_ownData[2]=((pipeline&0x7F)<<8); // no error bits
290  m_ownData[3]=((orbitn&0xFF)<<8)|(submodule&0xFF);
291  m_ownData[4]=bcn&0xFFF;
292  // m_ownData[5]&=0xFF01;
293  } else {
294  m_ownData[2]=0x8000; // Version is valid, no error bits
295  if (m_formatVersion==0)
296  m_ownData[3]=((orbitn&0x3F)<<10)|(submodule&0x3FF);
297  else
298  m_ownData[3]=((orbitn&0x1F)<<11)|(submodule&0x7FF);
299  m_ownData[4]=((m_formatVersion&0xF)<<12)|(bcn&0xFFF);
300  m_ownData[5]|=((nps&0x1F)<<3)|0x1;
301  m_ownData[6]=((firmwareRev&0x70000)>>3)|(firmwareRev&0x1FFF);
302  m_ownData[7]=pipeline&0xFF;
303  m_ownData[m_rawLength-4]&=0x7FF;
304  m_ownData[m_rawLength-4]|=(ndd&0x1F)<<11;
305  }
306  m_ownData[m_rawLength-2]=m_rawLength/2; // 32-bit words
307  m_ownData[m_rawLength-1]=(L1Anumber&0xFF)<<8;
308 }
unsigned short * m_ownData
Definition: HcalHTRData.h:256
int m_formatVersion
Definition: HcalHTRData.h:253
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().

310  {
311  if (m_formatVersion<4) return;
312 
313  for (int fiber=1; fiber<=8; fiber++) {
314  for (int fiberchan=0; fiberchan<=2; fiberchan++) {
315  int linchan=(fiber-1)*3+fiberchan;
316 
317  unsigned short& val=m_ownData[m_rawLength-12+(linchan/8)];
318  if (mp[linchan]) val|=1<<(linchan%8);
319  }
320  }
321 
322  // set the unsupressed bit
323  m_ownData[6]|=0x8000;
324 }
unsigned short * m_ownData
Definition: HcalHTRData.h:256
int m_formatVersion
Definition: HcalHTRData.h:253
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().

348  {
349  const unsigned int smid = getSubmodule();
350  return ((smid>>6)&0x1F);
351 }
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:333
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_lengthsunsigned char[24] of lengths. High bit set indicates error with this channel
daq_samplesunsigned short [24*20] of data
tp_lengthsunsigned char[24] of lengths
tp_samplesunsigned 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.

175  {
176 
177  if (daq_lengths!=0) memset(daq_lengths,0,CHANNELS_PER_SPIGOT);
178  if (tp_lengths!=0) memset(tp_lengths,0,CHANNELS_PER_SPIGOT);
179 
180  // currently, the major differences between the versions are
181  // -1 : 6 word header, no zero suppression, trailer setup
182  // 0 : 8 word header, zero suppression,
183 
184  int tp_words_total, daq_words_total, headerLen, trailerLen;
185  determineSectionLengths(tp_words_total,daq_words_total,headerLen,trailerLen);
186 
187  // printf("%d %d %d %d\n",tp_words_total,daq_words_total,headerLen,trailerLen);
188  int wordPtr;
189  const unsigned short* tpBase=m_rawConst+headerLen;
190  // process the trigger primitive words
191  if (tp_lengths!=0) {
192  for (wordPtr=0; wordPtr<tp_words_total; wordPtr++) {
193  int ichan=channelDecoder[tpBase[wordPtr]>>11];
194  if (ichan>=24) continue;
195  tp_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+tp_lengths[ichan]]=tpBase[wordPtr]&0x3ff;
196  tp_lengths[ichan]++;
197  }
198  }
199 
200  const unsigned short* daqBase=m_rawConst+headerLen+tp_words_total;
201  // process the DAQ words [ assumes that data from one channel will always be together ]
202  int lastChan=-1;
203  int lastCapid=0;
204  if (daq_lengths!=0) {
205  for (wordPtr=0; wordPtr<daq_words_total; wordPtr++) {
206  int ichan=channelDecoder[daqBase[wordPtr]>>11];
207  if (ichan>=24) continue;
208  int capid=(daqBase[wordPtr]&0x180)>>7;
209  int erdv=(daqBase[wordPtr]&0x600)>>9;
210  if (erdv!=0x1 ||
211  (lastChan==ichan && (capid!=((lastCapid+1)%4)))) {
212  daq_lengths[ichan]|=0x80;
213  }
214  lastChan=ichan;
215  lastCapid=capid;
216 
217  int useLength=daq_lengths[ichan]&0x1F;
218  // printf("%d %d\n",ichan,useLength);
219  daq_samples[ichan*MAXIMUM_SAMPLES_PER_CHANNEL+useLength]=daqBase[wordPtr]&0x3ff;
220  daq_lengths[ichan]=(useLength+1)|(daq_lengths[ichan]&0xE0); // keep the error bits
221  }
222  }
223 
224 }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
static const int CHANNELS_PER_SPIGOT
Definition: HcalHTRData.h:20
static const int MAXIMUM_SAMPLES_PER_CHANNEL
Definition: HcalHTRData.h:21
static const int channelDecoder[32]
Definition: HcalHTRData.cc:169
void determineSectionLengths(int &tpWords, int &daqWords, int &headerWords, int &trailerWords) const
Definition: HcalHTRData.cc:127
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.

References errorMatrix2Lands::header.

Referenced by HcalUnpacker::unpack(), HcalRawDataMonitor::unpack(), and HcalUnpacker_impl::unpack_compact().

435  {
436  flav=(header>>12)&0x7;
437  error_flags=(header>>10)&0x3;
438  capid0=(header>>8)&0x3;
439  channelid=(header)&0xFF;
440  return (header&0x8000)!=0;
441 }
bool HcalHTRData::unpackHistogram ( int  fiber,
int  fiberchan,
int  capid,
unsigned short *  histogram 
) const

Unpack special histogramming mode data.

Parameters
fiber
fiberchan
capidCapacitor id for which to extract a histogram
histogramunsigned 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().

443  {
444  // check for histogram mode
445  if (!isHistogramEvent()) return false;
446 
447  int fiber1, fiber2;
448  getHistogramFibers(fiber1,fiber2);
449  if (fiber1!=myfiber && fiber2!=myfiber) return false;
450 
451  if (m_formatVersion==-1) {
452  int offset=6+mysc*4*32+capid*32;
453  if (myfiber==fiber2) offset+=3*4*32; // skip to the second half...
454  for (int i=0; i<32; i++)
455  histogram[i]=m_rawConst[offset+i];
456  return true;
457  } else {
458  int offset=8+mysc*4*32+capid*32;
459  if (myfiber==fiber2) offset+=3*4*32; // skip to the second half...
460  for (int i=0; i<32; i++)
461  histogram[i]=m_rawConst[offset+i];
462  return true;
463  }
464 }
int i
Definition: DBlmapReader.cc:9
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
void getHistogramFibers(int &a, int &b) const
Get the fiber numbers for the data present in this event (only in histogram mode!) ...
Definition: HcalHTRData.cc:415
unsigned int offset(bool)
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:387
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.

427  {
428  bool retval=!isHistogramEvent();
429  if (!retval) {
430  retval=((m_rawConst[7])&(1<<ifiber))!=0;
431  }
432  return retval;
433 }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:387
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().

358  {
359  if (fiber<1 || fiber>8 || fiberchan<0 || fiberchan>2) return false;
360  if (!isUnsuppressed() || m_formatVersion<5) return false;
361  int linchan=(fiber-1)*3+fiberchan;
362 
363  unsigned short val=m_rawConst[m_rawLength-12+(linchan/8)];
364  return ((val>>(linchan%8))&0x1)!=0;
365 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:355
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().

366  {
367  if (slb<1 || slb>6 || slbchan<0 || slbchan>3) return false;
368  if (!isUnsuppressed() || m_formatVersion<5) return false;
369  int linchan=(slb-1)*4+slbchan;
370 
371  unsigned short val=m_rawConst[m_rawLength-12+(linchan/8)];
372  return ((val>>(linchan%8))&0x100)!=0;
373 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:355
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().

375  {
376  uint32_t mask=0;
377  if (isUnsuppressed() && m_formatVersion>=5) {
378  mask=m_rawConst[m_rawLength-5]|
379  ((m_rawConst[m_rawLength-6]&0xF000)<<4);
380  }
381  return mask;
382 }
int m_formatVersion
Definition: HcalHTRData.h:253
const unsigned short * m_rawConst
Definition: HcalHTRData.h:255
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:355

Member Data Documentation

const int HcalHTRData::CHANNELS_PER_SPIGOT = 24
static
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
unsigned short* HcalHTRData::m_ownData
protected
const unsigned short* HcalHTRData::m_rawConst
protected
int HcalHTRData::m_rawLength
protected
const int HcalHTRData::MAXIMUM_SAMPLES_PER_CHANNEL = 20
static

Definition at line 21 of file HcalHTRData.h.

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