22 #ifdef CMSSW //compilation within CMSSW framework
31 #else //compilation outside CMSSW framework (e.g. online)
36 throw std::runtime_error(s.c_str());
39 #endif //CMSSW not defined
91 matacqDataFormatVersion = read32(begin32, formatVersion32);
92 freqGHz = read32(begin32, freqGHz32);
93 channelCount = read32(begin32, channelCount32);
94 timeStamp.tv_sec = read32(begin32, timeStamp32);
96 if(matacqDataFormatVersion>=2){
97 tTrigPs = read32(begin32, tTrigPs32);
103 if(matacqDataFormatVersion>=3){
104 orbitId = read32(begin32, orbitId32);
105 vernier[0] = read32(begin32, vernier0_32);
106 vernier[1] = read32(begin32, vernier1_32);
107 vernier[2] = read32(begin32, vernier2_32);
108 vernier[3] = read32(begin32, vernier3_32);
109 timeStamp.tv_usec = read32(begin32, timeStampMicroSec32);
110 trigRec = read32(begin32, trigRec32,
true);
111 postTrig = read32(begin32, postTrig32);
112 delayA = read32(begin32, delayA32,
true);
113 emtcDelay = read32(begin32, emtcDelay32,
true);
114 emtcPhase = read32(begin32, emtcPhase32,
true);
115 attenuation_dB = read32(begin32, attenuation_dB32,
true);
116 laserPower = read32(begin32, laserPower32,
true);
133 const int nCh = getChannelCount();
134 channelData.resize(nCh);
138 for(
int iCh=0; iCh<nCh; ++iCh){
139 if((
size_t)(pData16-begin16)>maxSize){
140 throwExcept(
string(
"Corrupted or truncated data"));
143 channelData[iCh].chId = *(pData16++);
145 channelData[iCh].nSamples = *(pData16++);
147 channelData[iCh].samples = pData16;
150 throwExcept(
string(
"Corrupted or truncated data"));
152 pData16 += channelData[iCh].nSamples;
157 int padding = (4-(pData16-begin16))%4;
158 if(padding<0) padding+=4;
160 if((
size_t)(pData16-begin16)>maxSize){
161 throwExcept(
string(
"Corrupted or truncated data"));
164 fragLen = trailer32[1]&0xFFFFFF;
171 const int nHeaders = 3;
172 if(fragLen!=read32(begin32,dccLen32)+nHeaders
173 && fragLen != read32(begin32,dccLen32)){
176 error |= errorLengthConsistency;
180 const int trailerLen = 4;
181 pData16 += trailerLen;
183 parsedLen = (pData16-begin16) / 4;
185 if((pData16-begin16)!=(4*fragLen)){
186 error |= errorLength;
189 if((
size_t)(pData16-begin16)>maxSize){
190 throwExcept(
string(
"Corrupted or truncated data"));
195 error |= errorWrongBoe;
202 uint32_t mask = spec32.
mask;
203 while((mask&0x1) == 0){
209 mask = ((mask >>1) + 1);
210 if(result & mask) 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
tuple maxSize
'/store/data/Commissioning08/BeamHalo/RECO/StuffAlmostToP5_v1/000/061/642/10A0FE34-A67D-DD11-AD05-000...
static const field32spec_t vernier0_32
static const field32spec_t vernier3_32
static const field32spec_t postTrig32
constexpr size_t nSamples
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