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:255
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
HcalHTRData::~HcalHTRData ( )
inline

Definition at line 23 of file HcalHTRData.h.

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

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

Definition at line 22 of file HcalHTRData.cc.

References allocate().

22  : m_formatVersion(version_to_create) {
23  allocate(version_to_create);
24 }
int m_formatVersion
Definition: HcalHTRData.h:252
void allocate(int version_to_create=0)
Definition: HcalHTRData.cc:26
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:255
void adoptData(const unsigned short *data, int length)
Definition: HcalHTRData.cc:47
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
HcalHTRData::HcalHTRData ( const HcalHTRData hd)

Definition at line 20 of file HcalHTRData.cc.

unsigned short * m_ownData
Definition: HcalHTRData.h:255
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254

Member Function Documentation

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

Definition at line 47 of file HcalHTRData.cc.

References data, m_formatVersion, m_rawConst, and m_rawLength.

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

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

Definition at line 26 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, m_rawConst, and m_rawLength.

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

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

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

References determineSectionLengths(), and m_rawConst.

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

157  {
158  int tp_words_total, daq_words_total, headerLen, trailerLen;
159  determineSectionLengths(tp_words_total,daq_words_total,headerLen,trailerLen);
160 
161  *tp_first=m_rawConst+headerLen;
162  *tp_last=*tp_first+(tp_words_total-1);
163  *daq_first=*tp_last+1;
164  *daq_last=*daq_first+(daq_words_total-1);
165 }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
void determineSectionLengths(int &tpWords, int &daqWords, int &headerWords, int &trailerWords) const
Definition: HcalHTRData.cc:125
void HcalHTRData::determineSectionLengths ( int &  tpWords,
int &  daqWords,
int &  headerWords,
int &  trailerWords 
) const
protected

Definition at line 125 of file HcalHTRData.cc.

References CHANNELS_PER_SPIGOT, m_formatVersion, m_rawConst, and m_rawLength.

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

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

Definition at line 141 of file HcalHTRData.cc.

References m_formatVersion.

Referenced by getExtHdr8(), and pack().

141  {
142  if (m_formatVersion==-1) {
143  headerWords=6;
144  trailerWords=12;
145  } else if (m_formatVersion<5) {
146  headerWords=8;
147  trailerWords=4; // minimum, may be more...
148  } else {
149  headerWords=8;
150  trailerWords=12; // minimum, may be more...
151  }
152 }
int m_formatVersion
Definition: HcalHTRData.h:252
unsigned int HcalHTRData::getBunchNumber ( ) const
inline
unsigned int HcalHTRData::getDLLunlock ( ) const
inline

Get DLLunlock bits.

Definition at line 170 of file HcalHTRData.h.

References m_rawConst.

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

Get the errors word.

Definition at line 157 of file HcalHTRData.h.

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

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

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

Get the HTR Ext Header words.

Definition at line 217 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 219 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 221 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 223 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 225 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 227 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 229 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 231 of file HcalHTRData.h.

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

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

Get the BCN of the Fiber Orbit Messages.

Definition at line 183 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

183  {
184  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-12]&0xFFF);
185 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
unsigned int HcalHTRData::getFib2OrbMsgBCN ( ) const
inline

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-11]&0xFFF);
188 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
unsigned int HcalHTRData::getFib3OrbMsgBCN ( ) const
inline

Definition at line 190 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

190  {
191  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-10]&0xFFF);
192 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
unsigned int HcalHTRData::getFib4OrbMsgBCN ( ) const
inline

Definition at line 194 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

194  {
195  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-9]&0xFFF);
196 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
unsigned int HcalHTRData::getFib5OrbMsgBCN ( ) const
inline

Definition at line 198 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

198  {
199  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-8]&0xFFF);
200 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
unsigned int HcalHTRData::getFib6OrbMsgBCN ( ) const
inline

Definition at line 202 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

202  {
203  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-7]&0xFFF);
204 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
unsigned int HcalHTRData::getFib7OrbMsgBCN ( ) const
inline

Definition at line 206 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

206  {
207  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-6]&0xFFF);
208 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
unsigned int HcalHTRData::getFib8OrbMsgBCN ( ) const
inline

Definition at line 210 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

210  {
211  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-5]&0xFFF);
212 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
unsigned int HcalHTRData::getFibOrbMsgBCN ( int  fiber) const
inline

Get the BCN of the Fiber Orbit Messages.

Definition at line 178 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().

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

Get the HTR firmware flavor.

Definition at line 410 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

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

Get the HTR firmware version.

Definition at line 407 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

407  {
408  return (m_formatVersion==-1)?(0):((m_rawConst[6]&0x1FFF)+((m_rawConst[6]&0xE000)<<3));
409 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
int HcalHTRData::getFormatVersion ( ) const
inline

Get the version number of this event.

Definition at line 33 of file HcalHTRData.h.

References m_formatVersion.

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

33 { return m_formatVersion; }
int m_formatVersion
Definition: HcalHTRData.h:252
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 414 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

414  {
415  a=-1;
416  b=-1;
417  if (m_formatVersion==-1) {
418  a=((m_rawConst[2]&0x0F00)>>8);
419  b=((m_rawConst[2]&0xF000)>>12);
420  } else {
421  a=((m_rawConst[5]&0x0F00)>>8)+1;
422  b=((m_rawConst[5]&0xF000)>>12)+1;
423  }
424 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
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 111 of file HcalHTRData.h.

References m_rawConst.

Referenced by RawTask::_process().

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

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

Definition at line 389 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and m_rawLength.

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

389  {
390  return (m_formatVersion==-1)?(m_rawConst[m_rawLength-4]>>8):(m_rawConst[m_rawLength-4]>>11);
391 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
int HcalHTRData::getNPrecisionWords ( ) const

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

Definition at line 398 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by getErrorsWord().

398  {
399  return (m_formatVersion==-1)?(m_rawConst[m_rawLength-4]&0xFF):(m_rawConst[m_rawLength-4]&0x7FF);
400 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
int HcalHTRData::getNPS ( ) const

Get the number of presamples in daq data.

Definition at line 401 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

401  {
402  return (m_formatVersion==-1)?(0):((m_rawConst[5]>>3)&0x1F);
403 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
int HcalHTRData::getNTP ( ) const

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

Definition at line 392 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by getErrorsWord().

392  {
393  int retval=-1;
394  if (m_formatVersion==-1) retval=m_rawConst[m_rawLength-4]&0xFF;
395  else if (m_formatVersion<3) retval=m_rawConst[m_rawLength-4]>>11;
396  return retval;
397 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
unsigned int HcalHTRData::getOrbitNumber ( ) const

Get the HTR orbit number.

Definition at line 325 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

325  {
326  switch (m_formatVersion) {
327  case (-1) : return (m_rawConst[3]>>8);
328  case (0) : return (m_rawConst[3]>>10);
329  default : return (m_rawConst[3]>>11);
330  }
331 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
unsigned int HcalHTRData::getPipelineLength ( ) const

Get the pipeline length used for this event.

Definition at line 404 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

404  {
405  return (m_formatVersion==-1)?(m_rawConst[2]>>8):(m_rawConst[7]&0xFF);
406 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
const unsigned short* HcalHTRData::getRawData ( ) const
inline

Get a pointer to the raw data.

Definition at line 36 of file HcalHTRData.h.

References m_rawConst.

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

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

Get the HTR submodule number.

Definition at line 332 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().

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

Get TTCready bit.

Definition at line 174 of file HcalHTRData.h.

References m_rawConst.

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

HcalElectronicsId-style HTR slot.

Definition at line 339 of file HcalHTRData.cc.

References getSubmodule().

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

339  {
340  const unsigned int smid = getSubmodule();
341  return ((smid>>1)&0x1F);
342 }
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:332
unsigned int HcalHTRData::htrTopBottom ( ) const

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

Definition at line 343 of file HcalHTRData.cc.

References getSubmodule().

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

343  {
344  const unsigned int smid = getSubmodule();
345  return (smid&0x01);
346 }
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:332
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 90 of file HcalHTRData.h.

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

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

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

Definition at line 117 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and globals_cff::x2.

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

117  {
118  if (m_formatVersion==-1) {
119  return false; // too old to care.
120  } else {
121  return (m_rawConst[2]&0x2)!=0;
122  }
123 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
bool HcalHTRData::isCalibrationStream ( ) const

Is this event a calibration-stream event?

Definition at line 351 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by getBunchNumber().

351  {
352  return (m_formatVersion==-1)?(false):(m_rawConst[2]&0x4000);
353 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
bool HcalHTRData::isEmptyEvent ( ) const

Definition at line 100 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

100  {
101  if (m_formatVersion==-1) {
102  return (m_rawConst[2]&0x20)!=0;
103  } else {
104  return (m_rawConst[2]&0x4)!=0;
105  }
106 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
bool HcalHTRData::isHistogramEvent ( ) const

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

Definition at line 386 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().

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

Definition at line 109 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and globals_cff::x1.

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

109  {
110  if (m_formatVersion==-1) {
111  return false; // too old to care.
112  } else {
113  return (m_rawConst[2]&0x1)!=0;
114  }
115 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
bool HcalHTRData::isPatternRAMEvent ( ) const

Is this event a pattern-ram event?

Definition at line 383 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by getBunchNumber().

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

Definition at line 38 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, m_rawConst, and m_rawLength.

Referenced by ~HcalHTRData().

38  {
39  if (m_ownData==nullptr) {
43  }
44  return (*this);
45 }
unsigned short * m_ownData
Definition: HcalHTRData.h:255
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
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 225 of file HcalHTRData.cc.

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

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

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

References m_formatVersion, m_ownData, and m_rawLength.

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

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

pack trailer with Mark and Pass bits

Definition at line 309 of file HcalHTRData.cc.

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

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

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

HcalElectronicsId-style VME crate number.

Definition at line 347 of file HcalHTRData.cc.

References getSubmodule().

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

347  {
348  const unsigned int smid = getSubmodule();
349  return ((smid>>6)&0x1F);
350 }
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:332
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 173 of file HcalHTRData.cc.

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

Referenced by getRawLength().

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

References RecoTauValidation_cfi::header.

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

434  {
435  flav=(header>>12)&0x7;
436  error_flags=(header>>10)&0x3;
437  capid0=(header>>8)&0x3;
438  channelid=(header)&0xFF;
439  return (header&0x8000)!=0;
440 }
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 442 of file HcalHTRData.cc.

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

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

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

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

Definition at line 426 of file HcalHTRData.cc.

References isHistogramEvent(), and m_rawConst.

Referenced by getExtHdr8().

426  {
427  bool retval=!isHistogramEvent();
428  if (!retval) {
429  retval=((m_rawConst[7])&(1<<ifiber))!=0;
430  }
431  return retval;
432 }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:386
bool HcalHTRData::wasMarkAndPassZS ( int  fiber,
int  fiberchan 
) const

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

Definition at line 357 of file HcalHTRData.cc.

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

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

357  {
358  if (fiber<1 || fiber>8 || fiberchan<0 || fiberchan>2) return false;
359  if (!isUnsuppressed() || m_formatVersion<5) return false;
360  int linchan=(fiber-1)*3+fiberchan;
361 
362  unsigned short val=m_rawConst[m_rawLength-12+(linchan/8)];
363  return ((val>>(linchan%8))&0x1)!=0;
364 }
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:354
bool HcalHTRData::wasMarkAndPassZSTP ( int  slb,
int  slbchan 
) const

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

Definition at line 365 of file HcalHTRData.cc.

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

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

365  {
366  if (slb<1 || slb>6 || slbchan<0 || slbchan>3) return false;
367  if (!isUnsuppressed() || m_formatVersion<5) return false;
368  int linchan=(slb-1)*4+slbchan;
369 
370  unsigned short val=m_rawConst[m_rawLength-12+(linchan/8)];
371  return ((val>>(linchan%8))&0x100)!=0;
372 }
static int slb(const HcalTriggerPrimitiveSample &theSample)
int m_formatVersion
Definition: HcalHTRData.h:252
const unsigned short * m_rawConst
Definition: HcalHTRData.h:254
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:354
uint32_t HcalHTRData::zsBunchMask ( ) const

ZS Bunch Mask (if available)

Definition at line 374 of file HcalHTRData.cc.

References isUnsuppressed(), m_formatVersion, m_rawConst, m_rawLength, and RecoTauDiscriminantConfiguration::mask.

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

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

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