Skip to content

Commit 73230e7

Browse files
authored
Update FlatLutEntry.cxx
1 parent d2ede72 commit 73230e7

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎ALICE3/Core/FlatLutEntry.cxx‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,18 @@ void lutEntry_t::print() const
6464

6565
float map_t::fracPositionWithinBin(float val) const
6666
{
67-
float width = (max - min) / nbins;
68-
int bin = 0;
67+
const float width = (max - min) / nbins;
68+
const int bin = find(val);
6969
if (log) {
70-
bin = static_cast<int>((std::log10(val) - min) / width);
7170
return ((std::log10(val) - min) / width) - bin;
7271
} else {
73-
bin = static_cast<int>((val - min) / width);
7472
return val / width - bin;
7573
}
7674
}
7775

7876
int map_t::find(float val) const
7977
{
80-
float width = (max - min) / nbins;
78+
const float width = (max - min) / nbins;
8179
int bin = 0;
8280
if (log) {
8381
bin = static_cast<int>((std::log10(val) - min) / width);

0 commit comments

Comments
 (0)