From c7d75c0525582d8b59b0c367fae5d0565509c184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 25 Nov 2026 07:24:44 +0100 Subject: [PATCH 1/4] Modify access specifiers in FlatLutEntry.h --- ALICE3/Core/FlatLutEntry.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ALICE3/Core/FlatLutEntry.h b/ALICE3/Core/FlatLutEntry.h index 7e095f989c1..c7cc6b7c508 100644 --- a/ALICE3/Core/FlatLutEntry.h +++ b/ALICE3/Core/FlatLutEntry.h @@ -139,6 +139,11 @@ class FlatLutData */ lutEntry_t* getEntry(int nch_bin, int rad_bin, int eta_bin, int pt_bin); + /** + * @brief Set LUT entry + */ + void setEntry(int rad_bin, const lutEntry_t& entry); + /** * @brief Get LUT header (view) */ @@ -200,12 +205,12 @@ class FlatLutData */ void reset(); - private: /** * @brief Linear index calculation for entry access */ [[nodiscard]] size_t getEntryOffset(int nch_bin, int rad_bin, int eta_bin, int pt_bin) const; + private: /** * @brief Update dimensions from the current header */ From ca35629bcde9d64bd4f1dfe6cec64edd5c51f082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 25 Nov 2026 07:25:02 +0100 Subject: [PATCH 2/4] Implement setEntry method in FlatLutData Added setEntry method to update LUT entries. --- ALICE3/Core/FlatLutEntry.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ALICE3/Core/FlatLutEntry.cxx b/ALICE3/Core/FlatLutEntry.cxx index 66a6cedf860..791860c3df1 100644 --- a/ALICE3/Core/FlatLutEntry.cxx +++ b/ALICE3/Core/FlatLutEntry.cxx @@ -149,6 +149,13 @@ lutEntry_t* FlatLutData::getEntry(int nch_bin, int rad_bin, int eta_bin, int pt_ return reinterpret_cast(mData.data() + offset); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) } +void FlatLutData::setEntry(int rad_bin, const lutEntry_t& entry) +{ + // Calculate the linear index based on the entry's bin indices + const size_t offset = getEntryOffset(entry.nch, rad_bin, entry.eta, entry.pt); + std::memcpy(mData.data() + offset, &entry, sizeof(lutEntry_t)); +} + const lutHeader_t& FlatLutData::getHeaderRef() const { return *reinterpret_cast(mDataRef.data()); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) From c0f603e9b11ac2ff9d6240b6d261b6036a5d2cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 25 Nov 2026 07:25:26 +0100 Subject: [PATCH 3/4] Add getNbins method to SecondaryLutAxis --- ALICE3/Core/SecondaryLut.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ALICE3/Core/SecondaryLut.h b/ALICE3/Core/SecondaryLut.h index 863fd76010d..cfe36f0af7b 100644 --- a/ALICE3/Core/SecondaryLut.h +++ b/ALICE3/Core/SecondaryLut.h @@ -47,6 +47,8 @@ struct SecondaryLutAxis { [[nodiscard]] float lowEdge(int bin) const; /// Upper edge in the variable's natural units [[nodiscard]] float upEdge(int bin) const; + /// Number of bins in the axis + [[nodiscard]] int getNbins() const { return nbins; } ClassDefNV(SecondaryLutAxis, 1); }; From b1ba427b8f39ce16139fdf186328542b63fafd3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 25 Nov 2026 07:34:49 +0100 Subject: [PATCH 4/4] Update setEntry to use bin indices for offset calculation --- ALICE3/Core/FlatLutEntry.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ALICE3/Core/FlatLutEntry.cxx b/ALICE3/Core/FlatLutEntry.cxx index 791860c3df1..fae711f6b8e 100644 --- a/ALICE3/Core/FlatLutEntry.cxx +++ b/ALICE3/Core/FlatLutEntry.cxx @@ -151,8 +151,11 @@ lutEntry_t* FlatLutData::getEntry(int nch_bin, int rad_bin, int eta_bin, int pt_ void FlatLutData::setEntry(int rad_bin, const lutEntry_t& entry) { + const int nch_bin = getHeaderRef().nchmap.find(entry.nch); + const int eta_bin = getHeaderRef().etamap.find(entry.eta); + const int pt_bin = getHeaderRef().ptmap.find(entry.pt); // Calculate the linear index based on the entry's bin indices - const size_t offset = getEntryOffset(entry.nch, rad_bin, entry.eta, entry.pt); + const size_t offset = getEntryOffset(nch_bin, rad_bin, eta_bin, pt_bin); std::memcpy(mData.data() + offset, &entry, sizeof(lutEntry_t)); }