CMS 3D CMS Logo

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

#include <HcalHTRData.h>

Public Member Functions

void adoptData (const unsigned short *data, int length)
 
void allocate (int version_to_create=0)
 
bool check () const
 Check for a good event Requires a minimum length, matching wordcount and length, not an empty event. More...
 
void dataPointers (const unsigned short **daq_first, const unsigned short **daq_last, const unsigned short **tp_first, const unsigned short **tp_last) const
 Obtain the starting and ending pointers for external unpacking of the data. More...
 
unsigned int getBunchNumber () const
 Get the HTR bunch number. More...
 
unsigned int getDLLunlock () const
 Get DLLunlock bits. More...
 
unsigned int getErrorsWord () const
 Get the errors word. More...
 
unsigned int getExtHdr1 () const
 Get the HTR Ext Header words. More...
 
unsigned int getExtHdr2 () const
 
unsigned int getExtHdr3 () const
 
unsigned int getExtHdr4 () const
 
unsigned int getExtHdr5 () const
 
unsigned int getExtHdr6 () const
 
unsigned int getExtHdr7 () const
 
unsigned int getExtHdr8 () const
 
unsigned int getFib1OrbMsgBCN () const
 Get the BCN of the Fiber Orbit Messages. More...
 
unsigned int getFib2OrbMsgBCN () const
 
unsigned int getFib3OrbMsgBCN () const
 
unsigned int getFib4OrbMsgBCN () const
 
unsigned int getFib5OrbMsgBCN () const
 
unsigned int getFib6OrbMsgBCN () const
 
unsigned int getFib7OrbMsgBCN () const
 
unsigned int getFib8OrbMsgBCN () const
 
unsigned int getFibOrbMsgBCN (int fiber) const
 Get the BCN of the Fiber Orbit Messages. More...
 
int getFirmwareFlavor () const
 Get the HTR firmware flavor. More...
 
unsigned int getFirmwareRevision () const
 Get the HTR firmware version. More...
 
int getFormatVersion () const
 Get the version number of this event. More...
 
void getHistogramFibers (int &a, int &b) const
 Get the fiber numbers for the data present in this event (only in histogram mode!) More...
 
unsigned int getL1ANumber () const
 Get the HTR event number. More...
 
int getNDD () const
 Get the number of daq data samples per channel when not zero-suppressed. More...
 
int getNPrecisionWords () const
 Get the total number of precision data 16-bit words. More...
 
int getNPS () const
 Get the number of presamples in daq data. More...
 
int getNTP () const
 Get the number of trigger data samples when not zero-suppressed (not available after FW 4) More...
 
unsigned int getOrbitNumber () const
 Get the HTR orbit number. More...
 
unsigned int getPipelineLength () const
 Get the pipeline length used for this event. More...
 
const unsigned short * getRawData () const
 Get a pointer to the raw data. More...
 
const int getRawLength () const
 Get the length of the raw data. More...
 
unsigned int getSubmodule () const
 Get the HTR submodule number. More...
 
unsigned int getTTCready () const
 Get TTCready bit. More...
 
 HcalHTRData ()
 
 HcalHTRData (int version_to_create)
 
 HcalHTRData (const unsigned short *data, int length)
 
 HcalHTRData (const HcalHTRData &)
 
unsigned int htrSlot () const
 HcalElectronicsId-style HTR slot. More...
 
unsigned int htrTopBottom () const
 HcalElectronicsId-style HTR top/bottom (1=top/0=bottom) More...
 
bool isBusy () const
 
bool isCalibrationStream () const
 Is this event a calibration-stream event? More...
 
bool isEmptyEvent () const
 
bool isHistogramEvent () const
 Is this event a histogram event? (do not call standard unpack in this case!!!!!) More...
 
bool isOverflowWarning () const
 
bool isPatternRAMEvent () const
 Is this event a pattern-ram event? More...
 
bool isUnsuppressed () const
 Is this event an unsuppresed event? More...
 
HcalHTRDataoperator= (const HcalHTRData &)
 
void pack (unsigned char *daq_lengths, unsigned short *daq_samples, unsigned char *tp_lengths, unsigned short *tp_samples, bool do_capid=false)
 Unpack the HTR data into TP and DAQ data sorted by channel. More...
 
void packHeaderTrailer (int L1Anumber, int bcn, int submodule, int orbitn, int pipeline, int ndd, int nps, int firmwareRev=0)
 pack header and trailer (call after pack) More...
 
void packUnsuppressed (const bool *mp)
 pack trailer with Mark and Pass bits More...
 
unsigned int readoutVMECrateId () const
 HcalElectronicsId-style VME crate number. More...
 
void unpack (unsigned char *daq_lengths, unsigned short *daq_samples, unsigned char *tp_lengths, unsigned short *tp_samples) const
 Unpack the HTR data into TP and DAQ data sorted by channel. More...
 
bool unpackHistogram (int fiber, int fiberchan, int capid, unsigned short *histogram) const
 Unpack special histogramming mode data. More...
 
bool wasHistogramError (int ifiber) const
 Was there an error on the given fiber for this event (only in histogram mode!) More...
 
bool wasMarkAndPassZS (int fiber, int fiberchan) const
 Was this channel passed as part of Mark&Pass ZS? More...
 
bool wasMarkAndPassZSTP (int slb, int slbchan) const
 Was this channel passed as part of Mark&Pass ZS? More...
 
uint32_t zsBunchMask () const
 ZS Bunch Mask (if available) More...
 
 ~HcalHTRData ()
 

Static Public Member Functions

static bool is_channel_header (unsigned short value)
 check top bit to see if this is a compact format channel header word More...
 
static bool unpack_per_channel_header (unsigned short, int &flav, int &error_flags, int &capid0, int &channelid)
 Unpack a per-channel header word (compact format) More...
 

Static Public Attributes

static const int CHANNELS_PER_SPIGOT = 24
 
static const int FORMAT_VERSION_COMPACT_DATA = 6
 
static const int MAXIMUM_SAMPLES_PER_CHANNEL = 20
 

Protected Member Functions

void determineSectionLengths (int &tpWords, int &daqWords, int &headerWords, int &trailerWords) const
 
void determineStaticLengths (int &headerWords, int &trailerWords) const
 

Protected Attributes

int m_formatVersion
 
unsigned short * m_ownData
 
const unsigned short * m_rawConst
 
int m_rawLength
 

Detailed Description

Interpretive class for HcalHTRData Since this class requires external specification of the length of the data, it is implemented as an interpreter, rather than a cast-able header class.

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.

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

Definition at line 23 of file HcalHTRData.h.

References m_ownData.

23 { if (m_ownData!=0) delete [] m_ownData; }
unsigned short * m_ownData
Definition: HcalHTRData.h:254
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:251
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=0;
19 }
unsigned short * m_ownData
Definition: HcalHTRData.h:254
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:254
int m_formatVersion
Definition: HcalHTRData.h:251
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253

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(), 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:251
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253
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(), and HcalPacker::pack().

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:254
int m_formatVersion
Definition: HcalHTRData.h:251
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253
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(), isHistogramEvent(), m_formatVersion, m_rawConst, and m_rawLength.

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

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:251
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:385
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 153 of file HcalHTRData.cc.

References determineSectionLengths(), and m_rawConst.

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

156  {
157  int tp_words_total, daq_words_total, headerLen, trailerLen;
158  determineSectionLengths(tp_words_total,daq_words_total,headerLen,trailerLen);
159 
160  *tp_first=m_rawConst+headerLen;
161  *tp_last=*tp_first+(tp_words_total-1);
162  *daq_first=*tp_last+1;
163  *daq_last=*daq_first+(daq_words_total-1);
164 }
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253
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(), 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  headerWords=8;
136  trailerWords=4; // minimum, may be more...
137  }
138 }
int m_formatVersion
Definition: HcalHTRData.h:251
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253
static const int CHANNELS_PER_SPIGOT
Definition: HcalHTRData.h:18
void HcalHTRData::determineStaticLengths ( int &  headerWords,
int &  trailerWords 
) const
protected

Definition at line 140 of file HcalHTRData.cc.

References m_formatVersion.

Referenced by pack().

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

Get the HTR bunch number.

Definition at line 114 of file HcalHTRData.h.

References m_rawConst.

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

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

Get DLLunlock bits.

Definition at line 169 of file HcalHTRData.h.

References m_rawConst.

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

Get the errors word.

Definition at line 156 of file HcalHTRData.h.

References m_rawConst.

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

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

Get the HTR Ext Header words.

Definition at line 216 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 218 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 220 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 222 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 224 of file HcalHTRData.h.

References m_rawConst.

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

Definition at line 226 of file HcalHTRData.h.

References m_rawConst.

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

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

Definition at line 228 of file HcalHTRData.h.

References m_rawConst.

Referenced by HcalRawDataMonitor::unpack().

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

Definition at line 230 of file HcalHTRData.h.

References m_rawConst.

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

Get the BCN of the Fiber Orbit Messages.

Definition at line 182 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

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

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

Definition at line 185 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

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

185  {
186  return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-11]&0xFFF);
187 }
int m_formatVersion
Definition: HcalHTRData.h:251
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253
unsigned int HcalHTRData::getFib3OrbMsgBCN ( ) const
inline

Definition at line 189 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

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

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

Definition at line 193 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

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

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

Definition at line 197 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

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

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

Definition at line 201 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

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

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

Definition at line 205 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

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

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

Definition at line 209 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

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

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

Get the BCN of the Fiber Orbit Messages.

Definition at line 177 of file HcalHTRData.h.

References m_formatVersion, m_rawConst, and m_rawLength.

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

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

Get the HTR firmware flavor.

Definition at line 409 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

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

Get the HTR firmware version.

Definition at line 406 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

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

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

References m_formatVersion, and m_rawConst.

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

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

References m_rawConst.

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

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

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

Definition at line 388 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and m_rawLength.

Referenced by HcalDigiMonitor::analyze(), HcalTTPUnpacker::unpack(), and HcalRawDataMonitor::unpack().

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

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

Definition at line 397 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and m_rawLength.

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

Get the number of presamples in daq data.

Definition at line 400 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

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

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

Definition at line 391 of file HcalHTRData.cc.

References m_formatVersion, m_rawConst, and m_rawLength.

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

Get the HTR orbit number.

Definition at line 324 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by HcalRawDataMonitor::unpack().

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

Get the pipeline length used for this event.

Definition at line 403 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by HcalTTPUnpacker::unpack().

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

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

Get the HTR submodule number.

Definition at line 331 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

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

Get TTCready bit.

Definition at line 173 of file HcalHTRData.h.

References m_rawConst.

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

HcalElectronicsId-style HTR slot.

Definition at line 338 of file HcalHTRData.cc.

References getSubmodule().

Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalRawDataMonitor::HTRPrint(), HcalTriggerPrimitiveAlgo::runFEFormatError(), and HcalRawDataMonitor::unpack().

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

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

Definition at line 342 of file HcalHTRData.cc.

References getSubmodule().

Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalRawDataMonitor::HTRPrint(), HcalTriggerPrimitiveAlgo::runFEFormatError(), and HcalRawDataMonitor::unpack().

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

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

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

Definition at line 117 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

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:251
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253
bool HcalHTRData::isCalibrationStream ( ) const

Is this event a calibration-stream event?

Definition at line 350 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

Definition at line 100 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by HcalEmptyEventFilter::filter(), and HcalUnpacker::unpack().

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:251
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253
bool HcalHTRData::isHistogramEvent ( ) const

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

Definition at line 385 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

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

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

Definition at line 109 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

Referenced by HcalUnpacker::unpack().

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:251
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253
bool HcalHTRData::isPatternRAMEvent ( ) const

Is this event a pattern-ram event?

Definition at line 382 of file HcalHTRData.cc.

References m_formatVersion, and m_rawConst.

382  {
383  return (m_formatVersion==-1)?(false):(m_rawConst[2]&0x1000);
384 }
int m_formatVersion
Definition: HcalHTRData.h:251
const unsigned short * m_rawConst
Definition: HcalHTRData.h:253
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.

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

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

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

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

pack header and trailer (call after pack)

Definition at line 283 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, and m_rawLength.

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

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

pack trailer with Mark and Pass bits

Definition at line 308 of file HcalHTRData.cc.

References m_formatVersion, m_ownData, and m_rawLength.

Referenced by HcalPacker::pack().

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

HcalElectronicsId-style VME crate number.

Definition at line 346 of file HcalHTRData.cc.

References getSubmodule().

Referenced by HcalMonitorModule::CheckSubdetectorStatus(), HcalRawDataMonitor::HTRPrint(), HcalTriggerPrimitiveAlgo::runFEFormatError(), and HcalRawDataMonitor::unpack().

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

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

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

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

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

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

Referenced by HcalUnpacker::unpack().

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

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

Definition at line 425 of file HcalHTRData.cc.

References isHistogramEvent(), and m_rawConst.

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

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

Definition at line 356 of file HcalHTRData.cc.

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

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

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

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

Definition at line 364 of file HcalHTRData.cc.

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

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

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

ZS Bunch Mask (if available)

Definition at line 373 of file HcalHTRData.cc.

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

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

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

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

int HcalHTRData::m_formatVersion
protected
unsigned short* HcalHTRData::m_ownData
protected
const unsigned short* HcalHTRData::m_rawConst
protected
int HcalHTRData::m_rawLength
protected
const int HcalHTRData::MAXIMUM_SAMPLES_PER_CHANNEL = 20
static

Definition at line 19 of file HcalHTRData.h.

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