37 link.clear(
false,
true);
43 if ( bufref.entry == -1 )
63 for (
auto& link : mGBTLinks )
65 link.collectROFCableData();
84 <<
"!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!! \n"
85 <<
"DMA packet has incomplete FLX words, only "
87 <<
" FLX words), will be decoded. \n"
88 <<
"!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!! \n"
121 if ( pageSizeInBytes > (dlength - payload_position) )
129 if ( lnkref.entry == -1 )
139 << gbtLink.prev_pck_cnt << std::endl;
140 payload_position += pageSizeInBytes;
145 gbtLink.data.add((
payload + payload_position), pageSizeInBytes);
149 if ( gbtLink.hbf_found )
151 log_error <<
"FLX: " << gbtLink.flxId <<
", FeeId: " << gbtLink.feeId \
152 <<
". Found new HBF before stop previous HBF. Previous HBF will be ignored." << std::endl;
153 gbtLink.cacheData(gbtLink.hbf_length,
true);
155 gbtLink.hbf_found =
true;
156 gbtLink.hbf_length = pageSizeInBytes;
160 gbtLink.hbf_length += pageSizeInBytes;
165 if ( ! gbtLink.hbf_found )
167 log_error <<
"FLX: " << gbtLink.flxId <<
", FeeId: " << gbtLink.feeId \
168 <<
". Stopping HBF without start. This block will be ignored." << std::endl;
169 gbtLink.cacheData(gbtLink.hbf_length,
true);
171 gbtLink.hbf_found =
false;
172 gbtLink.cacheData(gbtLink.hbf_length,
false);
174 payload_position += pageSizeInBytes;
183 std::cout <<
"Felix header: " << std::hex <<
"0x" << std::setfill(
'0') << std::setw(4);
204 if ( strcmp(what,
"NR_LINKS") == 0)
210 std::cout <<
"Unknow option " << what << std::endl;
216 if ( strcmp(what,
"FEEID") == 0 )
224 log_error <<
"FeeId " << i <<
" was not found in the feeId mapping for this packet" << std::endl;
228 if ( strcmp(what,
"NR_HBF") == 0 )
232 log_error <<
"Mismatch size for HBF from hbfData: " <<
mGBTLinks[lnkId].hbf_count <<
" and link rawData Pieces: " \
233 <<
mGBTLinks[lnkId].rawData.getNPieces() << std::endl;
238 else if ( strcmp(what,
"NR_PHYS_TRG") == 0 )
240 return mGBTLinks[lnkId].mL1TrgTime.size();
242 else if ( strcmp(what,
"NR_STROBES") == 0 )
246 else if ( strcmp(what,
"NR_HITS") == 0 )
248 return mGBTLinks[lnkId].hit_vector.size();
252 std::cout <<
"Unknow option " << what << std::endl;
262 uint32_t feeId = i_feeid;
267 log_error <<
"FeeId " << feeId <<
" was not found in the feeId mapping for this packet" << std::endl;
272 if ( strcmp(what,
"L1_IR_BC") == 0 )
274 return (index <
mGBTLinks[lnkId].mL1TrgTime.size()) ?
mGBTLinks[lnkId].mL1TrgTime[index].bc : -1;
276 else if ( strcmp(what,
"TRG_IR_BC") == 0 )
278 return (index <
mGBTLinks[lnkId].mTrgData.size()) ?
mGBTLinks[lnkId].mTrgData[index].ir.bc : -1;
280 else if ( strcmp(what,
"TRG_NR_HITS") == 0)
282 return (index <
mGBTLinks[lnkId].mTrgData.size()) ?
mGBTLinks[lnkId].mTrgData[index].n_hits : -1;
286 std::cout <<
"Unknow option " << what << std::endl;
296 uint32_t feeId = i_feeid;
297 uint32_t trg = i_trg;
298 uint32_t hit = i_hit;
302 log_error <<
"FeeId " << feeId <<
"was not found in the feeId mapping for this packet" << std::endl;
307 uint32_t hit_global_id =
mGBTLinks[lnkId].mTrgData[trg].first_hit_pos + hit;
309 if ( strcmp(what,
"HIT_CHIP_ID") == 0 )
311 return ( (hit >= 0) && (hit <
mGBTLinks[lnkId].mTrgData[trg].n_hits) ) ? \
312 mGBTLinks[lnkId].hit_vector[hit_global_id]->chip_id : -1;
314 else if ( strcmp(what,
"HIT_BC") == 0 )
316 return ( (hit >= 0) && (hit <
mGBTLinks[lnkId].mTrgData[trg].n_hits) ) ? \
317 mGBTLinks[lnkId].hit_vector[hit_global_id]->bunchcounter : -1;
319 else if ( strcmp(what,
"HIT_ROW") == 0 )
321 return ( (hit >= 0) && (hit <
mGBTLinks[lnkId].mTrgData[trg].n_hits) ) ? \
322 mGBTLinks[lnkId].hit_vector[hit_global_id]->row_pos : -1;
324 else if ( strcmp(what,
"HIT_COL") == 0 )
326 return ( (hit >= 0) && (hit <
mGBTLinks[lnkId].mTrgData[trg].n_hits) ) ? \
327 mGBTLinks[lnkId].hit_vector[hit_global_id]->col_pos : -1;
331 std::cout <<
"Unknow option " << what << std::endl;
342 uint32_t feeId = i_feeid;
347 log_error <<
"FeeId " << feeId <<
"was not found in the feeId mapping for this packet" << std::endl;
352 if ( strcmp(what,
"L1_IR_BCO") == 0 )
354 return (index <
mGBTLinks[lnkId].mL1TrgTime.size()) ?
mGBTLinks[lnkId].mL1TrgTime[index].orbit : -1;
356 else if ( strcmp(what,
"TRG_IR_BCO") == 0 )
358 return (index <
mGBTLinks[lnkId].mTrgData.size()) ?
mGBTLinks[lnkId].mTrgData[index].ir.orbit : -1;
362 std::cout <<
"Unknow option " << what << std::endl;
377 int num_feeids =
iValue(-1,
"NR_LINKS");
378 os <<
"Event: " <<
mEventId <<
" Number of feeid: " << num_feeids << std::endl;
381 for (
int i = 0;
i < num_feeids; ++
i )
383 auto feeId =
iValue(
i,
"FEEID");
384 auto hbfSize =
iValue(feeId,
"NR_HBF");
385 os <<
"Link " << setw(4) << feeId <<
" has " << hbfSize <<
" HBs, ";
386 os <<
iValue(feeId,
"NR_STROBES") <<
" strobes and ";
387 os <<
iValue(feeId,
"NR_PHYS_TRG") <<
" L1 triggers" << std::endl;
389 for (
int iL1 = 0; iL1 <
iValue(feeId,
"NR_PHYS_TRG"); ++iL1 )
391 os <<
"L1: " << iL1 << std::hex <<
" BCO: 0x" <<
lValue(feeId, iL1,
"L1_IR_BCO");
392 os << std::dec <<
" BC: " <<
iValue(feeId, iL1,
"L1_IR_BC") << endl;
395 os <<
"Total number of hits: " <<
iValue(feeId,
"NR_HITS") << endl;
396 for (
int i_trg = 0; i_trg <
iValue(feeId,
"NR_STROBES"); ++i_trg )
398 os <<
"-- Strobe: " << i_trg;
399 os <<
", BCO: 0x" << std::hex <<
lValue(feeId, i_trg,
"TRG_IR_BCO") << std::dec;
400 os <<
" BC: " <<
iValue(feeId, i_trg,
"TRG_IR_BC");
401 os <<
", has " <<
iValue(feeId, i_trg,
"TRG_NR_HITS") <<
" hits." << std::endl;
403 if (
iValue(feeId, i_trg,
"TRG_NR_HITS") )
405 os <<
" hit number chip_id bc row col " << endl;
407 for (
int i_hit = 0; i_hit <
iValue(feeId, i_trg,
"TRG_NR_HITS"); ++i_hit )
409 os << setw(4) << i_hit;
410 os <<
" " << setw(9) <<
iValue(feeId, i_trg, i_hit,
"HIT_CHIP_ID");
411 os <<
" " << setw(8) << std::hex <<
iValue(feeId, i_trg, i_hit,
"HIT_BC") << std::dec;
412 os <<
" " << setw(4) <<
iValue(feeId, i_trg, i_hit,
"HIT_ROW");
413 os <<
" " << setw(4) <<
iValue(feeId, i_trg, i_hit,
"HIT_COL");
428 link.clear(
true,
true);