Skip to content

Commit e88c15f

Browse files
committed
TPC Splines: keep old cropping scheme for earlier versions of the correction map
1 parent aa14310 commit e88c15f

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

GPU/TPCFastTransformation/TPCFastSpaceChargeCorrection.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ void TPCFastSpaceChargeCorrection::cloneFromObject(const TPCFastSpaceChargeCorre
113113

114114
mClassVersion = obj.mClassVersion;
115115

116+
mIsConvertedFromVersion = obj.mIsConvertedFromVersion;
117+
116118
for (int32_t i = 0; i < TPCFastTransformGeo::getNumberOfSectors() * TPCFastTransformGeo::getMaxNumberOfRows(); i++) {
117119
mSectorRowInfos[i] = obj.mSectorRowInfos[i];
118120
}
@@ -285,8 +287,8 @@ void TPCFastSpaceChargeCorrection::setActualBufferAddress(char* actualFlatBuffer
285287
}
286288

287289
newSectorRow.resetMaxValues();
288-
newSectorRow.updateMaxValues(-50.f, -50.f, -50.f);
289-
newSectorRow.updateMaxValues(50.f, 50.f, 50.f);
290+
newSectorRow.updateMaxValues(-100.f, -100.f, -100.f);
291+
newSectorRow.updateMaxValues(100.f, 100.f, 100.f);
290292
}
291293
}
292294
}

GPU/TPCFastTransformation/TPCFastSpaceChargeCorrection.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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]};

GPU/TPCFastTransformation/TPCFastTransformationLinkDef_O2.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@
8989
#pragma read \
9090
sourceClass = "o2::gpu::TPCFastSpaceChargeCorrection" targetClass = "o2::gpu::TPCFastSpaceChargeCorrection" source = "float fInterpolationSafetyMargin" version = "[-3]" target = "" code = "{}";
9191

92+
#pragma read \
93+
sourceClass = "o2::gpu::TPCFastSpaceChargeCorrection" targetClass = "o2::gpu::TPCFastSpaceChargeCorrection" source = "" version = "[-3]" target = "mIsConvertedFromVersion" code = "{ mIsConvertedFromVersion = 3; }";
94+
9295
#pragma link C++ class o2::gpu::CorrectionMapsHelper + ;
9396
#pragma link C++ struct o2::gpu::MultivariatePolynomialContainer + ;
9497
#pragma link C++ struct o2::gpu::NDPiecewisePolynomialContainer + ;

0 commit comments

Comments
 (0)