Skip to content

Commit 059b341

Browse files
authored
Implement getEntryIndex method in FlatLutEntry
Add method to compute linear index for LUT entries
1 parent 8af3dbf commit 059b341

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

ALICE3/Core/FlatLutEntry.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ class FlatLutData
104104
*/
105105
void initialize(const lutHeader_t& header);
106106

107+
size_t getEntryIndex(int nch_bin, int rad_bin, int eta_bin, int pt_bin) const
108+
{
109+
// Linear index: nch varies slowest, pt varies fastest
110+
// idx = nch * (rad*eta*pt) + rad * (eta*pt) + eta * pt + pt
111+
return static_cast<size_t>(nch_bin) * (mRadBins * mEtaBins * mPtBins) + static_cast<size_t>(rad_bin) * (mEtaBins * mPtBins) + static_cast<size_t>(eta_bin) * mPtBins + static_cast<size_t>(pt_bin);
112+
}
113+
107114
/**
108115
* @brief Get LUT entry by bin indices (view)
109116
*/

0 commit comments

Comments
 (0)