Clean up HltLumiSummaryDecoder
The following discussion from !3518 (merged) should be addressed:
-
@graven started a discussion: I don't like large, repetitive blocks of code where the same thing happens, but just with different data -- so how about defining the data, and then looping over it, eg. by first defining a tiny struct to hold the data:
struct Field { const char* name; LHCb::LumiSummaryOffsets::V2::counterOffsets offset; LHCb::LumiSummaryOffsets::V2::counterOffsets size; };
and then define the data as:
constexpr auto fields = std::array{ Field{ "encodingKey", LHCb::LumiSummaryOffsets::V2::encodingKeyOffset, LHCb::LumiSummaryOffsets::V2::encodingKeySize }, Field{ "T0Low", LHCb::LumiSummaryOffsets::V2::T0LowOffset, LHCb::LumiSummaryOffsets::V2::T0LowSize }, Field{ "T0High", LHCb::LumiSummaryOffsets::V2::T0HighOffset, LHCb::LumiSummaryOffsets::V2::T0HighSize }, ... };
and then finally do:
for ( const auto& [name, offset, size] : fields ) hltLumiSummary.addInfo( name, getField( offset, size, ibank->data() ) );