23 #ifdef CMSSW //compilation within CMSSW framework
32 #else //compilation outside CMSSW framework (e.g. online)
37 throw std::runtime_error(s.c_str());
40 #endif //CMSSW not defined
84 unsigned char*
begin = (
unsigned char*) pData;
88 const int daqHeaderLen = 16;
93 pData16 += daqHeaderLen/
sizeof(pData16[0]);
96 matacqDataFormatVersion = read32(begin32, formatVersion32);
97 freqGHz = read32(begin32, freqGHz32);
98 channelCount = read32(begin32, channelCount32);
99 timeStamp.tv_sec = read32(begin32, timeStamp32);
101 if(matacqDataFormatVersion>=2){
102 tTrigPs = read32(begin32, tTrigPs32);
108 if(matacqDataFormatVersion>=3){
109 orbitId = read32(begin32, orbitId32);
110 vernier[0] = read32(begin32, vernier0_32);
111 vernier[1] = read32(begin32, vernier1_32);
112 vernier[2] = read32(begin32, vernier2_32);
113 vernier[3] = read32(begin32, vernier3_32);
114 timeStamp.tv_usec = read32(begin32, timeStampMicroSec32);
115 trigRec = read32(begin32, trigRec32,
true);
116 postTrig = read32(begin32, postTrig32);
117 delayA = read32(begin32, delayA32,
true);
118 emtcDelay = read32(begin32, emtcDelay32,
true);
119 emtcPhase = read32(begin32, emtcPhase32,
true);
120 attenuation_dB = read32(begin32, attenuation_dB32,
true);
121 laserPower = read32(begin32, laserPower32,
true);
138 const int nCh = getChannelCount();
139 channelData.resize(nCh);
141 pData16 = (
int16le_t*) (begin+headerLen);
143 for(
int iCh=0; iCh<nCh; ++iCh){
144 if((
size_t)(pData16-begin16)>maxSize){
145 throwExcept(
string(
"Corrupted or truncated data"));
148 channelData[iCh].chId = *(pData16++);
150 channelData[iCh].nSamples = *(pData16++);
152 channelData[iCh].samples = pData16;
154 if(channelData[iCh].nSamples<0){
155 throwExcept(
string(
"Corrupted or truncated data"));
157 pData16 += channelData[iCh].nSamples;
162 int padding = (4-(pData16-begin16))%4;
163 if(padding<0) padding+=4;
165 if((
size_t)(pData16-begin16)>maxSize){
166 throwExcept(
string(
"Corrupted or truncated data"));
169 fragLen = trailer32[1]&0xFFFFFF;
176 const int nHeaders = 3;
177 if(fragLen!=read32(begin32,dccLen32)+nHeaders
178 && fragLen != read32(begin32,dccLen32)){
181 error |= errorLengthConsistency;
185 const int trailerLen = 4;
186 pData16 += trailerLen;
188 parsedLen = (pData16-begin16) / 4;
190 if((pData16-begin16)!=(4*fragLen)){
191 error |= errorLength;
194 if((
size_t)(pData16-begin16)>maxSize){
195 throwExcept(
string(
"Corrupted or truncated data"));
200 error |= errorWrongBoe;
207 uint32_t mask = spec32.
mask;
208 while((mask&0x1) == 0){
214 mask = ((mask >>1) + 1);
215 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)
std::string timeStamp(TimePoint_t)
static const field32spec_t bxId32