CMS 3D CMS Logo

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, int firmwareFlav=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.

Author
J. Mans - UMD

Definition at line 16 of file HcalHTRData.h.

Constructor & Destructor Documentation

HcalHTRData::HcalHTRData ( )

Definition at line 15 of file HcalHTRData.cc.

Referenced by ~HcalHTRData().

15 : m_formatVersion(-2), m_rawLength(0), m_rawConst(nullptr), m_ownData(nullptr) {}
unsigned short * m_ownData
Definition: HcalHTRData.h:247
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
HcalHTRData::~HcalHTRData ( )
inline

Definition at line 23 of file HcalHTRData.h.

References adoptData(), allocate(), data, HcalHTRData(), m_ownData, and operator=().

23  {
24  if (m_ownData != nullptr)
25  delete[] m_ownData;
26  }
unsigned short * m_ownData
Definition: HcalHTRData.h:247
HcalHTRData::HcalHTRData ( int  version_to_create)

Definition at line 23 of file HcalHTRData.cc.

References allocate().

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

Definition at line 16 of file HcalHTRData.cc.

References adoptData(), and m_ownData.

16  {
17  adoptData(data, length);
18  m_ownData = nullptr;
19 }
unsigned short * m_ownData
Definition: HcalHTRData.h:247
void adoptData(const unsigned short *data, int length)
Definition: HcalHTRData.cc:46
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
HcalHTRData::HcalHTRData ( const HcalHTRData hd)

Definition at line 20 of file HcalHTRData.cc.

unsigned short * m_ownData
Definition: HcalHTRData.h:247
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246

Member Function Documentation

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

Definition at line 46 of file HcalHTRData.cc.

References data, m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDTCHeader::getSlotData(), HcalDCCHeader::getSpigotData(), HcalHTRData(), and ~HcalHTRData().

46  {
47  m_rawLength = length;
48  m_rawConst = data;
49  if (m_rawLength < 5) {
50  m_formatVersion = -2; // invalid!
51  } else {
52  // determine format version
53  if ((m_rawConst[2] & 0x8000) == 0)
54  m_formatVersion = -1; // original format before versions
55  else
56  m_formatVersion = (m_rawConst[4] >> 12) & 0xF;
57  }
58 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
void HcalHTRData::allocate ( int  version_to_create = 0)

Definition at line 25 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, m_rawConst, and m_rawLength.

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

25  {
26  m_formatVersion = version_to_create;
27  // the needed space is for the biggest possible event...
28  const int needed = 0x200;
29  // create a buffer big enough...
30  m_ownData = new unsigned short[needed];
31  // clear isn't really necessary, but it makes valgrind happy
32  memset(m_ownData, 0, sizeof(unsigned short) * needed);
33  m_rawLength = 0;
35 }
unsigned short * m_ownData
Definition: HcalHTRData.h:247
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
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 63 of file HcalHTRData.cc.

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

Referenced by RawTask::_process(), getRawLength(), HcalTriggerPrimitiveAlgo::runFEFormatError(), CastorUnpacker::unpack(), ZdcUnpacker::unpack(), HcalUnpacker::unpack(), and HcalUnpacker::unpackVME().

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

References determineSectionLengths(), and m_rawConst.

Referenced by getRawLength(), HcalTTPUnpacker::unpack(), CastorUnpacker::unpack(), ZdcUnpacker::unpack(), and HcalUnpacker::unpackVME().

164  {
165  int tp_words_total, daq_words_total, headerLen, trailerLen;
166  determineSectionLengths(tp_words_total, daq_words_total, headerLen, trailerLen);
167 
168  *tp_first = m_rawConst + headerLen;
169  *tp_last = *tp_first + (tp_words_total - 1);
170  *daq_first = *tp_last + 1;
171  *daq_last = *daq_first + (daq_words_total - 1);
172 }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
void determineSectionLengths(int &tpWords, int &daqWords, int &headerWords, int &trailerWords) const
Definition: HcalHTRData.cc:131
void HcalHTRData::determineSectionLengths ( int &  tpWords,
int &  daqWords,
int &  headerWords,
int &  trailerWords 
) const
protected

Definition at line 131 of file HcalHTRData.cc.

References CHANNELS_PER_SPIGOT, m_formatVersion, m_rawConst, and m_rawLength.

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

131  {
132  if (m_formatVersion == -1) {
133  tpWords = m_rawConst[5] >> 8;
134  daqWords = CHANNELS_PER_SPIGOT * (m_rawConst[m_rawLength - 4] >> 8); // always 24 channels, no zero suppresion
135  headerWords = 6;
136  trailerWords = 12;
137  } else {
138  tpWords = m_rawConst[5] >> 8;
139  if (m_rawLength > 4)
140  daqWords = m_rawConst[m_rawLength - 4] & 0x7FF; // zero suppression supported
141  else
142  daqWords = 0; //should there be a warning as well?
143  headerWords = 8;
144  trailerWords = 4; // minimum, may be more...
145  }
146 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
static const int CHANNELS_PER_SPIGOT
Definition: HcalHTRData.h:18
void HcalHTRData::determineStaticLengths ( int &  headerWords,
int &  trailerWords 
) const
protected

Definition at line 148 of file HcalHTRData.cc.

References m_formatVersion.

Referenced by getExtHdr8(), and pack().

148  {
149  if (m_formatVersion == -1) {
150  headerWords = 6;
151  trailerWords = 12;
152  } else if (m_formatVersion < 5) {
153  headerWords = 8;
154  trailerWords = 4; // minimum, may be more...
155  } else {
156  headerWords = 8;
157  trailerWords = 12; // minimum, may be more...
158  }
159 }
int m_formatVersion
Definition: HcalHTRData.h:244
unsigned int HcalHTRData::getBunchNumber ( ) const
inline
unsigned int HcalHTRData::getDLLunlock ( ) const
inline

Get DLLunlock bits.

Definition at line 174 of file HcalHTRData.h.

References m_rawConst.

174 { return (m_rawConst[5] >> 1) & 0x3; }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getErrorsWord ( ) const
inline

Get the errors word.

Definition at line 162 of file HcalHTRData.h.

References getNDD(), getNPrecisionWords(), getNPS(), getNTP(), and m_rawConst.

Referenced by HcalDCCHeader::copySpigotData(), and HcalTriggerPrimitiveAlgo::runFEFormatError().

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

Get the HTR Ext Header words.

Definition at line 218 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 219 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 220 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 221 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 222 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 223 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 224 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 225 of file HcalHTRData.h.

References determineSectionLengths(), determineStaticLengths(), m_rawConst, and wasHistogramError().

225 { return (m_rawConst[7]); }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getFib1OrbMsgBCN ( ) const
inline

Get the BCN of the Fiber Orbit Messages.

Definition at line 186 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

186  {
187  return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 12] & 0xFFF);
188  }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getFib2OrbMsgBCN ( ) const
inline

Definition at line 189 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

189  {
190  return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 11] & 0xFFF);
191  }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getFib3OrbMsgBCN ( ) const
inline

Definition at line 193 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

193  {
194  return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 10] & 0xFFF);
195  }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getFib4OrbMsgBCN ( ) const
inline

Definition at line 197 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

197  {
198  return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 9] & 0xFFF);
199  }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getFib5OrbMsgBCN ( ) const
inline

Definition at line 201 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

201  {
202  return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 8] & 0xFFF);
203  }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getFib6OrbMsgBCN ( ) const
inline

Definition at line 205 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

205  {
206  return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 7] & 0xFFF);
207  }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getFib7OrbMsgBCN ( ) const
inline

Definition at line 209 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

209  {
210  return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 6] & 0xFFF);
211  }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getFib8OrbMsgBCN ( ) const
inline

Definition at line 213 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

213  {
214  return (m_formatVersion == -1) ? (0) : (m_rawConst[m_rawLength - 5] & 0xFFF);
215  }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getFibOrbMsgBCN ( int  fiber) const
inline

Get the BCN of the Fiber Orbit Messages.

Definition at line 180 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by CastorUnpacker_impl::unpack(), HcalUnpacker_impl::unpack(), ZdcUnpacker_impl::unpack_compact(), and HcalUnpacker_impl::unpack_compact().

180  {
181  return (m_formatVersion == -1 || fiber < 1 || fiber > 8) ? (0)
182  : (m_rawConst[m_rawLength - 12 + (fiber - 1)] & 0xFFF);
183  }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
int HcalHTRData::getFirmwareFlavor ( ) const

Get the HTR firmware flavor.

Definition at line 433 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by getBunchNumber(), HLTHcalNZSFilter::hltFilter(), HcalTTPUnpacker::unpack(), CastorUnpacker::unpack(), ZdcUnpacker::unpack(), and HcalUnpacker::unpackVME().

433 { return (m_formatVersion < 2) ? (-1) : ((m_rawConst[7] >> 8) & 0xFF); }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getFirmwareRevision ( ) const

Get the HTR firmware version.

Definition at line 430 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by getBunchNumber(), and HcalTTPUnpacker::unpack().

430  {
431  return (m_formatVersion == -1) ? (0) : ((m_rawConst[6] & 0x1FFF) + ((m_rawConst[6] & 0xE000) << 3));
432 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
int HcalHTRData::getFormatVersion ( ) const
inline

Get the version number of this event.

Definition at line 36 of file HcalHTRData.h.

References m_formatVersion.

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

36 { return m_formatVersion; }
int m_formatVersion
Definition: HcalHTRData.h:244
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 435 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

435  {
436  a = -1;
437  b = -1;
438  if (m_formatVersion == -1) {
439  a = ((m_rawConst[2] & 0x0F00) >> 8);
440  b = ((m_rawConst[2] & 0xF000) >> 12);
441  } else {
442  a = ((m_rawConst[5] & 0x0F00) >> 8) + 1;
443  b = ((m_rawConst[5] & 0xF000) >> 12) + 1;
444  }
445 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
unsigned int HcalHTRData::getL1ANumber ( ) const
inline

Get the HTR event number.

Definition at line 120 of file HcalHTRData.h.

References m_rawConst.

Referenced by RawTask::_process().

120 { return (m_rawConst[0] & 0xFF) + (m_rawConst[1] << 8); }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
int HcalHTRData::getNDD ( ) const

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

Definition at line 412 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by getErrorsWord(), and HcalTTPUnpacker::unpack().

412  {
413  return (m_formatVersion == -1) ? (m_rawConst[m_rawLength - 4] >> 8) : (m_rawConst[m_rawLength - 4] >> 11);
414 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
int HcalHTRData::getNPrecisionWords ( ) const

Get the total number of precision data 16-bit words.

Definition at line 423 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by getErrorsWord().

423  {
424  return (m_formatVersion == -1) ? (m_rawConst[m_rawLength - 4] & 0xFF) : (m_rawConst[m_rawLength - 4] & 0x7FF);
425 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
int HcalHTRData::getNPS ( ) const

Get the number of presamples in daq data.

Definition at line 426 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by getErrorsWord(), HcalTTPUnpacker::unpack(), CastorUnpacker::unpack(), ZdcUnpacker::unpack(), and HcalUnpacker::unpackVME().

426 { return (m_formatVersion == -1) ? (0) : ((m_rawConst[5] >> 3) & 0x1F); }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
int HcalHTRData::getNTP ( ) const

Get the number of trigger data samples when not zero-suppressed (not available after FW 4)

Definition at line 415 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by getErrorsWord().

415  {
416  int retval = -1;
417  if (m_formatVersion == -1)
418  retval = m_rawConst[m_rawLength - 4] & 0xFF;
419  else if (m_formatVersion < 3)
420  retval = m_rawConst[m_rawLength - 4] >> 11;
421  return retval;
422 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getOrbitNumber ( ) const

Get the HTR orbit number.

Definition at line 345 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by RawTask::_process(), and getBunchNumber().

345  {
346  switch (m_formatVersion) {
347  case (-1):
348  return (m_rawConst[3] >> 8);
349  case (0):
350  return (m_rawConst[3] >> 10);
351  default:
352  return (m_rawConst[3] >> 11);
353  }
354 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getPipelineLength ( ) const

Get the pipeline length used for this event.

Definition at line 427 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by getBunchNumber(), and HcalTTPUnpacker::unpack().

427  {
428  return (m_formatVersion == -1) ? (m_rawConst[2] >> 8) : (m_rawConst[7] & 0xFF);
429 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
const unsigned short* HcalHTRData::getRawData ( ) const
inline

Get a pointer to the raw data.

Definition at line 39 of file HcalHTRData.h.

References m_rawConst.

Referenced by HcalDTCHeader::copySlotData(), and HcalDCCHeader::copySpigotData().

39 { return m_rawConst; }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
const int HcalHTRData::getRawLength ( ) const
inline
unsigned int HcalHTRData::getSubmodule ( ) const

Get the HTR submodule number.

Definition at line 355 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by getBunchNumber(), htrSlot(), htrTopBottom(), readoutVMECrateId(), HcalTTPUnpacker::unpack(), CastorUnpacker::unpack(), ZdcUnpacker::unpack(), HcalUnpacker::unpack(), and HcalUnpacker::unpackVME().

355  {
356  switch (m_formatVersion) {
357  case (-1):
358  return (m_rawConst[3] & 0xFF);
359  case (0):
360  return (m_rawConst[3] & 0x3FF);
361  default:
362  return (m_rawConst[3] & 0x7FF);
363  }
364 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::getTTCready ( ) const
inline

Get TTCready bit.

Definition at line 177 of file HcalHTRData.h.

References m_rawConst.

177 { return m_rawConst[5] & 0x1; }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
unsigned int HcalHTRData::htrSlot ( ) const

HcalElectronicsId-style HTR slot.

Definition at line 365 of file HcalHTRData.cc.

References getSubmodule().

Referenced by getBunchNumber(), and HcalTriggerPrimitiveAlgo::runFEFormatError().

365  {
366  const unsigned int smid = getSubmodule();
367  return ((smid >> 1) & 0x1F);
368 }
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:355
unsigned int HcalHTRData::htrTopBottom ( ) const

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

Definition at line 369 of file HcalHTRData.cc.

References getSubmodule().

Referenced by getBunchNumber(), and HcalTriggerPrimitiveAlgo::runFEFormatError().

369  {
370  const unsigned int smid = getSubmodule();
371  return (smid & 0x01);
372 }
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:355
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.

References pack(), packHeaderTrailer(), and packUnsuppressed().

Referenced by ZdcUnpacker::unpack(), ZdcUnpacker_impl::unpack_compact(), HcalUnpacker_impl::unpack_compact(), and HcalUnpacker::unpackVME().

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

Definition at line 123 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and testProducerWithPsetDescEmpty_cfi::x2.

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

123  {
124  if (m_formatVersion == -1) {
125  return false; // too old to care.
126  } else {
127  return (m_rawConst[2] & 0x2) != 0;
128  }
129 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
bool HcalHTRData::isCalibrationStream ( ) const

Is this event a calibration-stream event?

Definition at line 377 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by getBunchNumber().

377 { return (m_formatVersion == -1) ? (false) : (m_rawConst[2] & 0x4000); }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
bool HcalHTRData::isEmptyEvent ( ) const

Definition at line 107 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by HcalEmptyEventFilter::filter(), getRawLength(), and HcalUnpacker::unpackVME().

107  {
108  if (m_formatVersion == -1) {
109  return (m_rawConst[2] & 0x20) != 0;
110  } else {
111  return (m_rawConst[2] & 0x4) != 0;
112  }
113 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
bool HcalHTRData::isHistogramEvent ( ) const

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

Definition at line 409 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by check(), getBunchNumber(), HcalTriggerPrimitiveAlgo::runFEFormatError(), CastorUnpacker::unpack(), ZdcUnpacker::unpack(), HcalUnpacker::unpack(), unpackHistogram(), HcalUnpacker::unpackVME(), and wasHistogramError().

409  {
410  return (m_formatVersion == -1) ? (m_rawConst[2] & 0x2) : (m_rawConst[2] & 0x2000);
411 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
bool HcalHTRData::isOverflowWarning ( ) const

Definition at line 115 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by getRawLength(), and HcalUnpacker::unpackVME().

115  {
116  if (m_formatVersion == -1) {
117  return false; // too old to care.
118  } else {
119  return (m_rawConst[2] & 0x1) != 0;
120  }
121 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
bool HcalHTRData::isPatternRAMEvent ( ) const

Is this event a pattern-ram event?

Definition at line 408 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by getBunchNumber().

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

Definition at line 37 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, m_rawConst, and m_rawLength.

Referenced by ~HcalHTRData().

37  {
38  if (m_ownData == nullptr) {
42  }
43  return (*this);
44 }
unsigned short * m_ownData
Definition: HcalHTRData.h:247
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
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 233 of file HcalHTRData.cc.

References CHANNELS_PER_SPIGOT, determineStaticLengths(), mps_fire::i, m_formatVersion, m_ownData, m_rawLength, MAXIMUM_SAMPLES_PER_CHANNEL, and testProducerWithPsetDescEmpty_cfi::x1.

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

237  {
238  int tp_words_total = 0, daq_words_total = 0, headerLen, trailerLen;
239  determineStaticLengths(headerLen, trailerLen);
240 
241  tp_words_total = 0;
242  daq_words_total = 0;
243  int ichan, isample;
244 
245  // trigger primitive words
246  unsigned short* ptr = m_ownData + headerLen;
247  if (tp_samples != nullptr && tp_lengths != nullptr) {
248  for (ichan = 0; ichan < 24; ichan++) {
249  unsigned short chanid = ((ichan % 4) + (((ichan / 4) + 1) << 2)) << 11;
250  for (isample = 0; isample < tp_lengths[ichan] && isample < MAXIMUM_SAMPLES_PER_CHANNEL; isample++) {
251  ptr[tp_words_total] = chanid | (tp_samples[ichan * MAXIMUM_SAMPLES_PER_CHANNEL + isample] & 0x3FF);
252  tp_words_total++;
253  }
254  }
255  }
256 
257  // daq words
258  ptr = m_ownData + headerLen + tp_words_total;
259  for (ichan = 0; ichan < 24; ichan++) {
260  unsigned short chanid = ((ichan % 3) + ((ichan / 3) << 2)) << 11;
261  for (isample = 0; isample < daq_lengths[ichan] && isample < MAXIMUM_SAMPLES_PER_CHANNEL; isample++) {
262  unsigned short basedata = daq_samples[ichan * MAXIMUM_SAMPLES_PER_CHANNEL + isample] & 0x7FF;
263  if (do_capid)
264  basedata = (basedata & 0x7F) | (0x200) | ((isample % 4) << 7);
265  ptr[daq_words_total] = chanid | basedata;
266  daq_words_total++;
267  }
268  }
269  unsigned short totalLen;
270  if (m_formatVersion == -1) {
271  m_ownData[5] = (tp_words_total << 8) | 0x1;
272  totalLen = headerLen + tp_words_total + daq_words_total + trailerLen;
273  m_rawLength = totalLen;
274  m_ownData[totalLen - 3] = totalLen;
275  m_ownData[totalLen - 4] = (tp_words_total / CHANNELS_PER_SPIGOT) | ((daq_words_total / CHANNELS_PER_SPIGOT) << 8);
276  } else {
277  m_ownData[5] = (tp_words_total << 8) | 0x1;
278  totalLen = headerLen + tp_words_total + daq_words_total + trailerLen;
279  if ((totalLen % 2) == 1) {
280  m_ownData[totalLen - 4] = 0xFFFF; // parity word
281  totalLen++; // round to even number of 16-bit words
282  }
283  m_rawLength = totalLen;
284  m_ownData[totalLen - 2] = totalLen / 2; // 32-bit words
285  m_ownData[totalLen - 3] = totalLen;
286  m_ownData[totalLen - 4] = daq_words_total;
287  }
288  if (trailerLen == 12) { // initialize extra trailer words if present
289  for (int i = 12; i > 4; i--)
290  m_ownData[totalLen - i] = 0;
291  }
292 }
unsigned short * m_ownData
Definition: HcalHTRData.h:247
int m_formatVersion
Definition: HcalHTRData.h:244
void determineStaticLengths(int &headerWords, int &trailerWords) const
Definition: HcalHTRData.cc:148
static const int CHANNELS_PER_SPIGOT
Definition: HcalHTRData.h:18
static const int MAXIMUM_SAMPLES_PER_CHANNEL
Definition: HcalHTRData.h:19
void HcalHTRData::packHeaderTrailer ( int  L1Anumber,
int  bcn,
int  submodule,
int  orbitn,
int  pipeline,
int  ndd,
int  nps,
int  firmwareRev = 0,
int  firmwareFlav = 0 
)

pack header and trailer (call after pack)

Definition at line 294 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, and m_rawLength.

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

302  {
303  m_ownData[0] = L1Anumber & 0xFF;
304  m_ownData[1] = (L1Anumber & 0xFFFF00) >> 8;
305  if (m_formatVersion == -1) {
306  m_ownData[2] = ((pipeline & 0x7F) << 8); // no error bits
307  m_ownData[3] = ((orbitn & 0xFF) << 8) | (submodule & 0xFF);
308  m_ownData[4] = bcn & 0xFFF;
309  // m_ownData[5]&=0xFF01;
310  } else {
311  m_ownData[2] = 0x8000; // Version is valid, no error bits
312  if (m_formatVersion == 0)
313  m_ownData[3] = ((orbitn & 0x3F) << 10) | (submodule & 0x3FF);
314  else
315  m_ownData[3] = ((orbitn & 0x1F) << 11) | (submodule & 0x7FF);
316  m_ownData[4] = ((m_formatVersion & 0xF) << 12) | (bcn & 0xFFF);
317  m_ownData[5] |= ((nps & 0x1F) << 3) | 0x1;
318  m_ownData[6] = ((firmwareRev & 0x70000) >> 3) | (firmwareRev & 0x1FFF);
319  m_ownData[7] = (pipeline & 0xFF) | ((firmwareFlav & 0x3F) << 8);
320  m_ownData[m_rawLength - 4] &= 0x7FF;
321  m_ownData[m_rawLength - 4] |= (ndd & 0x1F) << 11;
322  }
323  m_ownData[m_rawLength - 2] = m_rawLength / 2; // 32-bit words
324  m_ownData[m_rawLength - 1] = (L1Anumber & 0xFF) << 8;
325 }
unsigned short * m_ownData
Definition: HcalHTRData.h:247
int m_formatVersion
Definition: HcalHTRData.h:244
void HcalHTRData::packUnsuppressed ( const bool *  mp)

pack trailer with Mark and Pass bits

Definition at line 327 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, m_rawLength, and heppy_batch::val.

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

327  {
328  if (m_formatVersion < 4)
329  return;
330 
331  for (int fiber = 1; fiber <= 8; fiber++) {
332  for (int fiberchan = 0; fiberchan <= 2; fiberchan++) {
333  int linchan = (fiber - 1) * 3 + fiberchan;
334 
335  unsigned short& val = m_ownData[m_rawLength - 12 + (linchan / 8)];
336  if (mp[linchan])
337  val |= 1 << (linchan % 8);
338  }
339  }
340 
341  // set the unsupressed bit
342  m_ownData[6] |= 0x8000;
343 }
unsigned short * m_ownData
Definition: HcalHTRData.h:247
int m_formatVersion
Definition: HcalHTRData.h:244
unsigned int HcalHTRData::readoutVMECrateId ( ) const

HcalElectronicsId-style VME crate number.

Definition at line 373 of file HcalHTRData.cc.

References getSubmodule().

Referenced by getBunchNumber(), and HcalTriggerPrimitiveAlgo::runFEFormatError().

373  {
374  const unsigned int smid = getSubmodule();
375  return ((smid >> 6) & 0x1F);
376 }
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:355
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 178 of file HcalHTRData.cc.

References channelDecoder, CHANNELS_PER_SPIGOT, determineSectionLengths(), m_rawConst, MAXIMUM_SAMPLES_PER_CHANNEL, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by getRawLength().

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

References RecoTauValidation_cfi::header.

Referenced by getRawLength(), ZdcUnpacker::unpack(), ZdcUnpacker_impl::unpack_compact(), HcalUnpacker_impl::unpack_compact(), and HcalUnpacker::unpackVME().

456  {
457  flav = (header >> 12) & 0x7;
458  error_flags = (header >> 10) & 0x3;
459  capid0 = (header >> 8) & 0x3;
460  channelid = (header)&0xFF;
461  return (header & 0x8000) != 0;
462 }
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 464 of file HcalHTRData.cc.

References getHistogramFibers(), mps_fire::i, isHistogramEvent(), m_formatVersion, m_rawConst, and hltrates_dqm_sourceclient-live_cfg::offset.

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

464  {
465  // check for histogram mode
466  if (!isHistogramEvent())
467  return false;
468 
469  int fiber1, fiber2;
470  getHistogramFibers(fiber1, fiber2);
471  if (fiber1 != myfiber && fiber2 != myfiber)
472  return false;
473 
474  if (m_formatVersion == -1) {
475  int offset = 6 + mysc * 4 * 32 + capid * 32;
476  if (myfiber == fiber2)
477  offset += 3 * 4 * 32; // skip to the second half...
478  for (int i = 0; i < 32; i++)
479  histogram[i] = m_rawConst[offset + i];
480  return true;
481  } else {
482  int offset = 8 + mysc * 4 * 32 + capid * 32;
483  if (myfiber == fiber2)
484  offset += 3 * 4 * 32; // skip to the second half...
485  for (int i = 0; i < 32; i++)
486  histogram[i] = m_rawConst[offset + i];
487  return true;
488  }
489 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
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:435
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:409
bool HcalHTRData::wasHistogramError ( int  ifiber) const

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

Definition at line 447 of file HcalHTRData.cc.

References isHistogramEvent(), and m_rawConst.

Referenced by getExtHdr8().

447  {
448  bool retval = !isHistogramEvent();
449  if (!retval) {
450  retval = ((m_rawConst[7]) & (1 << ifiber)) != 0;
451  }
452  return retval;
453 }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:409
bool HcalHTRData::wasMarkAndPassZS ( int  fiber,
int  fiberchan 
) const

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

Definition at line 379 of file HcalHTRData.cc.

References isUnsuppressed(), m_formatVersion, m_rawConst, m_rawLength, heppy_batch::val, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by getBunchNumber(), CastorUnpacker_impl::unpack(), HcalUnpacker_impl::unpack(), ZdcUnpacker_impl::unpack_compact(), and HcalUnpacker_impl::unpack_compact().

379  {
380  if (fiber < 1 || fiber > 8 || fiberchan < 0 || fiberchan > 2)
381  return false;
382  if (!isUnsuppressed() || m_formatVersion < 5)
383  return false;
384  int linchan = (fiber - 1) * 3 + fiberchan;
385 
386  unsigned short val = m_rawConst[m_rawLength - 12 + (linchan / 8)];
387  return ((val >> (linchan % 8)) & 0x1) != 0;
388 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:378
bool HcalHTRData::wasMarkAndPassZSTP ( int  slb,
int  slbchan 
) const

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

Definition at line 389 of file HcalHTRData.cc.

References isUnsuppressed(), m_formatVersion, m_rawConst, m_rawLength, and heppy_batch::val.

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

389  {
390  if (slb < 1 || slb > 6 || slbchan < 0 || slbchan > 3)
391  return false;
392  if (!isUnsuppressed() || m_formatVersion < 5)
393  return false;
394  int linchan = (slb - 1) * 4 + slbchan;
395 
396  unsigned short val = m_rawConst[m_rawLength - 12 + (linchan / 8)];
397  return ((val >> (linchan % 8)) & 0x100) != 0;
398 }
static int slb(const HcalTriggerPrimitiveSample &theSample)
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:378
uint32_t HcalHTRData::zsBunchMask ( ) const

ZS Bunch Mask (if available)

Definition at line 400 of file HcalHTRData.cc.

References isUnsuppressed(), m_formatVersion, m_rawConst, and m_rawLength.

Referenced by getBunchNumber(), CastorUnpacker_impl::unpack(), HcalUnpacker_impl::unpack(), ZdcUnpacker_impl::unpack_compact(), and HcalUnpacker_impl::unpack_compact().

400  {
401  uint32_t mask = 0;
402  if (isUnsuppressed() && m_formatVersion >= 5) {
403  mask = m_rawConst[m_rawLength - 5] | ((m_rawConst[m_rawLength - 6] & 0xF000) << 4);
404  }
405  return mask;
406 }
int m_formatVersion
Definition: HcalHTRData.h:244
const unsigned short * m_rawConst
Definition: HcalHTRData.h:246
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:378

Member Data Documentation

const int HcalHTRData::CHANNELS_PER_SPIGOT = 24
static
const int HcalHTRData::FORMAT_VERSION_COMPACT_DATA = 6
static

Definition at line 20 of file HcalHTRData.h.

Referenced by HcalUnpacker::unpackVME().

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 19 of file HcalHTRData.h.

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