@@ -36,6 +36,8 @@ class GPUdEdx
3636 GPUd () void fillSubThreshold (int32_t padRow);
3737 GPUd () void computedEdx (GPUdEdxInfo& output, const GPUParam& param);
3838
39+ static constexpr size_t MAX_NCL = GPUCA_ROW_COUNT;
40+
3941 private:
4042 GPUd () float GetSortTruncMean (GPUCA_PAR_DEDX_STORAGE_TYPE_A* array, int32_t count, int32_t trunclow, int32_t trunchigh);
4143 GPUd () void checkSubThresh (int32_t roc);
@@ -60,8 +62,6 @@ class GPUdEdx
6062 };
6163#endif
6264
63- static constexpr int32_t MAX_NCL = GPUCA_ROW_COUNT; // Must fit in mNClsROC (uint8_t)!
64-
6565 GPUCA_PAR_DEDX_STORAGE_TYPE_A mChargeTot [MAX_NCL]; // No need for default, just some memory
6666 GPUCA_PAR_DEDX_STORAGE_TYPE_A mChargeMax [MAX_NCL]; // No need for default, just some memory
6767 float mSubThreshMinTot = 0 .f;
@@ -76,7 +76,7 @@ class GPUdEdx
7676GPUdi () void GPUdEdx::checkSubThresh (int32_t roc)
7777{
7878 if (roc != mLastROC ) {
79- if (mNSubThresh && mCount + mNSubThresh <= MAX_NCL) {
79+ if (mNSubThresh && mCount + mNSubThresh < MAX_NCL) {
8080 for (int32_t i = 0 ; i < mNSubThresh ; i++) {
8181 mChargeTot [mCount ] = (GPUCA_PAR_DEDX_STORAGE_TYPE_A)(mSubThreshMinTot * scalingFactor<GPUCA_PAR_DEDX_STORAGE_TYPE_A>::factor + scalingFactor<GPUCA_PAR_DEDX_STORAGE_TYPE_A>::round);
8282 mChargeMax [mCount ++] = (GPUCA_PAR_DEDX_STORAGE_TYPE_A)(mSubThreshMinMax * scalingFactor<GPUCA_PAR_DEDX_STORAGE_TYPE_A>::factor + scalingFactor<GPUCA_PAR_DEDX_STORAGE_TYPE_A>::round);
@@ -94,16 +94,15 @@ GPUdi() void GPUdEdx::checkSubThresh(int32_t roc)
9494
9595GPUdnii () void GPUdEdx::fillCluster (float qtot, float qmax, int32_t padRow, uint8_t sector, float trackSnp, float trackTgl, const GPUCalibObjectsConst& calib, float z, float pad, float relTime)
9696{
97- if (mCount >= MAX_NCL) {
98- return ;
99- }
100-
10197 // container containing all the dE/dx corrections
10298 auto calibContainer = calib.dEdxCalibContainer ;
10399 constexpr GPUTPCGeometry geo;
104100
105101 const int32_t roc = geo.GetROC (padRow);
106102 checkSubThresh (roc);
103+ if (mCount >= MAX_NCL) {
104+ return ;
105+ }
107106 float snp2 = trackSnp * trackSnp;
108107 if (snp2 > GPUCA_MAX_SIN_PHI_LOW) {
109108 snp2 = GPUCA_MAX_SIN_PHI_LOW;
0 commit comments