22 #ifdef CMSSW //compilation within CMSSW framework 29 #else //compilation outside CMSSW framework (e.g. online) 35 #endif //CMSSW not defined 81 if (maxSize < 6 * 4) {
87 matacqDataFormatVersion = read32(begin32, formatVersion32);
88 freqGHz = read32(begin32, freqGHz32);
89 channelCount = read32(begin32, channelCount32);
90 timeStamp.tv_sec = read32(begin32, timeStamp32);
92 if (matacqDataFormatVersion >= 2) {
93 tTrigPs = read32(begin32, tTrigPs32);
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);
129 const int nCh = getChannelCount();
130 channelData.resize(nCh);
134 for (
int iCh = 0; iCh < nCh; ++iCh) {
135 if ((
size_t)(pData16 - begin16) > maxSize) {
136 throwExcept(
string(
"Corrupted or truncated data"));
139 channelData[iCh].chId = *(pData16++);
141 channelData[iCh].nSamples = *(pData16++);
143 channelData[iCh].samples = pData16;
145 if (channelData[iCh].
nSamples < 0) {
146 throwExcept(
string(
"Corrupted or truncated data"));
148 pData16 += channelData[iCh].nSamples;
153 int padding = (4 - (pData16 - begin16)) % 4;
157 if ((
size_t)(pData16 - begin16) > maxSize) {
158 throwExcept(
string(
"Corrupted or truncated data"));
161 fragLen = trailer32[1] & 0xFFFFFF;
168 const int nHeaders = 3;
169 if (fragLen != read32(begin32, dccLen32) + nHeaders && fragLen != read32(begin32, dccLen32)) {
172 error |= errorLengthConsistency;
176 const int trailerLen = 4;
177 pData16 += trailerLen;
179 parsedLen = (pData16 - begin16) / 4;
181 if ((pData16 - begin16) != (4 * fragLen)) {
182 error |= errorLength;
185 if ((
size_t)(pData16 - begin16) > maxSize) {
186 throwExcept(
string(
"Corrupted or truncated data"));
190 if (getBoe() != 0x5) {
191 error |= errorWrongBoe;
197 uint32_t mask = spec32.
mask;
198 while ((mask & 0
x1) == 0) {
204 mask = ((mask >> 1) + 1);
206 result = (uint32_t)-1;
static const field32spec_t vernier1_32
static const field32spec_t fedId32
static const field32spec_t boeType32
static int read32(const uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
static const field32spec_t runNum32
static const field32spec_t timeStamp32
static const field32spec_t trigType32
static const field32spec_t tTrigPs32
static const field32spec_t channelCount32
static const field32spec_t emtcPhase32
void setRawData(const unsigned char *buffer, size_t bufferSize)
static const field32spec_t dccLen32
static const field32spec_t fov32
static const field32spec_t attenuation_dB32
static const field32spec_t lv132
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
static const field32spec_t side32
static const field32spec_t dccId32
static const field32spec_t triggerType32
static const field32spec_t color32
static const field32spec_t delayA32
static const field32spec_t orbitId32
static const field32spec_t formatVersion32
static const field32spec_t dccErrors32
static const field32spec_t h1Marker32
static const field32spec_t freqGHz32
static const field32spec_t laserPower32
static void throwExcept(const std::string &s)
static const field32spec_t bxId32