@@ -79,18 +79,24 @@ class TPCFastSpaceChargeCorrection : public FlatObject
7979 }
8080
8181 // / convert local y, z to internal grid coordinates u,v, and spline scale
82- GPUdi () void convLocalToGridUntruncated (float y, float z, float & u, float & v, float & s) const
82+ GPUdi () void convLocalToGridUntruncated (int sector, float y, float z, float & u, float & v, float & s) const
8383 {
84+ if (sector >= TPCFastTransformGeo::getNumberOfSectorsA ()) {
85+ z = -z;
86+ }
8487 u = (y - y0) * yScale;
8588 v = (z - z0) * zScale;
8689 s = getSpineScaleForZ (z);
8790 }
8891
8992 // / convert internal grid coordinates u,v to local y, z
90- GPUdi () void convGridToLocal (float gridU, float gridV, float & y, float & z) const
93+ GPUdi () void convGridToLocal (int sector, float gridU, float gridV, float & y, float & z) const
9194 {
9295 y = y0 + gridU / yScale;
9396 z = z0 + gridV / zScale;
97+ if (sector >= TPCFastTransformGeo::getNumberOfSectorsA ()) {
98+ z = -z;
99+ }
94100 }
95101 ClassDefNV (GridInfo, 1 );
96102 };
@@ -395,7 +401,7 @@ GPUdi() void TPCFastSpaceChargeCorrection::convLocalToGrid(int32_t sector, int32
395401 // / convert local y, z to internal grid coordinates u,v
396402 // / return values: u, v, scaling factor
397403 const SplineType& spline = getSpline (sector, row);
398- getSectorRowInfo (sector, row).gridMeasured .convLocalToGridUntruncated (y, z, u, v, s);
404+ getSectorRowInfo (sector, row).gridMeasured .convLocalToGridUntruncated (sector, y, z, u, v, s);
399405 // shrink to the grid
400406 u = GPUCommonMath::Clamp (u, 0 .f , (float )spline.getGridX1 ().getUmax ());
401407 v = GPUCommonMath::Clamp (v, 0 .f , (float )spline.getGridX2 ().getUmax ());
@@ -405,7 +411,7 @@ GPUdi() bool TPCFastSpaceChargeCorrection::isLocalInsideGrid(int32_t sector, int
405411{
406412 // / check if local y, z are inside the grid
407413 float u, v, s;
408- getSectorRowInfo (sector, row).gridMeasured .convLocalToGridUntruncated (y, z, u, v, s);
414+ getSectorRowInfo (sector, row).gridMeasured .convLocalToGridUntruncated (sector, y, z, u, v, s);
409415 const auto & spline = getSpline (sector, row);
410416 // shrink to the grid
411417 if (u < 0 .f || u > (float )spline.getGridX1 ().getUmax () || //
@@ -419,7 +425,7 @@ GPUdi() bool TPCFastSpaceChargeCorrection::isRealLocalInsideGrid(int32_t sector,
419425{
420426 // / check if local y, z are inside the grid
421427 float u, v, s;
422- getSectorRowInfo (sector, row).gridReal .convLocalToGridUntruncated (y, z, u, v, s);
428+ getSectorRowInfo (sector, row).gridReal .convLocalToGridUntruncated (sector, y, z, u, v, s);
423429 const auto & spline = getSpline (sector, row);
424430 // shrink to the grid
425431 if (u < 0 .f || u > (float )spline.getGridX1 ().getUmax () || //
@@ -432,14 +438,14 @@ GPUdi() bool TPCFastSpaceChargeCorrection::isRealLocalInsideGrid(int32_t sector,
432438GPUdi () void TPCFastSpaceChargeCorrection::convGridToLocal(int32_t sector, int32_t row, float gridU, float gridV, float & y, float & z) const
433439{
434440 // / convert internal grid coordinates u,v to local y, z
435- getSectorRowInfo (sector, row).gridMeasured .convGridToLocal (gridU, gridV, y, z);
441+ getSectorRowInfo (sector, row).gridMeasured .convGridToLocal (sector, gridU, gridV, y, z);
436442}
437443
438444GPUdi () void TPCFastSpaceChargeCorrection::convRealLocalToGrid(int32_t sector, int32_t row, float y, float z, float & u, float & v, float & s) const
439445{
440446 // / convert real y, z to the internal grid coordinates + scale
441447 const SplineType& spline = getSpline (sector, row);
442- getSectorRowInfo (sector, row).gridReal .convLocalToGridUntruncated (y, z, u, v, s);
448+ getSectorRowInfo (sector, row).gridReal .convLocalToGridUntruncated (sector, y, z, u, v, s);
443449 // shrink to the grid
444450 u = GPUCommonMath::Clamp (u, 0 .f , (float )spline.getGridX1 ().getUmax ());
445451 v = GPUCommonMath::Clamp (v, 0 .f , (float )spline.getGridX2 ().getUmax ());
@@ -448,7 +454,7 @@ GPUdi() void TPCFastSpaceChargeCorrection::convRealLocalToGrid(int32_t sector, i
448454GPUdi () void TPCFastSpaceChargeCorrection::convGridToRealLocal(int32_t sector, int32_t row, float gridU, float gridV, float & y, float & z) const
449455{
450456 // / convert internal grid coordinates u,v to the real y, z
451- getSectorRowInfo (sector, row).gridReal .convGridToLocal (gridU, gridV, y, z);
457+ getSectorRowInfo (sector, row).gridReal .convGridToLocal (sector, gridU, gridV, y, z);
452458}
453459
454460GPUdi () void TPCFastSpaceChargeCorrection::getCorrectionLocal(int32_t sector, int32_t row, float y, float z, float & dx, float & dy, float & dz) const
0 commit comments