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
83 unsigned char*
begin = (
unsigned char*) pData;
87 const int daqHeaderLen = 16;
92 pData16 += daqHeaderLen/
sizeof(pData16[0]);
95 matacqDataFormatVersion = read32(begin32, formatVersion32);
96 freqGHz = read32(begin32, freqGHz32);
97 channelCount = read32(begin32, channelCount32);
98 timeStamp.tv_sec = read32(begin32, timeStamp32);
100 if(matacqDataFormatVersion>=2){
101 tTrigPs = read32(begin32, tTrigPs32);
107 if(matacqDataFormatVersion>=3){
108 orbitId = read32(begin32, orbitId32);
109 vernier[0] = read32(begin32, vernier0_32);
110 vernier[1] = read32(begin32, vernier1_32);
111 vernier[2] = read32(begin32, vernier2_32);
112 vernier[3] = read32(begin32, vernier3_32);
113 timeStamp.tv_usec = read32(begin32, timeStampMicroSec32);
114 trigRec = read32(begin32, trigRec32,
true);
115 postTrig = read32(begin32, postTrig32);
116 delayA = read32(begin32, delayA32,
true);
117 emtcDelay = read32(begin32, emtcDelay32,
true);
118 emtcPhase = read32(begin32, emtcPhase32,
true);
119 attenuation_dB = read32(begin32, attenuation_dB32,
true);
120 laserPower = read32(begin32, laserPower32,
true);
137 const int nCh = getChannelCount();
138 channelData.resize(nCh);
140 pData16 = (
int16le_t*) (begin+headerLen);
142 for(
int iCh=0; iCh<nCh; ++iCh){
143 if((
size_t)(pData16-begin16)>maxSize){
144 throwExcept(
string(
"Corrupted or truncated data"));
147 channelData[iCh].chId = *(pData16++);
149 channelData[iCh].nSamples = *(pData16++);
151 channelData[iCh].samples = pData16;
153 if(channelData[iCh].nSamples<0){
154 throwExcept(
string(
"Corrupted or truncated data"));
156 pData16 += channelData[iCh].nSamples;
161 int padding = (4-(pData16-begin16))%4;
162 if(padding<0) padding+=4;
164 if((
size_t)(pData16-begin16)>maxSize){
165 throwExcept(
string(
"Corrupted or truncated data"));
168 fragLen = trailer32[1]&0xFFFFFF;
175 const int nHeaders = 3;
176 if(fragLen!=read32(begin32,dccLen32)+nHeaders
177 && fragLen != read32(begin32,dccLen32)){
180 error |= errorLengthConsistency;
184 const int trailerLen = 4;
185 pData16 += trailerLen;
187 parsedLen = (pData16-begin16) / 4;
189 if((pData16-begin16)!=(4*fragLen)){
190 error |= errorLength;
193 if((
size_t)(pData16-begin16)>maxSize){
194 throwExcept(
string(
"Corrupted or truncated data"));
199 error |= errorWrongBoe;
206 uint32_t mask = spec32.
mask;
207 while((mask&0x1) == 0){
213 mask = ((mask >>1) + 1);
214 if(result & mask) result = (uint32_t)-1;
static const field32spec_t vernier1_32
static const field32spec_t fedId32
static const field32spec_t boeType32
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
const T & max(const T &a, const T &b)
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
static int read32(uint32le_t *pData, field32spec_t spec, bool ovfTrans=false)
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