CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
MatacqRawEvent Class Reference

#include <MatacqRawEvent.h>

Classes

struct  ChannelData
 
struct  field32spec_t
 
struct  int16le_t
 
struct  uint16le_t
 
struct  uint32le_t
 

Public Types

enum  matacqError_t { errorLengthConsistency = 1 << 0, errorLength = 1 << 1, errorWrongBoe = 1 << 2 }
 

Public Member Functions

int getAttenuation_dB () const
 
int getBoe () const
 
int getBxId () const
 
int getChannelCount () const
 
const std::vector< ChannelData > & getChannelData () const
 
unsigned getDaqLen () const
 
int getDccErrors () const
 
unsigned getDccLen () const
 
int getDelayA () const
 
int getEmtcDelay () const
 
int getEmtcPhase () const
 
unsigned getEventId () const
 
int getFedId () const
 
int getFov () const
 
int getFreqGHz () const
 
int getH1Marker () const
 
int getLaserPower () const
 
int getMatacqDataFormatVersion () const
 
uint32_t getOrbitId () const
 
int getParsedLen ()
 
int getPostTrig () const
 
unsigned getRunNum () const
 
int32_t getStatus () const
 
time_t getTimeStamp () const
 
void getTimeStamp (struct timeval &t) const
 
int getTriggerType () const
 
int getTrigRec () const
 
int getTTrigPs () const
 
std::vector< int > getVernier () const
 
 MatacqRawEvent (const unsigned char *dataBuffer, size_t bufferSize)
 

Static Public Member Functions

static unsigned getDccLen (unsigned char *data, size_t size)
 
static unsigned getOrbitId (unsigned char *data, size_t size)
 
static unsigned getRunNum (unsigned char *data, size_t size)
 

Private Member Functions

void setRawData (const unsigned char *buffer, size_t bufferSize)
 

Static Private Member Functions

static int read32 (const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
 

Private Attributes

int attenuation_dB
 
int boe
 
int bxId
 
int channelCount
 
std::vector< ChannelDatachannelData
 
const uint32le_tdaqHeader
 
int dccErrors
 
unsigned dccLen
 
int delayA
 
int emtcDelay
 
int emtcPhase
 
int32_t error
 
unsigned eventId
 
int fedId
 
int fov
 
int fragLen
 
int freqGHz
 
int h1Marker
 
int laserPower
 
int matacqDataFormatVersion
 
uint32_t orbitId
 
int parsedLen
 
int postTrig
 
uint16le_tpSamples
 
unsigned runNum
 
struct timeval timeStamp
 
int triggerType
 
int trigRec
 
int tTrigPs
 
std::vector< int > vernier
 

Static Private Attributes

static const field32spec_t fov32 = {0, 0x000000F0}
 
static const field32spec_t fedId32 = {0, 0x000FFF00}
 
static const field32spec_t bxId32 = {0, 0xFFF00000}
 
static const field32spec_t lv132 = {1, 0x00FFFFFF}
 
static const field32spec_t triggerType32 = {1, 0x0F000000}
 
static const field32spec_t boeType32 = {1, 0xF0000000}
 
static const field32spec_t dccLen32 = {2, 0x00FFFFFF}
 
static const field32spec_t dccErrors32 = {2, 0xFF000000}
 
static const field32spec_t runNum32 = {3, 0x00FFFFFF}
 
static const field32spec_t h1Marker32 = {3, 0x3F000000}
 
static const field32spec_t formatVersion32 = {4, 0x0000FFFF}
 
static const field32spec_t freqGHz32 = {4, 0x00FF0000}
 
static const field32spec_t channelCount32 = {4, 0xFF000000}
 
static const field32spec_t timeStamp32 = {5, 0xFFFFFFFF}
 
static const field32spec_t tTrigPs32 = {6, 0xFFFFFFFF}
 
static const field32spec_t orbitId32 = {7, 0xFFFFFFFF}
 
static const field32spec_t trigRec32 = {11, 0xFF000000}
 
static const field32spec_t postTrig32 = {11, 0x0000FFFF}
 
static const field32spec_t vernier0_32 = {8, 0x0000FFFF}
 
static const field32spec_t vernier1_32 = {8, 0xFFFF0000}
 
static const field32spec_t vernier2_32 = {9, 0x0000FFFF}
 
static const field32spec_t vernier3_32 = {9, 0xFFFF0000}
 
static const field32spec_t timeStampMicroSec32 = {10, 0xFFFFFFFF}
 
static const field32spec_t laserPower32 = {12, 0x000000FF}
 
static const field32spec_t attenuation_dB32 = {12, 0x00000F00}
 
static const field32spec_t emtcPhase32 = {12, 0x0000F000}
 
static const field32spec_t emtcDelay32 = {12, 0xFFFF0000}
 
static const field32spec_t delayA32 = {13, 0x0000FFFF}
 
static const field32spec_t dccId32 = {13, 0x003F0000}
 
static const field32spec_t color32 = {13, 0x00600000}
 
static const field32spec_t trigType32 = {13, 0x07000000}
 
static const field32spec_t side32 = {13, 0x08000000}
 

Detailed Description

Wrapper for matacq raw event fragments. This class provides the method to interpret the data.

Definition at line 30 of file MatacqRawEvent.h.

Member Enumeration Documentation

Enumerator
errorLengthConsistency 

Event length is specified both in the data header and the trailer. This flags indicates an inconsitency between the two indications.

errorLength 

Error in data length.

errorWrongBoe 

Wrong Begin of event flag

Definition at line 33 of file MatacqRawEvent.h.

Constructor & Destructor Documentation

MatacqRawEvent::MatacqRawEvent ( const unsigned char *  dataBuffer,
size_t  bufferSize 
)
inline

Constuctor.

Parameters
dataBufferpointer to the raw data. Beware the data are not copied, therefore the data must be kept valid during the lifetime of the constructed object. pData must be aligned at least on 32-bit words.
bufferSizesize of the buffer pointed by dataBuffer and containing the data. The data themselves are allowed to be smaller than the buffer.
Exceptions
std::exceptionif the data cannot be decoded due to data corruption or truncation.

Definition at line 154 of file MatacqRawEvent.h.

References setRawData().

154  : vernier(std::vector<int>(4)) {
155  setRawData(dataBuffer, bufferSize);
156  }
std::vector< int > vernier
void setRawData(const unsigned char *buffer, size_t bufferSize)

Member Function Documentation

int MatacqRawEvent::getAttenuation_dB ( ) const
inline

Logarithmic attenuator setting in -10dB unit. Between 0 and 5*(-10dB), 0xF if unknown.

Definition at line 345 of file MatacqRawEvent.h.

References attenuation_dB.

Referenced by MatacqDataFormatter::interpretRawData().

345 { return attenuation_dB; }
int MatacqRawEvent::getBoe ( ) const
inline

Gets the beging of event field contents (BOE). Must be 0x5.

Returns
BOE

Definition at line 190 of file MatacqRawEvent.h.

References daqHeader, and read32().

190 { return read32(daqHeader, boeType32); }
static const field32spec_t boeType32
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
const uint32le_t * daqHeader
int MatacqRawEvent::getBxId ( ) const
inline

Gets the bunch crossing id field contents.

Returns
BX id

Definition at line 175 of file MatacqRawEvent.h.

References daqHeader, and read32().

Referenced by MatacqDataFormatter::interpretRawData(), and MatacqDataFormatter::printData().

175 { return read32(daqHeader, bxId32); }
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
const uint32le_t * daqHeader
static const field32spec_t bxId32
int MatacqRawEvent::getChannelCount ( ) const
inline

Gets the matacq channel count field contents.

Returns
number of channels

Definition at line 273 of file MatacqRawEvent.h.

References channelCount.

Referenced by MatacqDataFormatter::printData().

273 { return /*matacqHeader->*/ channelCount; }
const std::vector<ChannelData>& MatacqRawEvent::getChannelData ( ) const
inline

Gets the matacq channel data. Beware that no copy is done and that the returned data will be invalidated if the data contains in the buffer is modified (see constructor and setRawData().

Returns
matacq channel data.

Definition at line 280 of file MatacqRawEvent.h.

References channelData.

Referenced by MatacqDataFormatter::interpretRawData(), and MatacqDataFormatter::printData().

280 { return channelData; }
std::vector< ChannelData > channelData
unsigned MatacqRawEvent::getDaqLen ( ) const
inline

Gets the event length specifies in the DAQ trailer

Returns
event length

Definition at line 237 of file MatacqRawEvent.h.

References fragLen.

237 { return fragLen; }
int MatacqRawEvent::getDccErrors ( ) const
inline

Gets the contents of the DCC error field. Currently Not used for Matacq.

Returns
dcc error

Definition at line 242 of file MatacqRawEvent.h.

References daqHeader, and read32().

Referenced by MatacqDataFormatter::printData().

242 { return read32(daqHeader, dccErrors32); }
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
const uint32le_t * daqHeader
static const field32spec_t dccErrors32
unsigned MatacqRawEvent::getDccLen ( ) const
inline

Gets the event length specifies in the "a la DCC" header.

Returns
event length

Definition at line 195 of file MatacqRawEvent.h.

References daqHeader, and read32().

Referenced by MatacqProducer::addMatacqData(), MatacqProducer::getMatacqEvent(), MatacqProducer::getOrbitRange(), MatacqProducer::PosEstimator::init(), and MatacqDataFormatter::printData().

195 { return read32(daqHeader, dccLen32); }
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
const uint32le_t * daqHeader
static const field32spec_t dccLen32
static unsigned MatacqRawEvent::getDccLen ( unsigned char *  data,
size_t  size 
)
inlinestatic

Gets the event length specifies in the DCC-type header of a matacq event.

Parameters
databuffer. Needs to contains at least the 3 first 32-bit words of the event.
buffersize
Returns
event length, 0xFFFFFFFF if failed to retrieve dcc length

Definition at line 203 of file MatacqRawEvent.h.

References MatacqRawEvent::field32spec_t::offset, and read32().

203  {
204  if (size < (unsigned)(dccLen32.offset + 1) * 4)
205  return (unsigned)-1;
206  return read32((uint32le_t*)data, dccLen32);
207  }
size
Write out results.
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
static const field32spec_t dccLen32
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
int MatacqRawEvent::getDelayA ( ) const
inline

"Delay A" setting of laser delay box in ns.

Definition at line 332 of file MatacqRawEvent.h.

References delayA.

Referenced by MatacqDataFormatter::interpretRawData().

332 { return delayA; }
int MatacqRawEvent::getEmtcDelay ( ) const
inline

WTE-to-Laser delay of EMTC in LHC clock unit.

Definition at line 336 of file MatacqRawEvent.h.

References emtcDelay.

Referenced by MatacqDataFormatter::interpretRawData().

336 { return emtcDelay; }
int MatacqRawEvent::getEmtcPhase ( ) const
inline

EMTC laser phase in 1/8th LHC clock unit.

Definition at line 340 of file MatacqRawEvent.h.

References emtcPhase.

Referenced by MatacqDataFormatter::interpretRawData().

340 { return emtcPhase; }
unsigned MatacqRawEvent::getEventId ( ) const
inline

Gets the LV1 field contents.

Returns
LV1 id

Definition at line 180 of file MatacqRawEvent.h.

References daqHeader, and read32().

Referenced by MatacqDataFormatter::interpretRawData(), and MatacqDataFormatter::printData().

180 { return read32(daqHeader, lv132); }
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
const uint32le_t * daqHeader
static const field32spec_t lv132
int MatacqRawEvent::getFedId ( ) const
inline

Gets the FED ID field contents. Should be 655.

Returns
FED ID

Definition at line 170 of file MatacqRawEvent.h.

References daqHeader, and read32().

Referenced by MatacqDataFormatter::printData().

170 { return read32(daqHeader, fedId32); }
static const field32spec_t fedId32
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
const uint32le_t * daqHeader
int MatacqRawEvent::getFov ( ) const
inline

Gets the Fed event fragment data format (FOV) field content. Currently the FOV is not used for MATACQ. Note that matacq data format has its own internal version. See getMatacqDataFormatVersion()

Returns
FOV

Definition at line 165 of file MatacqRawEvent.h.

References daqHeader, and read32().

Referenced by MatacqDataFormatter::printData().

165 { return read32(daqHeader, fov32); }
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
const uint32le_t * daqHeader
static const field32spec_t fov32
int MatacqRawEvent::getFreqGHz ( ) const
inline

Gets the matacq sampling frequency field contents.

Returns
sampling frequency in GHz: 1 or 2

Definition at line 268 of file MatacqRawEvent.h.

References freqGHz.

Referenced by MatacqDataFormatter::interpretRawData(), and MatacqDataFormatter::printData().

268 { return /*matacqHeader->*/ freqGHz; }
int MatacqRawEvent::getH1Marker ( ) const
inline

Gets the header marker field contents. Must be 1

Returns
H1 header marker

Definition at line 252 of file MatacqRawEvent.h.

References daqHeader, and read32().

252 { return read32(daqHeader, h1Marker32); }
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
const uint32le_t * daqHeader
static const field32spec_t h1Marker32
int MatacqRawEvent::getLaserPower ( ) const
inline

Laser power in percents (set with the linear attenuator).

Definition at line 349 of file MatacqRawEvent.h.

References edmScanValgrind::buffer, laserPower, read32(), and setRawData().

Referenced by MatacqDataFormatter::interpretRawData().

349 { return laserPower; }
int MatacqRawEvent::getMatacqDataFormatVersion ( ) const
inline

Gets the matcq data format version

Returns
data version

Definition at line 257 of file MatacqRawEvent.h.

References matacqDataFormatVersion.

Referenced by MatacqDataFormatter::interpretRawData(), and MatacqDataFormatter::printData().

257 { return matacqDataFormatVersion; }
static unsigned MatacqRawEvent::getOrbitId ( unsigned char *  data,
size_t  size 
)
inlinestatic

Gets the orbit id from the header of a matacq event. Data format of the event must be >=3.

Parameters
databuffer. Needs to contains at least the 8 first 32-bit words of the event.
buffersize
Returns
event length, 0xFFFFFFFF if failed to retrieve dcc length

Definition at line 216 of file MatacqRawEvent.h.

References MatacqRawEvent::field32spec_t::offset, and read32().

Referenced by MatacqProducer::addMatacqData(), and MatacqDataFormatter::interpretRawData().

216  {
217  if (size < (unsigned)(orbitId32.offset + 1) * 8)
218  return (unsigned)-1;
219  return read32((uint32le_t*)data, orbitId32);
220  }
size
Write out results.
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
static const field32spec_t orbitId32
uint32_t MatacqRawEvent::getOrbitId ( ) const
inline

Gets the LHC orbit ID of the event Available only for Matacq data format version >=3 and for P5 data.

Returns
the LHC orbit ID

Definition at line 312 of file MatacqRawEvent.h.

References orbitId.

Referenced by MatacqProducer::getMatacqEvent(), MatacqProducer::getOrbitRange(), and MatacqProducer::PosEstimator::init().

312 { return orbitId; }
int MatacqRawEvent::getParsedLen ( )
inline

Gets the data length in number of 64-bit words computed by the data parser.

Returns
event length

Definition at line 286 of file MatacqRawEvent.h.

References parsedLen.

Referenced by MatacqProducer::addMatacqData().

286 { return parsedLen; }
int MatacqRawEvent::getPostTrig ( ) const
inline

Posttrig value (see Matacq documentation). Available only for Matacq data format version >=3.

Definition at line 323 of file MatacqRawEvent.h.

References postTrig.

Referenced by MatacqDataFormatter::interpretRawData().

323 { return postTrig; }
static unsigned MatacqRawEvent::getRunNum ( unsigned char *  data,
size_t  size 
)
inlinestatic

Gets the run number from the header of a matacq event.

Parameters
databuffer. Needs to contains at least the 4 first 32-bit words of the event.
buffersize
Returns
event length, 0xFFFFFFFF if failed to retrieve dcc length

Definition at line 228 of file MatacqRawEvent.h.

References MatacqRawEvent::field32spec_t::offset, and read32().

Referenced by MatacqDataFormatter::printData().

228  {
229  if (size < (unsigned)(runNum32.offset + 1) * 8)
230  return (unsigned)-1;
231  return read32((uint32le_t*)data, runNum32);
232  }
size
Write out results.
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
static const field32spec_t runNum32
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
unsigned MatacqRawEvent::getRunNum ( ) const
inline

Gets the run number field contents.

Returns
run number

Definition at line 247 of file MatacqRawEvent.h.

References daqHeader, and read32().

Referenced by MatacqProducer::getMatacqEvent().

247 { return read32(daqHeader, runNum32); }
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
static const field32spec_t runNum32
const uint32le_t * daqHeader
int32_t MatacqRawEvent::getStatus ( ) const
inline

Gets the raw data status. Bitwise OR of the error flags defined by matcqError_t

Returns
status

Definition at line 263 of file MatacqRawEvent.h.

References error.

Referenced by MatacqDataFormatter::printData().

263 { return error; }
time_t MatacqRawEvent::getTimeStamp ( ) const
inline

Gets the matacq data timestamp field contents:

Returns
acquisition date of the data expressed in number of "elapsed" second since the EPOCH as defined in POSIX.1. See time() standard c function.

Definition at line 293 of file MatacqRawEvent.h.

References timeStamp.

Referenced by MatacqDataFormatter::interpretRawData(), MatacqDataFormatter::printData(), and LaserSorter::writeEvent().

293 { return /*matacqHeader->*/ timeStamp.tv_sec; }
struct timeval timeStamp
void MatacqRawEvent::getTimeStamp ( struct timeval &  t) const
inline

Gets the matacq data timestamp with fine granularity (89.1us)

Returns
acquisition date of the data expressed in number of "elapsed" second and microseconds since the EPOCH as defined in POSIX.1. See time() standard c function and gettimeofday UNIX function.

Definition at line 300 of file MatacqRawEvent.h.

References timeStamp.

300 { t = timeStamp; }
struct timeval timeStamp
int MatacqRawEvent::getTriggerType ( ) const
inline

Gets the trigger type field contents.

Returns
trigger type

Definition at line 185 of file MatacqRawEvent.h.

References daqHeader, and read32().

Referenced by MatacqDataFormatter::interpretRawData(), and MatacqDataFormatter::printData().

185 { return read32(daqHeader, triggerType32); }
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
const uint32le_t * daqHeader
static const field32spec_t triggerType32
int MatacqRawEvent::getTrigRec ( ) const
inline

Gets the Trig Rec value (see Matacq documentation) Available only for Matacq data format version >=3.

Returns
the Trig Rec value

Definition at line 318 of file MatacqRawEvent.h.

References trigRec.

Referenced by MatacqDataFormatter::interpretRawData().

318 { return trigRec; }
int MatacqRawEvent::getTTrigPs ( ) const
inline

Gets the Matacq trigger time.

Returns
(t_trig-t_0) in ps, with t_0 the time of the first sample and t_trig the trigger time.

Definition at line 306 of file MatacqRawEvent.h.

References tTrigPs.

Referenced by MatacqDataFormatter::interpretRawData().

306 { return tTrigPs; }
std::vector<int> MatacqRawEvent::getVernier ( ) const
inline

Vernier values (see Matacq documentation) Available only for Matacq data format version >=3.

Definition at line 328 of file MatacqRawEvent.h.

References vernier.

Referenced by MatacqDataFormatter::interpretRawData().

328 { return vernier; }
std::vector< int > vernier
int MatacqRawEvent::read32 ( const uint32le_t pData,
field32spec_t  spec,
bool  ovfTrans = false 
)
staticprivate

Help function to decode header content.

Parameters
datapointer
specspecification of the data field to read
ovfTransswitch of overflow translation. If true the MSB of the data field is interpreted as an overflow bit. If it is set, then -1 is returned.
Returns
content of data field specified by 'spec'

Definition at line 195 of file MatacqRawEvent.cc.

References MatacqRawEvent::field32spec_t::mask, MatacqRawEvent::field32spec_t::offset, mps_fire::result, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by getBoe(), getBxId(), getDccErrors(), getDccLen(), getEventId(), getFedId(), getFov(), getH1Marker(), getLaserPower(), getOrbitId(), getRunNum(), and getTriggerType().

195  {
196  uint32_t result = pData[spec32.offset] & spec32.mask;
197  uint32_t mask = spec32.mask;
198  while ((mask & 0x1) == 0) {
199  mask >>= 1;
200  result >>= 1;
201  }
202  if (ovfTrans) {
203  //overflow bit (MSB) mask:
204  mask = ((mask >> 1) + 1);
205  if (result & mask)
206  result = (uint32_t)-1;
207  }
208  return result;
209 }
void MatacqRawEvent::setRawData ( const unsigned char *  buffer,
size_t  bufferSize 
)
private

Help function to get the maximum value of a data field

Parameters
spec32data field specification
Returns
maximum value Changes the raw data pointer and updates accordingly this object.
Parameters
buffernew pointer to the data buffer. Must be aligned at least on 32-bit words.
sizeof the data buffer.
Exceptions
std::exceptionif the data cannot be decoded due to data corruption or truncation.

Definition at line 77 of file MatacqRawEvent.cc.

References relativeConstraints::error, SiStripPI::max, PresampleTask_cfi::nSamples, and throwExcept().

Referenced by getLaserPower(), and MatacqRawEvent().

77  {
78  error = 0;
79  const int16le_t *begin16 = (const int16le_t *)pData;
80  const uint32le_t *begin32 = (const uint32le_t *)pData;
81  if (maxSize < 6 * 4) {
83  return;
84  }
85 
86  daqHeader = begin32;
88  freqGHz = read32(begin32, freqGHz32);
90  timeStamp.tv_sec = read32(begin32, timeStamp32);
91  int headerLen = 24; //in bytes
92  if (matacqDataFormatVersion >= 2) {
93  tTrigPs = read32(begin32, tTrigPs32);
94  headerLen += 4;
95  } else {
97  }
98 
99  if (matacqDataFormatVersion >= 3) {
100  orbitId = read32(begin32, orbitId32);
101  vernier[0] = read32(begin32, vernier0_32);
102  vernier[1] = read32(begin32, vernier1_32);
103  vernier[2] = read32(begin32, vernier2_32);
104  vernier[3] = read32(begin32, vernier3_32);
105  timeStamp.tv_usec = read32(begin32, timeStampMicroSec32);
106  trigRec = read32(begin32, trigRec32, true);
107  postTrig = read32(begin32, postTrig32);
108  delayA = read32(begin32, delayA32, true);
109  emtcDelay = read32(begin32, emtcDelay32, true);
110  emtcPhase = read32(begin32, emtcPhase32, true);
111  attenuation_dB = read32(begin32, attenuation_dB32, true);
112  laserPower = read32(begin32, laserPower32, true);
113  headerLen = 64;
114  } else {
115  orbitId = 0;
116  vernier[0] = -1;
117  vernier[1] = -1;
118  vernier[2] = -1;
119  vernier[3] = -1;
120  trigRec = -1;
121  postTrig = -1;
122  delayA = -1;
123  emtcDelay = -1;
124  emtcPhase = -1;
125  attenuation_dB = -1;
126  laserPower = -1;
127  }
128 
129  const int nCh = getChannelCount();
130  channelData.resize(nCh);
131 
132  const int16le_t *pData16 = (const int16le_t *)(pData + headerLen);
133 
134  for (int iCh = 0; iCh < nCh; ++iCh) {
135  if ((size_t)(pData16 - begin16) > maxSize) {
136  throwExcept(string("Corrupted or truncated data"));
137  }
138  //channel id:
139  channelData[iCh].chId = *(pData16++);
140  //number of time samples for this channel:
141  channelData[iCh].nSamples = *(pData16++);
142  //pointer to time sample data of this channel:
143  channelData[iCh].samples = pData16;
144  //moves to next channel data block:
145  if (channelData[iCh].nSamples < 0) {
146  throwExcept(string("Corrupted or truncated data"));
147  }
148  pData16 += channelData[iCh].nSamples;
149  }
150 
151  //data trailer chekes:
152  //FED header is aligned on 64-bit=>padding to skip
153  int padding = (4 - (pData16 - begin16)) % 4;
154  if (padding < 0)
155  padding += 4;
156  pData16 += padding;
157  if ((size_t)(pData16 - begin16) > maxSize) {
158  throwExcept(string("Corrupted or truncated data"));
159  }
160  const uint32le_t *trailer32 = (const uint32le_t *)(pData16);
161  fragLen = trailer32[1] & 0xFFFFFF;
162 
163  //cout << "Event fragment length including headers: " << fragLen
164  // << " 64-bit words\n";
165 
166  //FIXME: I am expecting the event length specifies in the header to
167  //include the header, while it is not the case in current TB 2006 data
168  const int nHeaders = 3;
169  if (fragLen != read32(begin32, dccLen32) + nHeaders && fragLen != read32(begin32, dccLen32)) {
170  //cout << "Error: fragment length is not consistent with DCC "
171  // "length\n";
173  }
174 
175  //skip trailers
176  const int trailerLen = 4;
177  pData16 += trailerLen;
178 
179  parsedLen = (pData16 - begin16) / 4;
180 
181  if ((pData16 - begin16) != (4 * fragLen)) {
182  error |= errorLength;
183  }
184 
185  if ((size_t)(pData16 - begin16) > maxSize) {
186  throwExcept(string("Corrupted or truncated data"));
187  }
188 
189  //some checks
190  if (getBoe() != 0x5) {
191  error |= errorWrongBoe;
192  }
193 }
static const field32spec_t vernier1_32
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
static const field32spec_t timeStamp32
const uint32le_t * daqHeader
static const field32spec_t tTrigPs32
std::vector< int > vernier
static const field32spec_t channelCount32
static const field32spec_t emtcPhase32
static const field32spec_t dccLen32
static const field32spec_t attenuation_dB32
int getChannelCount() const
static const field32spec_t vernier0_32
static const field32spec_t vernier3_32
static const field32spec_t postTrig32
static const field32spec_t timeStampMicroSec32
static const field32spec_t trigRec32
static const field32spec_t vernier2_32
static const field32spec_t emtcDelay32
int getBoe() const
static const field32spec_t delayA32
struct timeval timeStamp
static const field32spec_t orbitId32
std::vector< ChannelData > channelData
static const field32spec_t formatVersion32
static const field32spec_t freqGHz32
static const field32spec_t laserPower32
static void throwExcept(const std::string &s)

Member Data Documentation

int MatacqRawEvent::attenuation_dB
private

Logarithmic attenuator setting in -10dB unit. Between 0 and 5*(-10dB), 0xF if unknown.

Definition at line 498 of file MatacqRawEvent.h.

Referenced by getAttenuation_dB().

const MatacqRawEvent::field32spec_t MatacqRawEvent::attenuation_dB32 = {12, 0x00000F00}
staticprivate

Definition at line 132 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::boe
private

Begin Of Event marker

Definition at line 381 of file MatacqRawEvent.h.

const MatacqRawEvent::field32spec_t MatacqRawEvent::boeType32 = {1, 0xF0000000}
staticprivate

Definition at line 107 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::bxId
private

Bunch crossing Id

Definition at line 385 of file MatacqRawEvent.h.

const MatacqRawEvent::field32spec_t MatacqRawEvent::bxId32 = {0, 0xFFF00000}
staticprivate

Definition at line 104 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::channelCount
private

Number of matacq channels in the data.

Definition at line 389 of file MatacqRawEvent.h.

Referenced by getChannelCount().

const MatacqRawEvent::field32spec_t MatacqRawEvent::channelCount32 = {4, 0xFF000000}
staticprivate

Definition at line 119 of file MatacqRawEvent.h.

Referenced by throwExcept().

std::vector<ChannelData> MatacqRawEvent::channelData
private

Channel samples

Definition at line 393 of file MatacqRawEvent.h.

Referenced by getChannelData().

const MatacqRawEvent::field32spec_t MatacqRawEvent::color32 = {13, 0x00600000}
staticprivate

Definition at line 137 of file MatacqRawEvent.h.

Referenced by throwExcept().

const uint32le_t* MatacqRawEvent::daqHeader
private

Pointer to the standard CMS DAQ header

Definition at line 397 of file MatacqRawEvent.h.

Referenced by getBoe(), getBxId(), getDccErrors(), getDccLen(), getEventId(), getFedId(), getFov(), getH1Marker(), getRunNum(), and getTriggerType().

int MatacqRawEvent::dccErrors
private

DCC error field content.

Definition at line 401 of file MatacqRawEvent.h.

const MatacqRawEvent::field32spec_t MatacqRawEvent::dccErrors32 = {2, 0xFF000000}
staticprivate

Definition at line 109 of file MatacqRawEvent.h.

Referenced by throwExcept().

const MatacqRawEvent::field32spec_t MatacqRawEvent::dccId32 = {13, 0x003F0000}
staticprivate

Definition at line 136 of file MatacqRawEvent.h.

Referenced by throwExcept().

unsigned MatacqRawEvent::dccLen
private

Event length specified in 'DCC' header

Definition at line 405 of file MatacqRawEvent.h.

const MatacqRawEvent::field32spec_t MatacqRawEvent::dccLen32 = {2, 0x00FFFFFF}
staticprivate

Definition at line 108 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::delayA
private

"Delay A" setting of laser delay box in ns.

Definition at line 485 of file MatacqRawEvent.h.

Referenced by getDelayA().

const MatacqRawEvent::field32spec_t MatacqRawEvent::delayA32 = {13, 0x0000FFFF}
staticprivate

Definition at line 135 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::emtcDelay
private

WTE-to-Laser delay of EMTC in LHC clock unit.

Definition at line 489 of file MatacqRawEvent.h.

Referenced by getEmtcDelay().

const MatacqRawEvent::field32spec_t MatacqRawEvent::emtcDelay32 = {12, 0xFFFF0000}
staticprivate

Definition at line 134 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::emtcPhase
private

EMTC laser phase in 1/8th LHC clock unit.

Definition at line 493 of file MatacqRawEvent.h.

Referenced by getEmtcPhase().

const MatacqRawEvent::field32spec_t MatacqRawEvent::emtcPhase32 = {12, 0x0000F000}
staticprivate

Definition at line 133 of file MatacqRawEvent.h.

Referenced by throwExcept().

int32_t MatacqRawEvent::error
private

Error code or 0 if no error.

Definition at line 413 of file MatacqRawEvent.h.

Referenced by Page1Parser.Page1Parser::check_for_whole_start_tag(), and getStatus().

unsigned MatacqRawEvent::eventId
private

Event id. Actually LV1 ID.

Definition at line 409 of file MatacqRawEvent.h.

Referenced by ntupleDataFormat.Event::eventIdStr().

int MatacqRawEvent::fedId
private

FED ID

Definition at line 417 of file MatacqRawEvent.h.

const MatacqRawEvent::field32spec_t MatacqRawEvent::fedId32 = {0, 0x000FFF00}
staticprivate

Definition at line 103 of file MatacqRawEvent.h.

Referenced by throwExcept().

const MatacqRawEvent::field32spec_t MatacqRawEvent::formatVersion32 = {4, 0x0000FFFF}
staticprivate

Matacq header field specifications.

Definition at line 117 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::fov
private

FED data format version

Definition at line 421 of file MatacqRawEvent.h.

const MatacqRawEvent::field32spec_t MatacqRawEvent::fov32 = {0, 0x000000F0}
staticprivate

DAQ header field specifications.

Definition at line 102 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::fragLen
private

event fragment length as read in the std DAQ trailer. In 64-bit words

Definition at line 425 of file MatacqRawEvent.h.

Referenced by getDaqLen().

int MatacqRawEvent::freqGHz
private

MATACQ sampling frequency in GHz

Definition at line 429 of file MatacqRawEvent.h.

Referenced by getFreqGHz().

const MatacqRawEvent::field32spec_t MatacqRawEvent::freqGHz32 = {4, 0x00FF0000}
staticprivate

Definition at line 118 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::h1Marker
private

header marker

Definition at line 433 of file MatacqRawEvent.h.

const MatacqRawEvent::field32spec_t MatacqRawEvent::h1Marker32 = {3, 0x3F000000}
staticprivate

Definition at line 111 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::laserPower
private

Laser power in percents (set with the linear attenuator).

Definition at line 502 of file MatacqRawEvent.h.

Referenced by getLaserPower().

const MatacqRawEvent::field32spec_t MatacqRawEvent::laserPower32 = {12, 0x000000FF}
staticprivate

Definition at line 131 of file MatacqRawEvent.h.

Referenced by throwExcept().

const MatacqRawEvent::field32spec_t MatacqRawEvent::lv132 = {1, 0x00FFFFFF}
staticprivate

Definition at line 105 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::matacqDataFormatVersion
private

Matacq header:MATACQ data format internal version

Definition at line 441 of file MatacqRawEvent.h.

Referenced by getMatacqDataFormatVersion().

uint32_t MatacqRawEvent::orbitId
private

Definition at line 469 of file MatacqRawEvent.h.

Referenced by getOrbitId().

const MatacqRawEvent::field32spec_t MatacqRawEvent::orbitId32 = {7, 0xFFFFFFFF}
staticprivate

Definition at line 122 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::parsedLen
private

event lenght computed by the raw data parser

Definition at line 445 of file MatacqRawEvent.h.

Referenced by getParsedLen().

int MatacqRawEvent::postTrig
private

Posttrig value (see Matacq documentation)

Definition at line 477 of file MatacqRawEvent.h.

Referenced by getPostTrig().

const MatacqRawEvent::field32spec_t MatacqRawEvent::postTrig32 = {11, 0x0000FFFF}
staticprivate

Definition at line 124 of file MatacqRawEvent.h.

Referenced by throwExcept().

uint16le_t* MatacqRawEvent::pSamples
private

Pointer to MATACQ samples block

Definition at line 449 of file MatacqRawEvent.h.

unsigned MatacqRawEvent::runNum
private

Run number

Definition at line 453 of file MatacqRawEvent.h.

const MatacqRawEvent::field32spec_t MatacqRawEvent::runNum32 = {3, 0x00FFFFFF}
staticprivate

Definition at line 110 of file MatacqRawEvent.h.

Referenced by throwExcept().

const MatacqRawEvent::field32spec_t MatacqRawEvent::side32 = {13, 0x08000000}
staticprivate

Definition at line 139 of file MatacqRawEvent.h.

Referenced by throwExcept().

struct timeval MatacqRawEvent::timeStamp
private

Matacq acquisition time stamp

Definition at line 457 of file MatacqRawEvent.h.

Referenced by getTimeStamp().

const MatacqRawEvent::field32spec_t MatacqRawEvent::timeStamp32 = {5, 0xFFFFFFFF}
staticprivate

Definition at line 120 of file MatacqRawEvent.h.

Referenced by throwExcept().

const MatacqRawEvent::field32spec_t MatacqRawEvent::timeStampMicroSec32 = {10, 0xFFFFFFFF}
staticprivate

Definition at line 129 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::triggerType
private

Trigger type

Definition at line 465 of file MatacqRawEvent.h.

const MatacqRawEvent::field32spec_t MatacqRawEvent::triggerType32 = {1, 0x0F000000}
staticprivate

Definition at line 106 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::trigRec
private

Trig Rec value (see Matacq documentation)

Definition at line 473 of file MatacqRawEvent.h.

Referenced by getTrigRec().

const MatacqRawEvent::field32spec_t MatacqRawEvent::trigRec32 = {11, 0xFF000000}
staticprivate

Definition at line 123 of file MatacqRawEvent.h.

Referenced by throwExcept().

const MatacqRawEvent::field32spec_t MatacqRawEvent::trigType32 = {13, 0x07000000}
staticprivate

Definition at line 138 of file MatacqRawEvent.h.

Referenced by throwExcept().

int MatacqRawEvent::tTrigPs
private

MATACQ trigger time position in ps

Definition at line 461 of file MatacqRawEvent.h.

Referenced by getTTrigPs().

const MatacqRawEvent::field32spec_t MatacqRawEvent::tTrigPs32 = {6, 0xFFFFFFFF}
staticprivate

Definition at line 121 of file MatacqRawEvent.h.

Referenced by throwExcept().

std::vector<int> MatacqRawEvent::vernier
private

Vernier values (see Matacq documentation)

Definition at line 481 of file MatacqRawEvent.h.

Referenced by getVernier().

const MatacqRawEvent::field32spec_t MatacqRawEvent::vernier0_32 = {8, 0x0000FFFF}
staticprivate

Definition at line 125 of file MatacqRawEvent.h.

Referenced by throwExcept().

const MatacqRawEvent::field32spec_t MatacqRawEvent::vernier1_32 = {8, 0xFFFF0000}
staticprivate

Definition at line 126 of file MatacqRawEvent.h.

Referenced by throwExcept().

const MatacqRawEvent::field32spec_t MatacqRawEvent::vernier2_32 = {9, 0x0000FFFF}
staticprivate

Definition at line 127 of file MatacqRawEvent.h.

Referenced by throwExcept().

const MatacqRawEvent::field32spec_t MatacqRawEvent::vernier3_32 = {9, 0xFFFF0000}
staticprivate

Definition at line 128 of file MatacqRawEvent.h.

Referenced by throwExcept().