CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <inttypes.h>
7 
8 #if 0 //replace 1 by 0 to remove XDAQ dependency. In this case it is assumed
9  //the machine is little endian.
10 #include "i2o/utils/endian.h" //from XDAQ
11 #define UINT32_FROM_LE i2odecodel
12 #define UINT16_FROM_LE i2odecodes
13 #define INT16_FROM_LE i2odecodes
14 
15 #else //assuming little endianness of the machine
16 
17 #define UINT32_FROM_LE
18 #define UINT16_FROM_LE
19 #define INT16_FROM_LE
20 
21 #endif
22 
27  //typedefs, enums and static constants
28 public:
36  errorLength = 1<<1,
40  };
41 
42  /* The following types are little-endian encoded types. Use of these types
43  * for the I20 data block should offer portability to big-endian platforms.
44  */
46  struct uint32le_t{
47  uint32_t littleEndianInt;
48  operator uint32_t() const{
50  }
51  };
52 
53  struct uint16le_t{
54  uint16_t littleEndianInt;
55  operator uint16_t() const{
57  }
58  };
59 
60  struct int16le_t{
61  int16_t littleEndianInt;
62  operator int16_t() const{
64  }
65  };
67 
68  struct ChannelData{
71  int chId;
74  int nSamples;
78  };
79 
80 private:
83  struct matacqHeader_t{
85  unsigned char freqGHz;
86  unsigned char channelCount;
87  uint32_t timeStamp;
88  };
89 
92  struct field32spec_t{
93  int offset;
94  unsigned int mask;
95  };
96 
99  static const field32spec_t fov32;
100  static const field32spec_t fedId32;
101  static const field32spec_t bxId32;
102  static const field32spec_t lv132;
104  static const field32spec_t boeType32;
105  static const field32spec_t dccLen32;
107  static const field32spec_t runNum32;
108  static const field32spec_t h1Marker32;
109 
110 
111  //constructors
112 public:
122  MatacqTBRawEvent(const unsigned char* dataBuffer, size_t bufferSize){
123  setRawData(dataBuffer, bufferSize);
124  }
125  //methods
126 public:
133  int getFov() const { return read32(daqHeader, fov32);}
134 
138  int getFedId() const { return read32(daqHeader, fedId32);}
139 
143  int getBxId() const { return read32(daqHeader, bxId32);}
144 
148  unsigned getEventId() const { return read32(daqHeader, lv132);}
149 
153  int getTriggerType() const { return read32(daqHeader, triggerType32);}
154 
158  int getBoe() const { return read32(daqHeader, boeType32);}
159 
163  unsigned getDccLen() const { return read32(daqHeader, dccLen32);}
164 
168  unsigned getDaqLen() const { return fragLen;}
169 
170 
174  int getDccErrors() const { return read32(daqHeader, dccErrors32);}
175 
179  unsigned getRunNum() const { return read32(daqHeader, runNum32);}
180 
184  int getH1Marker() const { return read32(daqHeader, h1Marker32);}
185 
186 
191 
196  int32_t getStatus() const { return error;}
197 
201  int getFreqGHz() const { return matacqHeader->freqGHz;}
202 
206  int getChannelCount() const { return matacqHeader->channelCount;}
207 
213  const std::vector<ChannelData>& getChannelData() const{
214  return channelData;
215  }
216 
221  int getParsedLen() { return parsedLen; }
222 
228  time_t getTimeStamp() const { return matacqHeader->timeStamp;}
229 
230 
235  int getTTrigPs() const { return tTrigPs;}
236 
237 private:
243  int read32(uint32le_t* pData, field32spec_t spec) const;
244 
252  void setRawData(const unsigned char* buffer, size_t bufferSize);
253 
254  //fields
255 private:
258  int boe;
259 
262  int bxId;
263 
267 
270  std::vector<ChannelData> channelData;
271 
275 
279 
282  unsigned dccLen;
283 
286  unsigned eventId;
287 
290  int32_t error;
291 
294  int fedId;
295 
298  int fov;
299 
302  int fragLen;
303 
306  int freqGHz;
307 
310  int h1Marker;
311 
315 
319 
323 
327 
330  unsigned runNum;
331 
334  time_t timeStamp;
335 
338  int tTrigPs;
339 
343 };
344 
345 #endif //MATACQRAWEVENT_H not defined
int getFedId() const
int getH1Marker() const
int getDccErrors() const
int getTriggerType() const
static const field32spec_t lv132
static const field32spec_t fov32
void setRawData(const unsigned char *buffer, size_t bufferSize)
unsigned getDaqLen() const
int read32(uint32le_t *pData, field32spec_t spec) const
unsigned getEventId() const
static const field32spec_t boeType32
int getTTrigPs() const
uint32le_t * daqHeader
int getChannelCount() const
static const field32spec_t runNum32
uint16le_t * pSamples
std::vector< ChannelData > channelData
int32_t getStatus() const
int getMatacqDataFormatVersion() const
int getBoe() const
MatacqTBRawEvent(const unsigned char *dataBuffer, size_t bufferSize)
time_t getTimeStamp() const
static const field32spec_t triggerType32
matacqHeader_t * matacqHeader
int getFreqGHz() const
#define UINT16_FROM_LE
unsigned getRunNum() const
static const field32spec_t h1Marker32
int getBxId() const
static const field32spec_t bxId32
#define INT16_FROM_LE
const std::vector< ChannelData > & getChannelData() const
static const field32spec_t dccLen32
#define UINT32_FROM_LE
int getFov() const
unsigned getDccLen() const
static const field32spec_t fedId32
static const field32spec_t dccErrors32