22 #ifdef CMSSW //compilation within CMSSW framework
29 #else //compilation outside CMSSW framework (e.g. online)
35 #endif //CMSSW not defined
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);