Perform BX map decoding on the fly
Compare changes
+ 174
− 151
@@ -6,6 +6,7 @@
@@ -6,6 +6,7 @@
@@ -25,19 +26,6 @@ StreamProcessor::StreamProcessor(size_t max_size_, bool doZS_, ProcessorType pro
@@ -25,19 +26,6 @@ StreamProcessor::StreamProcessor(size_t max_size_, bool doZS_, ProcessorType pro
BrilHistoQueue<std::array<uint32_t, constants::NBXPerOrbit + constants::NFramesInHistoHeader>> StreamProcessor::BrilQueue;
@@ -75,26 +63,16 @@ bool StreamProcessor::CheckFrameMultBlock(size_t inputSize){
@@ -75,26 +63,16 @@ bool StreamProcessor::CheckFrameMultBlock(size_t inputSize){
// Looks for orbit trailer then counts the non-empty bunch crossings and fills a vector with their values
for (unsigned int k = 0; k < (14*8); k++){ // 14*8 = 14 frames, 8 links of orbit trailer containing BX hitmap
@@ -110,38 +88,60 @@ inline std::pair<uint32_t, bool> StreamProcessor::ProcessOrbitHeader(char* rd_pt
@@ -110,38 +88,60 @@ inline std::pair<uint32_t, bool> StreamProcessor::ProcessOrbitHeader(char* rd_pt
// Goes through orbit worth of data and fills the output memory with the calo data corresponding to the non-empty bunchcrossings, as marked in bx_vect
StreamProcessor::fillOrbitMetadata StreamProcessor::FillOrbitCalo(std::vector<unsigned int>& bx_vect, char* rd_ptr, char* wr_ptr){
std::pair<uint32_t, bool> orbit_header = std::pair<uint32_t, bool> {ProcessOrbitHeader(rd_ptr)};//.second is the warning test enable bit
@@ -155,6 +155,7 @@ uint32_t StreamProcessor::FillBril(char* rd_ptr, char* wr_ptr, char* end_ptr){
@@ -155,6 +155,7 @@ uint32_t StreamProcessor::FillBril(char* rd_ptr, char* wr_ptr, char* end_ptr){
//BrilHistoQueue<std::array<uint32_t, constants::NBXPerOrbit + constants::NFramesInHistoHeader>> BrilQueue;
@@ -177,7+178,7 @@
@@ -177,7+178,7 @@
uint32_t packed_size = sizeof(uint32_t)*NHistosPerPacket*(constants::NBXPerOrbit + constants::NFramesInHistoHeader);
for (std::array<uint32_t, constants::NBXPerOrbit + constants::NFramesInHistoHeader> & hist : histo_arr){
@@ -186,7+187,7 @@
@@ -186,7+187,7 @@
// Goes through orbit worth of data and fills the output memory with the muons corresponding to the non-empty bunchcrossings, as marked in bx_vect
StreamProcessor::fillOrbitMetadata StreamProcessor::FillOrbitMuon(std::vector<unsigned int>& bx_vect, char* rd_ptr, char* wr_ptr){
std::pair<uint32_t, bool> orbit_header = std::pair<uint32_t, bool>{ProcessOrbitHeader(rd_ptr)};//.second is the warning test enable bit
if (bl->orbit[0]==constants::beefdead){ break; } // orbit trailer has been reached, end of orbit data
if ((bxA != bx) && (i == 0) && (bx<3555) && control.verbosity){ //only prints warning when BX < 3555 i.e from the same orbit
LOG(WARNING) << '#' << nbPackets << ": Detected a bx with zero muons, this should not happen. Packet is skipped.";
//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.
uint32_t header = uint32_t{(mAcount << 16) + ((static_cast<uint32_t>(orbit_header.second))<<8) + mBcount};
@@ -272,15 +294,17 @@ void StreamProcessor::process(Slice& input, Slice& out)
@@ -272,15 +294,17 @@ void StreamProcessor::process(Slice& input, Slice& out)
@@ -288,7 +312,7 @@ void StreamProcessor::process(Slice& input, Slice& out)
@@ -288,7 +312,7 @@ void StreamProcessor::process(Slice& input, Slice& out)
@@ -296,40 +320,39 @@ void StreamProcessor::process(Slice& input, Slice& out)
@@ -296,40 +320,39 @@ void StreamProcessor::process(Slice& input, Slice& out)
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;
wr_ptr+= orbitCount*12 + 12*bx_vect.size(); // 12 bytes for each muon/count then 12 bytes for each bx header
rd_ptr+= 32 + bx_vect.size()*sizeof(blockMuon) + constants::orbit_trailer_size; // 32 for orbit header, + nBXs + orbit trailer