CMS 3D CMS Logo

MatacqRawEvent.h
Go to the documentation of this file.
1 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 8; -*-
2 
3 #ifndef MATACQTBRAWEVENT_H
4 #define MATACQTBRAWEVENT_H
5 
6 #include <cinttypes>
7 #include <ctime>
8 #include <vector>
9 //replace 1 by 0 to remove XDAQ dependency. In this case it is assumed the machine is little endian.
10 #if 0
11 #include "i2o/utils/endian.h" //from XDAQ
12 #define UINT32_FROM_LE i2odecodel
13 #define UINT16_FROM_LE i2odecodes
14 #define INT16_FROM_LE i2odecodes
15 
16 #else //assuming little endianness of the machine
17 
18 #define UINT32_FROM_LE
19 #define UINT16_FROM_LE
20 #define INT16_FROM_LE
21 
22 #endif
23 
28  //typedefs, enums and static constants
29 public:
37  errorLength = 1 << 1,
40  errorWrongBoe = 1 << 2
41  };
42 
43  /* The following types are little-endian encoded types. Use of these types
44  * for the I20 data block should offer portability to big-endian platforms.
45  */
47  struct uint32le_t {
48  uint32_t littleEndianInt;
49  operator uint32_t() const { return UINT32_FROM_LE(littleEndianInt); }
50  };
51 
52  struct uint16le_t {
53  uint16_t littleEndianInt;
54  operator uint16_t() const { return UINT16_FROM_LE(littleEndianInt); }
55  };
56 
57  struct int16le_t {
58  int16_t littleEndianInt;
59  operator int16_t() const { return INT16_FROM_LE(littleEndianInt); }
60  };
62 
63  struct ChannelData {
66  int chId;
69  int nSamples;
73  };
74 
75 private:
78  struct matacqHeader_t {
80  unsigned char freqGHz;
81  unsigned char channelCount;
82  uint32_t timeStamp;
83  };
84 
87  struct field32spec_t {
88  int offset;
89  unsigned int mask;
90  };
91 
94  static const field32spec_t fov32;
95  static const field32spec_t fedId32;
96  static const field32spec_t bxId32;
97  static const field32spec_t lv132;
99  static const field32spec_t boeType32;
100  static const field32spec_t dccLen32;
102  static const field32spec_t runNum32;
103  static const field32spec_t h1Marker32;
104 
105  //constructors
106 public:
116  MatacqTBRawEvent(const unsigned char* dataBuffer, std::size_t bufferSize) { setRawData(dataBuffer, bufferSize); }
117  //methods
118 public:
125  int getFov() const { return read32(daqHeader, fov32); }
126 
130  int getFedId() const { return read32(daqHeader, fedId32); }
131 
135  int getBxId() const { return read32(daqHeader, bxId32); }
136 
140  unsigned getEventId() const { return read32(daqHeader, lv132); }
141 
145  int getTriggerType() const { return read32(daqHeader, triggerType32); }
146 
150  int getBoe() const { return read32(daqHeader, boeType32); }
151 
155  unsigned getDccLen() const { return read32(daqHeader, dccLen32); }
156 
160  unsigned getDaqLen() const { return fragLen; }
161 
165  int getDccErrors() const { return read32(daqHeader, dccErrors32); }
166 
170  unsigned getRunNum() const { return read32(daqHeader, runNum32); }
171 
175  int getH1Marker() const { return read32(daqHeader, h1Marker32); }
176 
181 
186  int32_t getStatus() const { return error; }
187 
191  int getFreqGHz() const { return matacqHeader->freqGHz; }
192 
196  int getChannelCount() const { return matacqHeader->channelCount; }
197 
203  const std::vector<ChannelData>& getChannelData() const { return channelData; }
204 
209  int getParsedLen() { return parsedLen; }
210 
216  time_t getTimeStamp() const { return matacqHeader->timeStamp; }
217 
222  int getTTrigPs() const { return tTrigPs; }
223 
224 private:
230  int read32(const uint32le_t* pData, field32spec_t spec) const;
231 
239  void setRawData(const unsigned char* buffer, std::size_t bufferSize);
240 
241  //fields
242 private:
245  int boe;
246 
249  int bxId;
250 
254 
257  std::vector<ChannelData> channelData;
258 
262 
266 
269  unsigned dccLen;
270 
273  unsigned eventId;
274 
277  int32_t error;
278 
281  int fedId;
282 
285  int fov;
286 
289  int fragLen;
290 
293  int freqGHz;
294 
297  int h1Marker;
298 
302 
306 
310 
314 
317  unsigned runNum;
318 
321  time_t timeStamp;
322 
325  int tTrigPs;
326 
330 };
331 
332 #endif //MATACQRAWEVENT_H not defined
MatacqTBRawEvent::uint16le_t::littleEndianInt
uint16_t littleEndianInt
Definition: MatacqRawEvent.h:53
MatacqTBRawEvent::bxId32
static const field32spec_t bxId32
Definition: MatacqRawEvent.h:96
MatacqTBRawEvent::fragLen
int fragLen
Definition: MatacqRawEvent.h:289
MatacqTBRawEvent::dccErrors
int dccErrors
Definition: MatacqRawEvent.h:265
MatacqTBRawEvent::fov32
static const field32spec_t fov32
Definition: MatacqRawEvent.h:94
MatacqTBRawEvent::bxId
int bxId
Definition: MatacqRawEvent.h:249
MatacqTBRawEvent::boe
int boe
Definition: MatacqRawEvent.h:245
MatacqTBRawEvent::getRunNum
unsigned getRunNum() const
Definition: MatacqRawEvent.h:170
MatacqTBRawEvent::fedId32
static const field32spec_t fedId32
Definition: MatacqRawEvent.h:95
MatacqTBRawEvent::ChannelData
Definition: MatacqRawEvent.h:63
MatacqTBRawEvent::getFreqGHz
int getFreqGHz() const
Definition: MatacqRawEvent.h:191
MatacqTBRawEvent::freqGHz
int freqGHz
Definition: MatacqRawEvent.h:293
MatacqTBRawEvent::h1Marker32
static const field32spec_t h1Marker32
Definition: MatacqRawEvent.h:103
MatacqTBRawEvent::int16le_t
Definition: MatacqRawEvent.h:57
MatacqTBRawEvent::matacqHeader_t::version
uint16le_t version
Definition: MatacqRawEvent.h:79
MatacqTBRawEvent::getTriggerType
int getTriggerType() const
Definition: MatacqRawEvent.h:145
MatacqTBRawEvent::setRawData
void setRawData(const unsigned char *buffer, std::size_t bufferSize)
Definition: MatacqRawEvent.cc:33
MatacqTBRawEvent::getTimeStamp
time_t getTimeStamp() const
Definition: MatacqRawEvent.h:216
MatacqTBRawEvent::eventId
unsigned eventId
Definition: MatacqRawEvent.h:273
MatacqTBRawEvent::getChannelCount
int getChannelCount() const
Definition: MatacqRawEvent.h:196
MatacqTBRawEvent::uint16le_t
Definition: MatacqRawEvent.h:52
MatacqTBRawEvent::read32
int read32(const uint32le_t *pData, field32spec_t spec) const
Definition: MatacqRawEvent.cc:102
MatacqTBRawEvent::dccLen32
static const field32spec_t dccLen32
Definition: MatacqRawEvent.h:100
MatacqTBRawEvent::field32spec_t::offset
int offset
Definition: MatacqRawEvent.h:88
MatacqTBRawEvent::matacqHeader
const matacqHeader_t * matacqHeader
Definition: MatacqRawEvent.h:301
MatacqTBRawEvent::MatacqTBRawEvent
MatacqTBRawEvent(const unsigned char *dataBuffer, std::size_t bufferSize)
Definition: MatacqRawEvent.h:116
MatacqTBRawEvent::errorWrongBoe
Definition: MatacqRawEvent.h:40
MatacqTBRawEvent::getFov
int getFov() const
Definition: MatacqRawEvent.h:125
MatacqTBRawEvent::getTTrigPs
int getTTrigPs() const
Definition: MatacqRawEvent.h:222
MatacqTBRawEvent::timeStamp
time_t timeStamp
Definition: MatacqRawEvent.h:321
MatacqTBRawEvent::int16le_t::littleEndianInt
int16_t littleEndianInt
Definition: MatacqRawEvent.h:58
MatacqTBRawEvent::dccLen
unsigned dccLen
Definition: MatacqRawEvent.h:269
MatacqTBRawEvent::getDccErrors
int getDccErrors() const
Definition: MatacqRawEvent.h:165
MatacqTBRawEvent::dccErrors32
static const field32spec_t dccErrors32
Definition: MatacqRawEvent.h:101
UINT16_FROM_LE
#define UINT16_FROM_LE
Definition: MatacqRawEvent.h:19
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
MatacqTBRawEvent
Definition: MatacqRawEvent.h:27
MatacqTBRawEvent::lv132
static const field32spec_t lv132
Definition: MatacqRawEvent.h:97
MatacqTBRawEvent::getH1Marker
int getH1Marker() const
Definition: MatacqRawEvent.h:175
MatacqTBRawEvent::daqHeader
const uint32le_t * daqHeader
Definition: MatacqRawEvent.h:261
MatacqTBRawEvent::field32spec_t
Definition: MatacqRawEvent.h:87
UINT32_FROM_LE
#define UINT32_FROM_LE
Definition: MatacqRawEvent.h:18
MatacqTBRawEvent::matacqHeader_t::timeStamp
uint32_t timeStamp
Definition: MatacqRawEvent.h:82
MatacqTBRawEvent::ChannelData::nSamples
int nSamples
Definition: MatacqRawEvent.h:69
MatacqTBRawEvent::parsedLen
int parsedLen
Definition: MatacqRawEvent.h:309
MatacqTBRawEvent::fov
int fov
Definition: MatacqRawEvent.h:285
INT16_FROM_LE
#define INT16_FROM_LE
Definition: MatacqRawEvent.h:20
MatacqTBRawEvent::runNum32
static const field32spec_t runNum32
Definition: MatacqRawEvent.h:102
MatacqTBRawEvent::pSamples
uint16le_t * pSamples
Definition: MatacqRawEvent.h:313
MatacqTBRawEvent::channelData
std::vector< ChannelData > channelData
Definition: MatacqRawEvent.h:257
MatacqTBRawEvent::uint32le_t::littleEndianInt
uint32_t littleEndianInt
Definition: MatacqRawEvent.h:48
MatacqTBRawEvent::matacqHeader_t::freqGHz
unsigned char freqGHz
Definition: MatacqRawEvent.h:80
MatacqTBRawEvent::matacqError_t
matacqError_t
Definition: MatacqRawEvent.h:30
MatacqTBRawEvent::getEventId
unsigned getEventId() const
Definition: MatacqRawEvent.h:140
MatacqTBRawEvent::boeType32
static const field32spec_t boeType32
Definition: MatacqRawEvent.h:99
MatacqTBRawEvent::runNum
unsigned runNum
Definition: MatacqRawEvent.h:317
MatacqTBRawEvent::getParsedLen
int getParsedLen()
Definition: MatacqRawEvent.h:209
MatacqTBRawEvent::getDccLen
unsigned getDccLen() const
Definition: MatacqRawEvent.h:155
MatacqTBRawEvent::error
int32_t error
Definition: MatacqRawEvent.h:277
MatacqTBRawEvent::getMatacqDataFormatVersion
int getMatacqDataFormatVersion() const
Definition: MatacqRawEvent.h:180
MatacqTBRawEvent::triggerType
int triggerType
Definition: MatacqRawEvent.h:329
MatacqTBRawEvent::tTrigPs
int tTrigPs
Definition: MatacqRawEvent.h:325
MatacqTBRawEvent::triggerType32
static const field32spec_t triggerType32
Definition: MatacqRawEvent.h:98
MatacqTBRawEvent::errorLengthConsistency
Definition: MatacqRawEvent.h:34
MatacqTBRawEvent::matacqHeader_t::channelCount
unsigned char channelCount
Definition: MatacqRawEvent.h:81
MatacqTBRawEvent::channelCount
int channelCount
Definition: MatacqRawEvent.h:253
MatacqTBRawEvent::getFedId
int getFedId() const
Definition: MatacqRawEvent.h:130
MatacqTBRawEvent::getDaqLen
unsigned getDaqLen() const
Definition: MatacqRawEvent.h:160
MatacqTBRawEvent::matacqDataFormatVersion
int matacqDataFormatVersion
Definition: MatacqRawEvent.h:305
MatacqTBRawEvent::matacqHeader_t
Definition: MatacqRawEvent.h:78
MatacqTBRawEvent::errorLength
Definition: MatacqRawEvent.h:37
MatacqTBRawEvent::ChannelData::chId
int chId
Definition: MatacqRawEvent.h:66
MatacqTBRawEvent::getChannelData
const std::vector< ChannelData > & getChannelData() const
Definition: MatacqRawEvent.h:203
MatacqTBRawEvent::h1Marker
int h1Marker
Definition: MatacqRawEvent.h:297
MatacqTBRawEvent::ChannelData::samples
const int16le_t * samples
Definition: MatacqRawEvent.h:72
MatacqTBRawEvent::getStatus
int32_t getStatus() const
Definition: MatacqRawEvent.h:186
MatacqTBRawEvent::getBxId
int getBxId() const
Definition: MatacqRawEvent.h:135
MatacqTBRawEvent::uint32le_t
Definition: MatacqRawEvent.h:47
MatacqTBRawEvent::fedId
int fedId
Definition: MatacqRawEvent.h:281
MatacqTBRawEvent::getBoe
int getBoe() const
Definition: MatacqRawEvent.h:150
MatacqTBRawEvent::field32spec_t::mask
unsigned int mask
Definition: MatacqRawEvent.h:89