@@ -354,15 +354,14 @@ void TPCFastSpaceChargeCorrectionHelper::testGeometry(const TPCFastTransformGeo&
354354 for (int pad = 0 ; pad < nPads; pad++) {
355355 const GlobalPadNumber p = mapper.globalPadNumber (PadPos (row, pad));
356356 const PadCentre& c = mapper.padCentre (p);
357- double u = geo.convPadToU (row, pad);
358-
357+ auto [y, z] = geo.convPadDriftLengthToLocal (0 , row, pad, 0 .);
359358 const double dx = x - c.X ();
360- const double dy = u - (-c.Y ()); // diferent sign convention for Y coordinate in the map
359+ const double dy = y - (-c.Y ()); // diferent sign convention for Y coordinate in the map
361360
362361 if (fabs (dx) >= 1 .e -6 || fabs (dy) >= 1 .e -5 ) {
363362 LOG (warning) << " wrong calculated pad position:"
364363 << " row " << row << " pad " << pad << " x calc " << x << " x in map " << c.X () << " dx " << (x - c.X ())
365- << " y calc " << u << " y in map " << -c.Y () << " dy " << dy << std::endl;
364+ << " y calc " << y << " y in map " << -c.Y () << " dy " << dy << std::endl;
366365 }
367366 if (fabs (maxDx) < fabs (dx)) {
368367 maxDx = dx;
@@ -499,18 +498,14 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
499498 double yMax = rowInfo.x * trackResiduals.getY2X (iRow, trackResiduals.getNY2XBins () - 1 );
500499 double zMin = rowInfo.x * trackResiduals.getZ2X (0 );
501500 double zMax = rowInfo.x * trackResiduals.getZ2X (trackResiduals.getNZ2XBins () - 1 );
502- double uMin = yMin;
503- double uMax = yMax;
504- double vMin = geo.getTPCzLength () - zMax;
505- double vMax = geo.getTPCzLength () - zMin;
506- info.gridU0 = uMin;
507- info.scaleUtoGrid = spline.getGridX1 ().getUmax () / (uMax - uMin);
508- info.gridV0 = vMin;
509- info.scaleVtoGrid = spline.getGridX2 ().getUmax () / (vMax - vMin);
510- info.gridCorrU0 = info.gridU0 ;
511- info.gridCorrV0 = info.gridV0 ;
512- info.scaleCorrUtoGrid = info.scaleUtoGrid ;
513- info.scaleCorrVtoGrid = info.scaleVtoGrid ;
501+ double lMin = geo.getTPCzLength () - zMax;
502+ double lMax = geo.getTPCzLength () - zMin;
503+ info.gridMeasured .y0 = yMin;
504+ info.gridMeasured .yScale = spline.getGridX1 ().getUmax () / (yMax - yMin);
505+ info.gridMeasured .l0 = lMin;
506+ info.gridMeasured .lScale = spline.getGridX2 ().getUmax () / (lMax - lMin);
507+
508+ info.gridReal = info.gridMeasured ;
514509
515510 // std::cout << " iSector " << iSector << " iRow " << iRow << " uMin: " << uMin << " uMax: " << uMax << " vMin: " << vMin << " vMax: " << vMax
516511 // << " grid scale u "<< info.scaleUtoGrid << " grid scale v "<< info.scaleVtoGrid<< std::endl;
@@ -593,8 +588,8 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
593588
594589 auto myThread = [&](int iThread, int nTreads) {
595590 struct Voxel {
596- float mY , mZ ; // not -distorted local coordinates
597- float mDy , mDz ; // bin size
591+ float mY , mZ ; // non -distorted local coordinates
592+ float mDy , mDz ; // voxel size
598593 int mSmoothingStep {100 }; // is the voxel data original or smoothed at this step
599594 };
600595
@@ -905,11 +900,10 @@ void TPCFastSpaceChargeCorrectionHelper::initInverse(std::vector<o2::gpu::TPCFas
905900
906901 double realY = y + dy;
907902 double realZ = z + dz;
908- float realU, realV;
909- mGeo .convLocalToUV1 (sector, realY, realZ, realU, realV);
903+ double realL = mGeo .convZtoDriftLength (sector, realZ);
910904
911- dataPointGridU.push_back (realU );
912- dataPointGridV.push_back (realV );
905+ dataPointGridU.push_back (realY );
906+ dataPointGridV.push_back (realL );
913907 dataPointF.push_back (dx);
914908 dataPointF.push_back (dy);
915909 dataPointF.push_back (dz);
@@ -920,17 +914,14 @@ void TPCFastSpaceChargeCorrectionHelper::initInverse(std::vector<o2::gpu::TPCFas
920914
921915 auto & sectorRowInfo = correction.getSectorRowInfo (sector, row);
922916
923- sectorRowInfo.gridCorrU0 = sectorRowInfo.gridU0 ;
924- sectorRowInfo.gridCorrV0 = sectorRowInfo.gridV0 ;
925- sectorRowInfo.scaleCorrUtoGrid = sectorRowInfo.scaleUtoGrid ;
926- sectorRowInfo.scaleCorrVtoGrid = sectorRowInfo.scaleVtoGrid ;
917+ sectorRowInfo.gridReal = sectorRowInfo.gridMeasured ;
927918
928919 int nDataPoints = dataPointGridU.size ();
929920
930921 // convert real Y,Z to grid U,V
931922 for (int i = 0 ; i < nDataPoints; i++) {
932- dataPointGridU[i] = (dataPointGridU[i] - sectorRowInfo.gridCorrU0 ) * sectorRowInfo.scaleCorrUtoGrid ;
933- dataPointGridV[i] = (dataPointGridV[i] - sectorRowInfo.gridCorrV0 ) * sectorRowInfo.scaleCorrVtoGrid ;
923+ dataPointGridU[i] = (dataPointGridU[i] - sectorRowInfo.gridReal . y0 ) * sectorRowInfo.gridReal . yScale ;
924+ dataPointGridV[i] = (dataPointGridV[i] - sectorRowInfo.gridReal . l0 ) * sectorRowInfo.gridReal . lScale ;
934925 }
935926
936927 splineParameters.resize (spline.getNumberOfParameters ());
@@ -1035,8 +1026,10 @@ void TPCFastSpaceChargeCorrectionHelper::MergeCorrections(
10351026 secRowInfo.updateMaxValues (linfo.getMaxValues (), scale);
10361027 secRowInfo.updateMaxValues (linfo.getMinValues (), scale);
10371028
1038- double scaleU = secRowInfo.scaleUtoGrid / linfo.scaleUtoGrid ;
1039- double scaleV = secRowInfo.scaleVtoGrid / linfo.scaleVtoGrid ;
1029+ double scaleU = secRowInfo.gridMeasured .yScale / linfo.gridMeasured .yScale ;
1030+ double scaleV = secRowInfo.gridMeasured .lScale / linfo.gridMeasured .lScale ;
1031+ double scaleRealU = secRowInfo.gridReal .yScale / linfo.gridReal .yScale ;
1032+ double scaleRealV = secRowInfo.gridReal .lScale / linfo.gridReal .lScale ;
10401033
10411034 for (int iu = 0 ; iu < gridU.getNumberOfKnots (); iu++) {
10421035 double u = gridU.getKnot (iu).u ;
@@ -1060,11 +1053,11 @@ void TPCFastSpaceChargeCorrectionHelper::MergeCorrections(
10601053 }
10611054 }
10621055
1063- auto [y, z] = mainCorrection.convGridToCorrectedLocal (sector, row, u, v);
1056+ auto [y, z] = mainCorrection.convGridToRealLocal (sector, row, u, v);
10641057 // return values: u, v, scaling factor
1065- auto [lu, lv, ls] = corr.convCorrectedLocalToGrid (sector, row, y, z);
1058+ auto [lu, lv, ls] = corr.convRealLocalToGrid (sector, row, y, z);
10661059 ls *= scale;
1067- double parscale[4 ] = {ls, ls * scaleU , ls * scaleV , ls * ls * scaleU * scaleV };
1060+ double parscale[4 ] = {ls, ls * scaleRealU , ls * scaleRealV , ls * ls * scaleRealU * scaleRealV };
10681061
10691062 { // inverse X correction
10701063 corr.getSplineInvX (sector, row).interpolateParametersAtU (corr.getSplineDataInvX (sector, row), lu, lv, P);
0 commit comments