@@ -102,51 +102,6 @@ class TPCFastSpaceChargeCorrection : public FlatObject
102102 GridInfo gridMeasured; // /< grid info for measured coordinates
103103 GridInfo gridReal; // /< grid info for real coordinates
104104
105- float minCorr[3 ]{-10 .f , -10 .f , -10 .f }; // /< min correction for dX, dY, dZ
106- float maxCorr[3 ]{10 .f , 10 .f , 10 .f }; // /< max correction for dX, dY, dZ
107-
108- void resetMaxValues ()
109- {
110- minCorr[0 ] = -1 .f ;
111- maxCorr[0 ] = 1 .f ;
112- minCorr[1 ] = -1 .f ;
113- maxCorr[1 ] = 1 .f ;
114- minCorr[2 ] = -1 .f ;
115- maxCorr[2 ] = 1 .f ;
116- }
117-
118- void updateMaxValues (float dx, float du, float dv)
119- {
120- minCorr[0 ] = GPUCommonMath::Min (minCorr[0 ], dx);
121- maxCorr[0 ] = GPUCommonMath::Max (maxCorr[0 ], dx);
122-
123- minCorr[1 ] = GPUCommonMath::Min (minCorr[1 ], du);
124- maxCorr[1 ] = GPUCommonMath::Max (maxCorr[1 ], du);
125-
126- minCorr[2 ] = GPUCommonMath::Min (minCorr[2 ], dv);
127- maxCorr[2 ] = GPUCommonMath::Max (maxCorr[2 ], dv);
128- }
129-
130- #ifndef GPUCA_GPUCODE_DEVICE
131- void updateMaxValues (std::array<float , 3 > dxdudv, float scale)
132- {
133- float dx = dxdudv[0 ] * scale;
134- float du = dxdudv[1 ] * scale;
135- float dv = dxdudv[2 ] * scale;
136- updateMaxValues (dx, du, dv);
137- }
138-
139- std::array<float , 3 > getMaxValues () const
140- {
141- return {maxCorr[0 ], maxCorr[1 ], maxCorr[2 ]};
142- }
143-
144- std::array<float , 3 > getMinValues () const
145- {
146- return {minCorr[0 ], minCorr[1 ], minCorr[2 ]};
147- }
148- #endif
149-
150105 ClassDefNV (SectorRowInfo, 2 );
151106 };
152107
@@ -325,6 +280,8 @@ class TPCFastSpaceChargeCorrection : public FlatObject
325280 // / release temporary memory used during construction
326281 void releaseConstructionMemory ();
327282
283+ static constexpr float kMaxCorrection = 100 .f; // /< maximum correction value, used to protect from FPEs
284+
328285 // / _______________ Data members _______________________________________________
329286
330287 // / _______________ Construction control _______________________________________________
@@ -506,13 +463,13 @@ GPUdi() void TPCFastSpaceChargeCorrection::getCorrectionLocal(int32_t sector, in
506463 float dxyz[3 ];
507464 spline.interpolateAtU (splineData, u, v, dxyz);
508465
509- if (CAMath::Abs (dxyz[0 ]) > 100 . f || CAMath::Abs (dxyz[1 ]) > 100 . f || CAMath::Abs (dxyz[2 ]) > 100 . f ) {
466+ if (CAMath::Abs (dxyz[0 ]) > kMaxCorrection || CAMath::Abs (dxyz[1 ]) > kMaxCorrection || CAMath::Abs (dxyz[2 ]) > kMaxCorrection ) {
510467 s = 0 .f ; // TODO: DR: Protect from FPEs, fix upstream and remove once guaranteed that it is fixed
511468 }
512469
513- dx = s * GPUCommonMath::Clamp ( dxyz[0 ], info. minCorr [ 0 ], info. maxCorr [ 0 ]) ;
514- dy = s * GPUCommonMath::Clamp ( dxyz[1 ], info. minCorr [ 1 ], info. maxCorr [ 1 ]) ;
515- dz = s * GPUCommonMath::Clamp ( dxyz[2 ], info. minCorr [ 2 ], info. maxCorr [ 2 ]) ;
470+ dx = s * dxyz[0 ];
471+ dy = s * dxyz[1 ];
472+ dz = s * dxyz[2 ];
516473}
517474
518475GPUdi () float TPCFastSpaceChargeCorrection::getCorrectionXatRealYZ(int32_t sector, int32_t row, float realY, float realZ) const
@@ -522,11 +479,10 @@ GPUdi() float TPCFastSpaceChargeCorrection::getCorrectionXatRealYZ(int32_t secto
522479 convRealLocalToGrid (sector, row, realY, realZ, u, v, s);
523480 float dx = 0 ;
524481 getSplineInvX (sector, row).interpolateAtU (getCorrectionDataInvX (sector, row), u, v, &dx);
525- if (CAMath::Abs (dx) > 100 . f ) {
482+ if (CAMath::Abs (dx) > kMaxCorrection ) {
526483 s = 0 .f ; // TODO: DR: Protect from FPEs, fix upstream and remove once guaranteed that it is fixed
527484 }
528- dx = s * GPUCommonMath::Clamp (dx, info.minCorr [0 ], info.maxCorr [0 ]);
529- return dx;
485+ return s * dx;
530486}
531487
532488GPUdi () void TPCFastSpaceChargeCorrection::getCorrectionYZatRealYZ(int32_t sector, int32_t row, float realY, float realZ, float & y, float & z) const
@@ -536,11 +492,11 @@ GPUdi() void TPCFastSpaceChargeCorrection::getCorrectionYZatRealYZ(int32_t secto
536492 const auto & info = getSectorRowInfo (sector, row);
537493 float dyz[2 ];
538494 getSplineInvYZ (sector, row).interpolateAtU (getCorrectionDataInvYZ (sector, row), u, v, dyz);
539- if (CAMath::Abs (dyz[0 ]) > 100 . f || CAMath::Abs (dyz[1 ]) > 100 . f ) {
495+ if (CAMath::Abs (dyz[0 ]) > kMaxCorrection || CAMath::Abs (dyz[1 ]) > kMaxCorrection ) {
540496 s = 0 .f ; // TODO: DR: Protect from FPEs, fix upstream and remove once guaranteed that it is fixed
541497 }
542- y = s * GPUCommonMath::Clamp ( dyz[0 ], info. minCorr [ 1 ], info. maxCorr [ 1 ]) ;
543- z = s * GPUCommonMath::Clamp ( dyz[1 ], info. minCorr [ 2 ], info. maxCorr [ 2 ]) ;
498+ y = s * dyz[0 ];
499+ z = s * dyz[1 ];
544500}
545501
546502} // namespace o2::gpu
0 commit comments