Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ALICE3/Core/FlatLutEntry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ lutEntry_t* FlatLutData::getEntry(int nch_bin, int rad_bin, int eta_bin, int pt_
return reinterpret_cast<lutEntry_t*>(mData.data() + offset); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
}

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(nch_bin, rad_bin, eta_bin, pt_bin);
std::memcpy(mData.data() + offset, &entry, sizeof(lutEntry_t));
}

const lutHeader_t& FlatLutData::getHeaderRef() const
{
return *reinterpret_cast<const lutHeader_t*>(mDataRef.data()); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
Expand Down
7 changes: 6 additions & 1 deletion ALICE3/Core/FlatLutEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand Down Expand Up @@ -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
*/
Expand Down
2 changes: 2 additions & 0 deletions ALICE3/Core/SecondaryLut.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
Loading