Skip to content
Snippets Groups Projects
Commit 54bca0e7 authored by Giovanna Lazzari Miotto's avatar Giovanna Lazzari Miotto :mushroom:
Browse files

fix: gmt: Change muon ordering per BX

Fixes issue #63 also in this branch
parent eb589663
No related branches found
No related tags found
No related merge requests found
Pipeline #7960957 passed
...@@ -19,7 +19,8 @@ int MuonOrbitProcessor::ProcessBlock(MemRegion &readable_block, WriteMemRegion & ...@@ -19,7 +19,8 @@ int MuonOrbitProcessor::ProcessBlock(MemRegion &readable_block, WriteMemRegion &
assert(readable_block.CheckBounds(sizeof(SourceDataType))); assert(readable_block.CheckBounds(sizeof(SourceDataType)));
SourceDataType *bl = readable_block.Scan<SourceDataType>(); SourceDataType *bl = readable_block.Scan<SourceDataType>();
BxData<SinkDataType, source_data_length> bx_data_1, bx_data_2; BxData<SinkDataType, 2 * source_data_length> bx_data;
uint32_t count_m1 = 0, count_m2 = 0;
for (unsigned int i = 0; i < source_data_length; i++) { for (unsigned int i = 0; i < source_data_length; i++) {
const auto pt1 = uint32_t{(bl->mu1f[i] >> shifts::pt) & masks::pt}; const auto pt1 = uint32_t{(bl->mu1f[i] >> shifts::pt) & masks::pt};
...@@ -28,15 +29,17 @@ int MuonOrbitProcessor::ProcessBlock(MemRegion &readable_block, WriteMemRegion & ...@@ -28,15 +29,17 @@ int MuonOrbitProcessor::ProcessBlock(MemRegion &readable_block, WriteMemRegion &
// mu.extra is a copy of bl->bx with a change to the first bit. // mu.extra is a copy of bl->bx with a change to the first bit.
if (((pt1 > 0) || (doZS == 0))) { if (((pt1 > 0) || (doZS == 0))) {
// set bit0 to "0" for first muon // set bit0 to "0" for first muon
bx_data_1.Add({bl->mu1f[i], bl->mu1s[i], bl->bx[i] &= ~0x1}); bx_data.Add({bl->mu1f[i], bl->mu1s[i], bl->bx[i] &= ~0x1});
count_m1 += 1;
} }
if (((pt2 > 0) || (doZS == 0))) { if (((pt2 > 0) || (doZS == 0))) {
// set bit0 to "1" for second muon // set bit0 to "1" for second muon
bx_data_2.Add({bl->mu2f[i], bl->mu2s[i], bl->bx[i] |= 0x1}); bx_data.Add({bl->mu2f[i], bl->mu2s[i], bl->bx[i] |= 0x1});
count_m2 += 1;
} }
} }
if (bx_data_1.count + bx_data_2.count == 0) { if (bx_data.count == 0) {
LOG(WARNING) << '#' << nbPackets LOG(WARNING) << '#' << nbPackets
<< ": Detected a bx with zero muons, this should not " << ": Detected a bx with zero muons, this should not "
"happen. Packet is skipped."; "happen. Packet is skipped.";
...@@ -45,12 +48,10 @@ int MuonOrbitProcessor::ProcessBlock(MemRegion &readable_block, WriteMemRegion & ...@@ -45,12 +48,10 @@ int MuonOrbitProcessor::ProcessBlock(MemRegion &readable_block, WriteMemRegion &
// header word of packed muon data contains number of muons in words 3-4 and number of muons in // header word of packed muon data contains number of muons in words 3-4 and number of muons in
// words 5-6, as well as the warning test enable flag. // words 5-6, as well as the warning test enable flag.
meta.header = uint32_t{(bx_data_1.count << 16) + ((static_cast<uint32_t>(meta.header)) << 8) + meta.header = uint32_t{(count_m1 << 16) + ((static_cast<uint32_t>(meta.header)) << 8) + count_m2};
bx_data_2.count};
writeable_block.Fill(BxMetadata{meta.header, meta.bx, meta.orbit}); writeable_block.Fill(BxMetadata{meta.header, meta.bx, meta.orbit});
writeable_block.Fill(bx_data_1.GetBuffer(), bx_data_1.GetSize()); writeable_block.Fill(bx_data.GetBuffer(), bx_data.GetSize());
writeable_block.Fill(bx_data_2.GetBuffer(), bx_data_2.GetSize());
return bx_data_1.count + bx_data_2.count; // Original increments counts with this sum return bx_data.count;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment