std::pair<uint32_t,bool>orbit_header=std::pair<uint32_t,bool>{ProcessOrbitHeader(rd_ptr)};//.second is the warning test enable bit
rd_ptr+=32;// +32 to account for orbit header
uint32_torbit=uint32_t{orbit_header.first}-1;// Starting with orbit number one lower than what is in the header because the "link orbit" contains a few BXs of the previous orbit
uint32_tcounts=uint32_t{0};
uint32_tfilled_bxs=0;
// We loop over the BX map from the orbit trailer and then match the filled BXs to the data we got.
// The logic below is annoyingly convoluted:
// The first BX we get in the data stream is from BX 3555, however the BX map starts at BX 1,
// we therefore need to start reading the BX map from the 3555th bit.
// 3555//32 = 111, so we start at the 111th word; 3555 mod 32 = 3, however we start counting at BX1, so the start bit is 2.
uint32_tbx=3554;// We start at 3554 here, because we increment by 1 immediately after starting the loops.
size_tword=111;
size_tbit=1;// Will be incremented immediately after starting the loop
for(size_tpseudo_bx=0;pseudo_bx<3564;++pseudo_bx){// Looping over at most an entire orbit here.
if(word==14*8-1&&bit==11){// Bit 11 in word 111 is the last valid BX (3564), so we roll over afterwards. (== 11 because that's the one we worked on in the previous loop iteration)
word=0;
bit=0;
bx=0;// Will be immediately incremented to 1.
++orbit;
}elseif(bit<31){
++bit;
}else{
bit=0;
++word;
}
++bx;
if((trailer->bx_map[word]&(1<<bit))==0){
continue;// If the bit is zero that BX was empty and we continue.
LOG(WARNING)<<'#'<<nbPackets<<": Detected a bx with zero muons, this should not happen. Packet is skipped.";
continue;
}
//header word of packed muon data contains mAcount (number of muons in words 3,4) and mBcount (number of muons in words 5,5), as well as the warning test enaable flag.
std::pair<uint32_t,bool>orbit_header=std::pair<uint32_t,bool>{ProcessOrbitHeader(rd_ptr)};//.second is the warning test enable bit
rd_ptr+=32;// +32 to account for orbit header
uint32_torbit=uint32_t{orbit_header.first}-1;// Starting with orbit number one lower than what is in the header because the "link orbit" contains a few BXs of the previous orbit
uint32_tcounts=uint32_t{0};
uint32_tfilled_bxs=0;
// We loop over the BX map from the orbit trailer and then match the filled BXs to the data we got.
// The logic below is annoyingly convoluted:
// The first BX we get in the data stream is from BX 3555, however the BX map starts at BX 1,
// we therefore need to start reading the BX map from the 3555th bit.
// 3555//32 = 111, so we start at the 111th word; 3555 mod 32 = 3, however we start counting at BX1, so the start bit is 2.
uint32_tbx=3554;// We start at 3554 here, because we increment by 1 immediately after starting the loops.
size_tword=111;
size_tbit=1;// Will be incremented immediately after starting the loop
for(size_tpseudo_bx=0;pseudo_bx<3564;++pseudo_bx){// Looping over at most an entire orbit here.
if(word==14*8-1&&bit==11){// Bit 11 in word 111 is the last valid BX (3564), so we roll over afterwards. (== 11 because that's the one we worked on in the previous loop iteration)
word=0;
bit=0;
bx=0;// Will be immediately incremented to 1.
++orbit;
}elseif(bit<31){
++bit;
}else{
bit=0;
++word;
}
++bx;
if((trailer->bx_map[word]&(1<<bit))==0){
continue;// If the bit is zero that BX was empty and we continue.
LOG(WARNING)<<'#'<<nbPackets<<": Detected a bx with zero muons, this should not happen. Packet is skipped.";
continue;
}
//header word of packed muon data contains mAcount (number of muons in words 3,4) and mBcount (number of muons in words 5,5), as well as the warning test enaable flag.
LOG(WARNING)<<"Orbit trailer error: orbit trailer not found before end of data packet. Packet will be skipped. Orbit trailer error count = "<<stats.orbit_trailer_error_count;