16#ifndef ALICEO2_ITSMFT_TRACKING_INDEXTABLEUTILS_H_
17#define ALICEO2_ITSMFT_TRACKING_INDEXTABLEUTILS_H_
53 float rowMin,
float rowMax,
54 gsl::span<const float> layerColMin,
55 gsl::span<const float> layerColMax)
59 mRowCoordinateSpan = rowMax - rowMin;
60 mInverseRowBinSize = (mRowCoordinateSpan > 0.f) ?
static_cast<float>(nRowBins) / mRowCoordinateSpan : 0.f;
63 const int nLayers = std::min({
static_cast<int>(layerColMin.size()),
static_cast<int>(layerColMax.size()),
MaxLayers});
64 for (
int iLayer{0}; iLayer < nLayers; ++iLayer) {
65 mLayerColMin[iLayer] = layerColMin[iLayer];
66 mLayerColMax[iLayer] = layerColMax[iLayer];
67 mInverseColBinSize[iLayer] =
static_cast<float>(nColBins) / (layerColMax[iLayer] - layerColMin[iLayer]);
72 float rowMin,
float rowMax,
73 gsl::span<const float> layerColHalfExtent)
75 std::array<float, MaxLayers> minima{};
76 std::array<float, MaxLayers> maxima{};
77 const int count = std::min(
static_cast<int>(layerColHalfExtent.size()),
MaxLayers);
78 for (
int iLayer = 0; iLayer <
count; ++iLayer) {
79 minima[iLayer] = -layerColHalfExtent[iLayer];
80 maxima[iLayer] = layerColHalfExtent[iLayer];
83 gsl::span<const float>{minima.data(),
static_cast<size_t>(
count)},
84 gsl::span<const float>{maxima.data(),
static_cast<size_t>(
count)});
99 return rowCoordinate * mInverseRowBinSize;
104 return o2::gpu::GPUCommonMath::Min(rowIndex * mNcolBins + colIndex, (mNcolBins * mNrowBins) - 1);
118 GPUhdi() int getNcolBins()
const {
return mNcolBins; }
119 GPUhdi() int getNrowBins()
const {
return mNrowBins; }
120 GPUhdi() float getLayerColHalfExtent(
int i)
const {
return 0.5f * (mLayerColMax[
i] - mLayerColMin[
i]); }
121 GPUhdi() float getLayerColMin(
int i)
const {
return mLayerColMin[
i]; }
122 GPUhdi() float getLayerColMax(
int i)
const {
return mLayerColMax[
i]; }
129 GPUhdi() float getRowOrigin()
const {
return mRowOrigin; }
130 GPUhdi() float getRowCoordinateSpan()
const {
return mRowCoordinateSpan; }
135 float mInverseRowBinSize = 0.f;
136 float mRowOrigin = 0.f;
137 float mRowCoordinateSpan = o2::constants::math::TwoPI;
139 std::array<float, MaxLayers> mLayerColMin{};
140 std::array<float, MaxLayers> mLayerColMax{};
141 std::array<float, MaxLayers> mInverseColBinSize{};
146 printf(
"NcolBins: %d, NrowBins: %d, InverseRowBinSize: %f\n", mNcolBins, mNrowBins, mInverseRowBinSize);
147 for (
int iLayer{0}; iLayer <
MaxLayers; ++iLayer) {
148 printf(
"Layer %d: ColRange: [%f, %f], InverseColBinSize: %f\n", iLayer, mLayerColMin[iLayer], mLayerColMax[iLayer], mInverseColBinSize[iLayer]);
166 return int4{-1, -1, -1, -1};
Shared CA tracking configuration for ITS and MFT.
const int const int minColBinIndex
GPUhdi() float getLayerColMax(int i) const
GPUhdi() float getInverseColCoordinate(const int layerIndex) const
static constexpr int MaxLayers
GPUhdi() float getLayerColMin(int i) const
void setIndexTableParams(IndexTableCoordType coordType, int nRowBins, int nColBins, float rowMin, float rowMax, gsl::span< const float > layerColHalfExtent)
GPUhdi() void setNrowBins(const int rowBins)
GPUhdi() float getRowOrigin() const
GPUhdi() int getNrowBins() const
GPUhdi() IndexTableCoordType getCoordType() const
void setIndexTableParams(IndexTableCoordType coordType, int nRowBins, int nColBins, float rowMin, float rowMax, gsl::span< const float > layerColMin, gsl::span< const float > layerColMax)
GPUhdi() float getRowCoordinateSpan() const
GPUhdi() float getLayerColHalfExtent(int i) const
GPUhdi() int countRowSelectedBins(const int *indexTable
GPUhdi() int getNcolBins() const
const float colCoordinate const
GPUhdi() void setNcolBins(const int colBins)
GPUhdi() int getRowBinIndex(const float rowCoordinate) const
return indexTable[maxBinIndex] indexTable[firstBinIndex]
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLsizei const GLubyte GLsizei GLenum coordType
constexpr uint32_t MaxLayoutSurfaces
const int float float maxDeltaCol
const int float float float maxDeltaRow
GPUhdi() int4 getBinsPhiColumn(float phi
Common utility functions.