@@ -338,6 +338,9 @@ class TPCFastSpaceChargeCorrection : public FlatObject
338338 // / The actual version must be set in startConstruction().
339339 int32_t mClassVersion {3 };
340340
341+ // / @brief Version from which the object was converted
342+ int32_t mIsConvertedFromVersion {-1 }; // /< version from which the object was converted
343+
341344 SectorRowInfo mSectorRowInfos [TPCFastTransformGeo::getNumberOfSectors() * TPCFastTransformGeo::getMaxNumberOfRows ()]; // /< SectorRowInfo array
342345
343346 ClassDefNV (TPCFastSpaceChargeCorrection, 4 );
@@ -491,9 +494,16 @@ GPUdi() std::array<float, 3> TPCFastSpaceChargeCorrection::getCorrectionLocal(in
491494 float dxyz[3 ];
492495 spline.interpolateAtU (splineData, val[0 ], val[1 ], dxyz);
493496
497+ if (mIsConvertedFromVersion == 3 ) { // different cropping strategy in version 3
498+ if (CAMath::Abs (dxyz[0 ]) > 100 .f || CAMath::Abs (dxyz[1 ]) > 100 .f || CAMath::Abs (dxyz[2 ]) > 100 .f ) {
499+ val[2 ] = 0 .f ;
500+ }
501+ }
502+
494503 float dx = val[2 ] * GPUCommonMath::Clamp (dxyz[0 ], info.minCorr [0 ], info.maxCorr [0 ]);
495504 float dy = val[2 ] * GPUCommonMath::Clamp (dxyz[1 ], info.minCorr [1 ], info.maxCorr [1 ]);
496505 float dz = val[2 ] * GPUCommonMath::Clamp (dxyz[2 ], info.minCorr [2 ], info.maxCorr [2 ]);
506+
497507 return {dx, dy, dz};
498508}
499509
@@ -503,6 +513,11 @@ GPUdi() float TPCFastSpaceChargeCorrection::getCorrectionXatRealYZ(int32_t secto
503513 auto val = convRealLocalToGrid (sector, row, realY, realZ);
504514 float dx = 0 ;
505515 getSplineInvX (sector, row).interpolateAtU (getCorrectionDataInvX (sector, row), val[0 ], val[1 ], &dx);
516+ if (mIsConvertedFromVersion == 3 ) { // different cropping strategy in version 3
517+ if (CAMath::Abs (dx) > 100 .f ) {
518+ val[2 ] = 0 .f ;
519+ }
520+ }
506521 dx = val[2 ] * GPUCommonMath::Clamp (dx, info.minCorr [0 ], info.maxCorr [0 ]);
507522 return dx;
508523}
@@ -513,6 +528,11 @@ GPUdi() std::array<float, 2> TPCFastSpaceChargeCorrection::getCorrectionYZatReal
513528 const auto & info = getSectorRowInfo (sector, row);
514529 float dyz[2 ];
515530 getSplineInvYZ (sector, row).interpolateAtU (getCorrectionDataInvYZ (sector, row), val[0 ], val[1 ], dyz);
531+ if (mIsConvertedFromVersion == 3 ) { // different cropping strategy in version 3
532+ if (CAMath::Abs (dyz[0 ]) > 100 .f || CAMath::Abs (dyz[1 ]) > 100 .f ) {
533+ val[2 ] = 0 .f ;
534+ }
535+ }
516536 dyz[0 ] = val[2 ] * GPUCommonMath::Clamp (dyz[0 ], info.minCorr [1 ], info.maxCorr [1 ]);
517537 dyz[1 ] = val[2 ] * GPUCommonMath::Clamp (dyz[1 ], info.minCorr [2 ], info.maxCorr [2 ]);
518538 return {dyz[0 ], dyz[1 ]};
0 commit comments