10 constexpr
unsigned short HitSize = 11;
11 constexpr
unsigned short PatternSize = 50;
12 constexpr
int MaxHitsV12 = (PatternSize *
sizeof(uint16_t) * 8) / HitSize;
14 auto getHitFromOldHitPattern(
const uint16_t hitPattern[],
const int position) {
15 const uint16_t bitEndOffset = (
position + 1) * HitSize;
16 const uint8_t secondWord = (bitEndOffset >> 4);
17 const uint8_t secondWordBits = bitEndOffset & (16 - 1);
18 if (secondWordBits >= HitSize) {
20 const uint8_t lowBitsToTrash = secondWordBits - HitSize;
21 return (hitPattern[secondWord] >> lowBitsToTrash) & ((1 << HitSize) - 1);
23 const uint8_t firstWordBits = HitSize - secondWordBits;
24 const uint16_t firstWordBlock = hitPattern[secondWord - 1] >> (16 - firstWordBits);
25 const uint16_t secondWordBlock = hitPattern[secondWord] & ((1 << secondWordBits) - 1);
26 return firstWordBlock + (secondWordBlock << firstWordBits);
29 auto hitTypeFromOldHitPattern(
const uint16_t
pattern) {
31 constexpr
unsigned short HitTypeMask = 0x3;
32 constexpr
unsigned short HitTypeOffset = 0;
39 const uint16_t rawHitType = (
pattern >> HitTypeOffset) & HitTypeMask;
62 uint8_t beginTrackHits,
71 for (
int i = 0;
i < MaxHitsV12;
i++) {
72 uint16_t
pattern = getHitFromOldHitPattern(oldHitPattern,
i);