GeezerVison is showing github.com — Update MCH Raw Data Decoders (in particular UserLogic one) · AliceO2Group/AliceO2@ebd17d1
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Detectors/MUON/MCH/Raw/Common/include/MCHRawCommon/RDHFields.h +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -90,6 +90,10 @@ void rdhTriggerType(RDH& rdh, uint32_t triggerType); | 90 | 90 |
| 91 | 91 | template <typename RDH> | 92 | 92 | uint8_t rdhEndpoint(const RDH& rdh); | | 93 | + | | 94 | +template <typename RDH> | | 95 | +void rdhEndpoint(RDH& rdh, uint8_t endpoint); | | 96 | + | 93 | 97 | } // namespace raw | 94 | 98 | } // namespace mch | 95 | 99 | } // namespace o2 | |
Collapse file Copy file name to clipboardExpand all lines: Detectors/MUON/MCH/Raw/Common/include/MCHRawCommon/RDHManip.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,7 +34,7 @@ template <typename RDH> | 34 | 34 | RDH createRDH(gsl::span<const std::byte> buffer); | 35 | 35 |
| 36 | 36 | template <typename RDH> | 37 | | -RDH createRDH(uint16_t cruId, uint8_t linkId, uint16_t feeId, uint32_t orbit, uint16_t bunchCrossing, uint16_t payloadSize); | | 37 | +RDH createRDH(uint16_t cruId, uint8_t endpoint, uint8_t linkId, uint16_t feeId, uint32_t orbit, uint16_t bunchCrossing, uint16_t payloadSize); | 38 | 38 |
| 39 | 39 | template <typename RDH> | 40 | 40 | bool isValid(const RDH& rdh); | |
Collapse file Copy file name to clipboardExpand all lines: Detectors/MUON/MCH/Raw/Common/include/MCHRawCommon/SampaCluster.h +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -85,6 +85,9 @@ void assertNotMixingClusters(const std::vector<SampaCluster>& data) | 85 | 85 | } | 86 | 86 |
| 87 | 87 | std::ostream& operator<<(std::ostream& os, const SampaCluster& sc); | | 88 | + | | 89 | +std::string asString(const SampaCluster& sc); | | 90 | + | 88 | 91 | } // namespace raw | 89 | 92 | } // namespace mch | 90 | 93 | } // namespace o2 | |
Collapse file Copy file name to clipboardExpand all lines: Detectors/MUON/MCH/Raw/Common/include/MCHRawCommon/SampaHeader.h +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -111,7 +111,7 @@ class SampaHeader | 111 | 111 | ///@} | 112 | 112 |
| 113 | 113 | /// return the header as a 64-bits integer | 114 | | - uint64_t uint64() const { return mValue; } | | 114 | + constexpr uint64_t uint64() const { return mValue; } | 115 | 115 |
| 116 | 116 | /// sets the value from a 64-bits integer. | 117 | 117 | /// if the value does not fit within 50 bits an exception is thrown. | @@ -128,6 +128,9 @@ constexpr uint64_t sampaSyncWord{0x1555540f00113}; | 128 | 128 | /// The 50-bits Sampa SYNC word. | 129 | 129 | SampaHeader sampaSync(); | 130 | 130 |
| | 131 | +/// Return channel number (0..63) | | 132 | +uint8_t channelNumber64(const SampaHeader& sh); | | 133 | + | 131 | 134 | /// packetTypeName returns a string representation of the given packet type. | 132 | 135 | std::string packetTypeName(SampaPacketType pkt); | 133 | 136 |
| @@ -152,6 +155,8 @@ int computeHeaderParity2(uint64_t value); | 152 | 155 | int computeHeaderParity3(uint64_t value); | 153 | 156 | int computeHeaderParity4(uint64_t value); | 154 | 157 |
| | 158 | +std::string asString(const SampaHeader& sh); | | 159 | + | 155 | 160 | std::ostream& | 156 | 161 | operator<<(std::ostream& os, const SampaHeader& sh); | 157 | 162 |
| |
Collapse file Copy file name to clipboardExpand all lines: Detectors/MUON/MCH/Raw/Common/src/RDHFieldsV4.cxx +13-3Lines changed: 13 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 |
| 11 | 11 | #include "Headers/RAWDataHeader.h" | 12 | 12 | #include "MCHRawCommon/RDHFields.h" | | 13 | +#include "Assertions.h" | 13 | 14 |
| 14 | 15 | namespace o2::mch::raw | 15 | 16 | { | @@ -35,14 +36,16 @@ uint16_t rdhPayloadSize(const o2::header::RAWDataHeaderV4& rdh) | 35 | 36 | template <> | 36 | 37 | uint8_t rdhLinkId(const o2::header::RAWDataHeaderV4& rdh) | 37 | 38 | { | 38 | | - return rdh.linkID + 12 * rdh.endPointID; | | 39 | + return rdh.linkID; | 39 | 40 | } | 40 | 41 |
| 41 | 42 | template <> | 42 | 43 | void rdhLinkId(o2::header::RAWDataHeaderV4& rdh, uint8_t linkId) | 43 | 44 | { | 44 | | - rdh.linkID = linkId % 12; | 45 | | - rdh.endPointID = linkId / 12; | | 45 | + if (linkId < 0 || (linkId > 11 && linkId != 15)) { | | 46 | + throw std::invalid_argument(fmt::format("linkId should be between 0 and 11 or = 15 but is {}", linkId)); | | 47 | + } | | 48 | + rdh.linkID = linkId; | 46 | 49 | } | 47 | 50 |
| 48 | 51 | template <> | @@ -158,4 +161,11 @@ uint8_t rdhEndpoint(const o2::header::RAWDataHeaderV4& rdh) | 158 | 161 | { | 159 | 162 | return rdh.endPointID; | 160 | 163 | } | | 164 | + | | 165 | +template <> | | 166 | +void rdhEndpoint(o2::header::RAWDataHeaderV4& rdh, uint8_t endpoint) | | 167 | +{ | | 168 | + impl::assertIsInRange("endpoint", endpoint, 0, 1); | | 169 | + rdh.endPointID = endpoint; | | 170 | +} | 161 | 171 | } // namespace o2::mch::raw |
Collapse file Copy file name to clipboardExpand all lines: Detectors/MUON/MCH/Raw/Common/src/RDHManip.cxx +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -186,7 +186,7 @@ RAWDataHeaderV4 createRDH(gsl::span<const std::byte> buffer) | 186 | 186 | } | 187 | 187 |
| 188 | 188 | template <> | 189 | | -RAWDataHeaderV4 createRDH(uint16_t cruId, uint8_t linkId, uint16_t feeId, uint32_t orbit, uint16_t bunchCrossing, | | 189 | +RAWDataHeaderV4 createRDH(uint16_t cruId, uint8_t endpoint, uint8_t linkId, uint16_t feeId, uint32_t orbit, uint16_t bunchCrossing, | 190 | 190 | uint16_t payloadSize) | 191 | 191 | { | 192 | 192 | RAWDataHeaderV4 rdh; | @@ -199,6 +199,7 @@ RAWDataHeaderV4 createRDH(uint16_t cruId, uint8_t linkId, uint16_t feeId, uint32 | 199 | 199 |
| 200 | 200 | rdh.cruID = cruId; | 201 | 201 | rdhLinkId(rdh, linkId); | | 202 | + rdhEndpoint(rdh, endpoint); | 202 | 203 | rdh.feeId = feeId; | 203 | 204 | rdh.priority = 0; | 204 | 205 | rdh.blockLength = memorySize - sizeof(rdh); // FIXME: the blockLength disappears in RDHv5 ? | |
Collapse file Copy file name to clipboardExpand all lines: Detectors/MUON/MCH/Raw/Common/src/SampaCluster.cxx +9-1Lines changed: 9 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 12 | 12 | #include "MCHRawCommon/DataFormats.h" | 13 | 13 | #include "Assertions.h" | 14 | 14 | #include <fmt/format.h> | | 15 | +#include <sstream> | 15 | 16 |
| 16 | 17 | namespace o2 | 17 | 18 | { | @@ -37,7 +38,7 @@ SampaCluster::SampaCluster(uint16_t timestamp, const std::vector<uint16_t>& samp | 37 | 38 | throw std::invalid_argument("cannot add data with no sample"); | 38 | 39 | } | 39 | 40 | for (auto i = 0; i < samples.size(); i++) { | 40 | | - impl::assertIsInRange(fmt::format("samples[{}]", i), samples[i], 0, 0x3FF); | | 41 | + impl::assertIsInRange("sample", samples[i], 0, 0x3FF); | 41 | 42 | } | 42 | 43 | } | 43 | 44 |
| @@ -82,6 +83,13 @@ std::ostream& operator<<(std::ostream& os, const SampaCluster& sc) | 82 | 83 | return os; | 83 | 84 | } | 84 | 85 |
| | 86 | +std::string asString(const SampaCluster& sc) | | 87 | +{ | | 88 | + std::stringstream s; | | 89 | + s << sc; | | 90 | + return s.str(); | | 91 | +} | | 92 | + | 85 | 93 | } // namespace raw | 86 | 94 | } // namespace mch | 87 | 95 | } // namespace o2 |
Collapse file Copy file name to clipboardExpand all lines: Detectors/MUON/MCH/Raw/Common/src/SampaHeader.cxx +15-2Lines changed: 15 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 18 | 18 | #include <algorithm> | 19 | 19 | #include "NofBits.h" | 20 | 20 | #include <array> | | 21 | +#include <sstream> | 21 | 22 |
| 22 | 23 | namespace | 23 | 24 | { | @@ -373,8 +374,10 @@ SampaHeader sampaSync() | 373 | 374 | 0); | 374 | 375 | } | 375 | 376 |
| 376 | | -std::ostream& operator<<(std::ostream& os, const SampaHeader& sh) | | 377 | +std::string asString(const SampaHeader& sh) | 377 | 378 | { | | 379 | + std::stringstream os; | | 380 | + | 378 | 381 | uint64_t one = 1; | 379 | 382 | std::vector<int> sep = {5, 6, 9, 19, 23, 28, 48}; | 380 | 383 | for (int i = 0; i < 50; i++) { | @@ -397,7 +400,12 @@ std::ostream& operator<<(std::ostream& os, const SampaHeader& sh) | 397 | 400 | packetTypeName(sh.packetType()), | 398 | 401 | sh.hasError() ? "ERROR" : "") | 399 | 402 | << "\n"; | 400 | | - return os; | | 403 | + return os.str(); | | 404 | +} | | 405 | + | | 406 | +std::ostream& operator<<(std::ostream& os, const SampaHeader& sh) | | 407 | +{ | | 408 | + return os << asString(sh); | 401 | 409 | } | 402 | 410 |
| 403 | 411 | // conv array convert a bit position in the hamming sense | @@ -611,6 +619,11 @@ int computeHeaderParity4(uint64_t no) | 611 | 619 | no &= ~(one << 6); // reset bit 6 | 612 | 620 | return computeParity(no); | 613 | 621 | } | | 622 | + | | 623 | +uint8_t channelNumber64(const SampaHeader& sh) | | 624 | +{ | | 625 | + return sh.channelAddress() + (sh.chipAddress() % 2) * 32; | | 626 | +} | 614 | 627 | } // namespace raw | 615 | 628 | } // namespace mch | 616 | 629 | } // namespace o2 |
Collapse file Copy file name to clipboardExpand all lines: Detectors/MUON/MCH/Raw/Common/test/CMakeLists.txt +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 |
| 11 | 11 | o2_add_test(rdh-manip | 12 | 12 | SOURCES testRDHManip.cxx | 13 | | - COMPONENT_NAME mch | 14 | | - LABELS "mch;raw" | | 13 | + COMPONENT_NAME mchraw | | 14 | + LABELS "muon;mch;raw" | 15 | 15 | PUBLIC_LINK_LIBRARIES O2::MCHRawCommon Boost::boost) | 16 | 16 |
| 17 | 17 | o2_add_test(sampa-header | 18 | 18 | SOURCES testSampaHeader.cxx | 19 | | - COMPONENT_NAME mch | 20 | | - LABELS "mch;raw" | | 19 | + COMPONENT_NAME mchraw | | 20 | + LABELS "muon;mch;raw" | 21 | 21 | PUBLIC_LINK_LIBRARIES O2::MCHRawCommon Boost::boost) | 22 | 22 |
| 23 | 23 | o2_add_test(sampa-cluster | 24 | 24 | SOURCES testSampaCluster.cxx | 25 | | - COMPONENT_NAME mch | 26 | | - LABELS "mch;raw" | | 25 | + COMPONENT_NAME mchraw | | 26 | + LABELS "muon;mch;raw" | 27 | 27 | PUBLIC_LINK_LIBRARIES O2::MCHRawCommon Boost::boost) | 28 | 28 |
| 29 | 29 | if(benchmark_FOUND) | |
Collapse file Copy file name to clipboardExpand all lines: Detectors/MUON/MCH/Raw/Decoder/CMakeLists.txt +19-18Lines changed: 19 additions & 18 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | # submit itself to any jurisdiction. | 10 | 10 |
| 11 | 11 | o2_add_library(MCHRawDecoder | 12 | | - SOURCES src/Decoder.cxx | 13 | | - PUBLIC_LINK_LIBRARIES O2::MCHRawCommon O2::MCHRawElecMap | 14 | | - PRIVATE_LINK_LIBRARIES O2::MCHRawImplHelpers) | | 12 | + SOURCES src/PageDecoder.cxx src/DecoderLogic.cxx | | 13 | + PUBLIC_LINK_LIBRARIES O2::MCHRawCommon O2::MCHRawElecMap | | 14 | + PRIVATE_LINK_LIBRARIES O2::MCHRawImplHelpers) | 15 | 15 |
| 16 | 16 | if(BUILD_TESTING) | 17 | | - o2_add_test(decoder | 18 | | - SOURCES src/testDecoder.cxx | 19 | | - COMPONENT_NAME mch | 20 | | - LABELS "mch;raw" | 21 | | - PUBLIC_LINK_LIBRARIES O2::MCHRawDecoder O2::MCHTestRawRefBuffers) | | 17 | + o2_add_test(page-decoder | | 18 | + SOURCES src/testPageDecoder.cxx | | 19 | + COMPONENT_NAME mchraw | | 20 | + LABELS "muon;mch;raw" | | 21 | + PUBLIC_LINK_LIBRARIES O2::MCHRawDecoder O2::MCHTestRawRefBuffers | | 22 | + O2::DPLUtils) | 22 | 23 |
| 23 | | - o2_add_test(bare-elink-decoder | 24 | | - SOURCES src/testBareElinkDecoder.cxx | 25 | | - COMPONENT_NAME mch | 26 | | - LABELS "mch;raw" | 27 | | - PUBLIC_LINK_LIBRARIES O2::MCHRawDecoder O2::MCHRawImplHelpers) | | 24 | + o2_add_test(bare-elink-decoder | | 25 | + SOURCES src/testBareElinkDecoder.cxx | | 26 | + COMPONENT_NAME mchraw | | 27 | + LABELS "muon;mch;raw" | | 28 | + PUBLIC_LINK_LIBRARIES O2::MCHRawDecoder O2::MCHRawImplHelpers) | 28 | 29 |
| 29 | | - o2_add_test(userlogic-elink-decoder | 30 | | - SOURCES src/testUserLogicElinkDecoder.cxx | 31 | | - COMPONENT_NAME mch | 32 | | - LABELS "mch;raw" | 33 | | - PUBLIC_LINK_LIBRARIES O2::MCHRawDecoder O2::MCHRawImplHelpers) | | 30 | + o2_add_test(userlogic-endpoint-decoder | | 31 | + SOURCES src/testUserLogicEndpointDecoder.cxx | | 32 | + COMPONENT_NAME mchraw | | 33 | + LABELS "muon;mch;raw" | | 34 | + PUBLIC_LINK_LIBRARIES O2::MCHRawDecoder O2::MCHRawImplHelpers) | 34 | 35 |
| 35 | 36 | endif() |
|