Skip to content

Commit 43b96ab

Browse files
sgorbunocbmsw
authored andcommitted
TPC Splines: rename Slice -> Roc in geometry
1 parent 2fbc47d commit 43b96ab

File tree

10 files changed

+428
-427
lines changed

10 files changed

+428
-427
lines changed

Detectors/TPC/calibration/src/TPCFastSpaceChargeCorrectionHelper.cxx

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -134,25 +134,25 @@ void TPCFastSpaceChargeCorrectionHelper::fillSpaceChargeCorrectionFromMap(TPCFas
134134

135135
LOG(info) << "fast space charge correction helper: init from data points";
136136

137-
for (int slice = 0; slice < correction.getGeometry().getNumberOfSlices(); slice++) {
137+
for (int roc = 0; roc < correction.getGeometry().getNumberOfRocs(); roc++) {
138138

139139
auto myThread = [&](int iThread) {
140140
for (int row = iThread; row < correction.getGeometry().getNumberOfRows(); row += mNthreads) {
141141

142-
TPCFastSpaceChargeCorrection::SplineType& spline = correction.getSpline(slice, row);
142+
TPCFastSpaceChargeCorrection::SplineType& spline = correction.getSpline(roc, row);
143143
Spline2DHelper<float> helper;
144-
float* splineParameters = correction.getSplineData(slice, row);
145-
const std::vector<o2::gpu::TPCFastSpaceChargeCorrectionMap::CorrectionPoint>& data = mCorrectionMap.getPoints(slice, row);
144+
float* splineParameters = correction.getSplineData(roc, row);
145+
const std::vector<o2::gpu::TPCFastSpaceChargeCorrectionMap::CorrectionPoint>& data = mCorrectionMap.getPoints(roc, row);
146146
int nDataPoints = data.size();
147-
auto& info = correction.getSliceRowInfo(slice, row);
147+
auto& info = correction.getRocRowInfo(roc, row);
148148
info.resetMaxValues();
149149
if (nDataPoints >= 4) {
150150
std::vector<double> pointSU(nDataPoints);
151151
std::vector<double> pointSV(nDataPoints);
152152
std::vector<double> pointCorr(3 * nDataPoints); // 3 dimensions
153153
for (int i = 0; i < nDataPoints; ++i) {
154154
double su, sv, dx, du, dv;
155-
getSpaceChargeCorrection(correction, slice, row, data[i], su, sv, dx, du, dv);
155+
getSpaceChargeCorrection(correction, roc, row, data[i], su, sv, dx, du, dv);
156156
pointSU[i] = su;
157157
pointSV[i] = sv;
158158
pointCorr[3 * i + 0] = dx;
@@ -182,7 +182,7 @@ void TPCFastSpaceChargeCorrectionHelper::fillSpaceChargeCorrectionFromMap(TPCFas
182182
th.join();
183183
}
184184

185-
} // slice
185+
} // roc
186186

187187
watch.Stop();
188188

@@ -191,7 +191,7 @@ void TPCFastSpaceChargeCorrectionHelper::fillSpaceChargeCorrectionFromMap(TPCFas
191191
initInverse(correction, 0);
192192
}
193193

194-
void TPCFastSpaceChargeCorrectionHelper::getSpaceChargeCorrection(const TPCFastSpaceChargeCorrection& correction, int slice, int row, o2::gpu::TPCFastSpaceChargeCorrectionMap::CorrectionPoint p,
194+
void TPCFastSpaceChargeCorrectionHelper::getSpaceChargeCorrection(const TPCFastSpaceChargeCorrection& correction, int roc, int row, o2::gpu::TPCFastSpaceChargeCorrectionMap::CorrectionPoint p,
195195
double& su, double& sv, double& dx, double& du, double& dv)
196196
{
197197
// get space charge correction in internal TPCFastTransform coordinates su,sv->dx,du,dv
@@ -202,14 +202,14 @@ void TPCFastSpaceChargeCorrectionHelper::getSpaceChargeCorrection(const TPCFastS
202202

203203
// not corrected coordinates in u,v
204204
float u = 0.f, v = 0.f, fsu = 0.f, fsv = 0.f;
205-
mGeo.convLocalToUV(slice, p.mY, p.mZ, u, v);
206-
correction.convUVtoGrid(slice, row, u, v, fsu, fsv);
207-
// mGeo.convUVtoScaledUV(slice, row, u, v, fsu, fsv);
205+
mGeo.convLocalToUV(roc, p.mY, p.mZ, u, v);
206+
correction.convUVtoGrid(roc, row, u, v, fsu, fsv);
207+
// mGeo.convUVtoScaledUV(roc, row, u, v, fsu, fsv);
208208
su = fsu;
209209
sv = fsv;
210210
// corrected coordinates in u,v
211211
float u1 = 0.f, v1 = 0.f;
212-
mGeo.convLocalToUV(slice, p.mY + p.mDy, p.mZ + p.mDz, u1, v1);
212+
mGeo.convLocalToUV(roc, p.mY + p.mDy, p.mZ + p.mDz, u1, v1);
213213

214214
dx = p.mDx;
215215
du = u1 - u;
@@ -286,7 +286,7 @@ std::unique_ptr<TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrectionHelper
286286
/// set space charge correction in the local coordinates
287287
/// as a continious function
288288

289-
int nRocs = mGeo.getNumberOfSlices();
289+
int nRocs = mGeo.getNumberOfRocs();
290290
int nRows = mGeo.getNumberOfRows();
291291
mCorrectionMap.init(nRocs, nRows);
292292

@@ -337,8 +337,8 @@ void TPCFastSpaceChargeCorrectionHelper::testGeometry(const TPCFastTransformGeo&
337337
{
338338
const Mapper& mapper = Mapper::instance();
339339

340-
if (geo.getNumberOfSlices() != Sector::MAXSECTOR) {
341-
LOG(fatal) << "Wrong number of sectors :" << geo.getNumberOfSlices() << " instead of " << Sector::MAXSECTOR << std::endl;
340+
if (geo.getNumberOfRocs() != Sector::MAXSECTOR) {
341+
LOG(fatal) << "Wrong number of sectors :" << geo.getNumberOfRocs() << " instead of " << Sector::MAXSECTOR << std::endl;
342342
}
343343

344344
if (geo.getNumberOfRows() != mapper.getNumberOfRows()) {
@@ -404,7 +404,7 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
404404
const o2::gpu::TPCFastTransformGeo& geo = helper->getGeometry();
405405

406406
o2::gpu::TPCFastSpaceChargeCorrectionMap& map = helper->getCorrectionMap();
407-
map.init(geo.getNumberOfSlices(), geo.getNumberOfRows());
407+
map.init(geo.getNumberOfRocs(), geo.getNumberOfRows());
408408

409409
int nY2Xbins = trackResiduals.getNY2XBins();
410410
int nZ2Xbins = trackResiduals.getNZ2XBins();
@@ -480,7 +480,7 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
480480
// std::cout << "n knots Z: " << nKnotsZ << std::endl;
481481

482482
const int nRows = geo.getNumberOfRows();
483-
const int nROCs = geo.getNumberOfSlices();
483+
const int nROCs = geo.getNumberOfRocs();
484484

485485
{ // create the correction object
486486

@@ -501,10 +501,10 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
501501
} // .. create the correction object
502502

503503
// set the grid borders
504-
for (int iRoc = 0; iRoc < geo.getNumberOfSlices(); iRoc++) {
504+
for (int iRoc = 0; iRoc < geo.getNumberOfRocs(); iRoc++) {
505505
for (int iRow = 0; iRow < geo.getNumberOfRows(); iRow++) {
506506
const auto& rowInfo = geo.getRowInfo(iRow);
507-
auto& info = correction.getSliceRowInfo(iRoc, iRow);
507+
auto& info = correction.getRocRowInfo(iRoc, iRow);
508508
const auto& spline = correction.getSpline(iRoc, iRow);
509509
double yMin = rowInfo.x * trackResiduals.getY2X(iRow, 0);
510510
double yMax = rowInfo.x * trackResiduals.getY2X(iRow, trackResiduals.getNY2XBins() - 1);
@@ -616,7 +616,7 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
616616
vox.mZ = x * z2x;
617617
vox.mDy = x / trackResiduals.getDY2XI(xBin, iy);
618618
vox.mDz = x * trackResiduals.getDZ2X(iz);
619-
if (iRoc >= geo.getNumberOfSlicesA()) {
619+
if (iRoc >= geo.getNumberOfRocsA()) {
620620
vox.mZ = -vox.mZ;
621621
}
622622
data.mY *= x;
@@ -720,7 +720,7 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
720720

721721
// feed the row data to the helper
722722

723-
auto& info = correction.getSliceRowInfo(iRoc, iRow);
723+
auto& info = correction.getRocRowInfo(iRoc, iRow);
724724
const auto& spline = correction.getSpline(iRoc, iRow);
725725

726726
auto addEdge = [&](int iy1, int iz1, int iy2, int iz2, int nSteps) {
@@ -813,21 +813,21 @@ void TPCFastSpaceChargeCorrectionHelper::initMaxDriftLength(o2::gpu::TPCFastSpac
813813
double tpcR2min = mGeo.getRowInfo(0).x - 1.;
814814
tpcR2min = tpcR2min * tpcR2min;
815815
double tpcR2max = mGeo.getRowInfo(mGeo.getNumberOfRows() - 1).x;
816-
tpcR2max = tpcR2max / cos(2 * M_PI / mGeo.getNumberOfSlicesA() / 2) + 1.;
816+
tpcR2max = tpcR2max / cos(2 * M_PI / mGeo.getNumberOfRocsA() / 2) + 1.;
817817
tpcR2max = tpcR2max * tpcR2max;
818818

819819
ChebyshevFit1D chebFitter;
820820

821-
for (int slice = 0; slice < mGeo.getNumberOfSlices(); slice++) {
821+
for (int roc = 0; roc < mGeo.getNumberOfRocs(); roc++) {
822822
if (prn) {
823-
LOG(info) << "init MaxDriftLength for slice " << slice;
823+
LOG(info) << "init MaxDriftLength for roc " << roc;
824824
}
825-
double vLength = (slice < mGeo.getNumberOfSlicesA()) ? mGeo.getTPCzLengthA() : mGeo.getTPCzLengthC();
826-
TPCFastSpaceChargeCorrection::SliceInfo& sliceInfo = correction.getSliceInfo(slice);
827-
sliceInfo.vMax = 0.f;
825+
double vLength = (roc < mGeo.getNumberOfRocsA()) ? mGeo.getTPCzLengthA() : mGeo.getTPCzLengthC();
826+
TPCFastSpaceChargeCorrection::RocInfo& rocInfo = correction.getRocInfo(roc);
827+
rocInfo.vMax = 0.f;
828828

829829
for (int row = 0; row < mGeo.getNumberOfRows(); row++) {
830-
TPCFastSpaceChargeCorrection::RowActiveArea& area = correction.getSliceRowInfo(slice, row).activeArea;
830+
TPCFastSpaceChargeCorrection::RowActiveArea& area = correction.getRocRowInfo(roc, row).activeArea;
831831
area.cvMax = 0;
832832
area.vMax = 0;
833833
area.cuMin = mGeo.convPadToU(row, 0.f);
@@ -843,7 +843,7 @@ void TPCFastSpaceChargeCorrectionHelper::initMaxDriftLength(o2::gpu::TPCFastSpac
843843
while (v1 - v0 > 0.1) {
844844
float v = 0.5 * (v0 + v1);
845845
float dx, du, dv;
846-
correction.getCorrection(slice, row, u, v, dx, du, dv);
846+
correction.getCorrection(roc, row, u, v, dx, du, dv);
847847
double cx = x + dx;
848848
double cu = u + du;
849849
double cv = v + dv;
@@ -872,11 +872,11 @@ void TPCFastSpaceChargeCorrectionHelper::initMaxDriftLength(o2::gpu::TPCFastSpac
872872
for (int i = 0; i < 5; i++) {
873873
area.maxDriftLengthCheb[i] = chebFitter.getCoefficients()[i];
874874
}
875-
if (sliceInfo.vMax < area.vMax) {
876-
sliceInfo.vMax = area.vMax;
875+
if (rocInfo.vMax < area.vMax) {
876+
rocInfo.vMax = area.vMax;
877877
}
878878
} // row
879-
} // slice
879+
} // roc
880880
}
881881

882882
void TPCFastSpaceChargeCorrectionHelper::initInverse(o2::gpu::TPCFastSpaceChargeCorrection& correction, bool prn)
@@ -902,22 +902,22 @@ void TPCFastSpaceChargeCorrectionHelper::initInverse(std::vector<o2::gpu::TPCFas
902902
double tpcR2min = mGeo.getRowInfo(0).x - 1.;
903903
tpcR2min = tpcR2min * tpcR2min;
904904
double tpcR2max = mGeo.getRowInfo(mGeo.getNumberOfRows() - 1).x;
905-
tpcR2max = tpcR2max / cos(2 * M_PI / mGeo.getNumberOfSlicesA() / 2) + 1.;
905+
tpcR2max = tpcR2max / cos(2 * M_PI / mGeo.getNumberOfRocsA() / 2) + 1.;
906906
tpcR2max = tpcR2max * tpcR2max;
907907

908-
for (int slice = 0; slice < mGeo.getNumberOfSlices(); slice++) {
909-
// LOG(info) << "inverse transform for slice " << slice ;
908+
for (int roc = 0; roc < mGeo.getNumberOfRocs(); roc++) {
909+
// LOG(info) << "inverse transform for roc " << roc ;
910910

911911
auto myThread = [&](int iThread) {
912912
Spline2DHelper<float> helper;
913913
std::vector<float> splineParameters;
914914

915915
for (int row = iThread; row < mGeo.getNumberOfRows(); row += mNthreads) {
916-
TPCFastSpaceChargeCorrection::SplineType spline = correction.getSpline(slice, row);
916+
TPCFastSpaceChargeCorrection::SplineType spline = correction.getSpline(roc, row);
917917
helper.setSpline(spline, 10, 10);
918918

919919
double x = mGeo.getRowInfo(row).x;
920-
auto& sliceRowInfo = correction.getSliceRowInfo(slice, row);
920+
auto& rocRowInfo = correction.getRocRowInfo(roc, row);
921921

922922
std::vector<double> gridU;
923923
{
@@ -951,25 +951,25 @@ void TPCFastSpaceChargeCorrectionHelper::initInverse(std::vector<o2::gpu::TPCFas
951951
dataPointCV.reserve(gridU.size() * gridV.size());
952952
dataPointF.reserve(gridU.size() * gridV.size());
953953

954-
TPCFastSpaceChargeCorrection::RowActiveArea& area = sliceRowInfo.activeArea;
954+
TPCFastSpaceChargeCorrection::RowActiveArea& area = rocRowInfo.activeArea;
955955
area.cuMin = 1.e10;
956956
area.cuMax = -1.e10;
957957
double cvMin = 1.e10;
958958

959959
for (int iu = 0; iu < gridU.size(); iu++) {
960960
for (int iv = 0; iv < gridV.size(); iv++) {
961961
float u, v;
962-
correction.convGridToUV(slice, row, gridU[iu], gridV[iv], u, v);
962+
correction.convGridToUV(roc, row, gridU[iu], gridV[iv], u, v);
963963

964964
float dx, du, dv;
965-
correction.getCorrection(slice, row, u, v, dx, du, dv);
965+
correction.getCorrection(roc, row, u, v, dx, du, dv);
966966
dx *= scaling[0];
967967
du *= scaling[0];
968968
dv *= scaling[0];
969969
// add remaining corrections
970970
for (int i = 1; i < corrections.size(); ++i) {
971971
float dxTmp, duTmp, dvTmp;
972-
corrections[i]->getCorrection(slice, row, u, v, dxTmp, duTmp, dvTmp);
972+
corrections[i]->getCorrection(roc, row, u, v, dxTmp, duTmp, dvTmp);
973973
dx += dxTmp * scaling[i];
974974
du += duTmp * scaling[i];
975975
dv += dvTmp * scaling[i];
@@ -1002,28 +1002,28 @@ void TPCFastSpaceChargeCorrectionHelper::initInverse(std::vector<o2::gpu::TPCFas
10021002
}
10031003

10041004
if (prn) {
1005-
LOG(info) << "slice " << slice << " row " << row << " max drift L = " << correction.getMaxDriftLength(slice, row)
1005+
LOG(info) << "roc " << roc << " row " << row << " max drift L = " << correction.getMaxDriftLength(roc, row)
10061006
<< " active area: cuMin " << area.cuMin << " cuMax " << area.cuMax << " vMax " << area.vMax << " cvMax " << area.cvMax;
10071007
}
10081008

10091009
// define the grid for the inverse correction
10101010

1011-
sliceRowInfo.gridCorrU0 = area.cuMin;
1012-
sliceRowInfo.gridCorrV0 = cvMin;
1013-
sliceRowInfo.scaleCorrUtoGrid = spline.getGridX1().getUmax() / (area.cuMax - area.cuMin);
1014-
sliceRowInfo.scaleCorrVtoGrid = spline.getGridX2().getUmax() / area.cvMax;
1011+
rocRowInfo.gridCorrU0 = area.cuMin;
1012+
rocRowInfo.gridCorrV0 = cvMin;
1013+
rocRowInfo.scaleCorrUtoGrid = spline.getGridX1().getUmax() / (area.cuMax - area.cuMin);
1014+
rocRowInfo.scaleCorrVtoGrid = spline.getGridX2().getUmax() / area.cvMax;
10151015

10161016
/*
1017-
sliceRowInfo.gridCorrU0 = sliceRowInfo.gridU0;
1018-
sliceRowInfo.gridCorrV0 = sliceRowInfo.gridV0;
1019-
sliceRowInfo.scaleCorrUtoGrid = sliceRowInfo.scaleUtoGrid;
1020-
sliceRowInfo.scaleCorrVtoGrid = sliceRowInfo.scaleVtoGrid;
1017+
rocRowInfo.gridCorrU0 = rocRowInfo.gridU0;
1018+
rocRowInfo.gridCorrV0 = rocRowInfo.gridV0;
1019+
rocRowInfo.scaleCorrUtoGrid = rocRowInfo.scaleUtoGrid;
1020+
rocRowInfo.scaleCorrVtoGrid = rocRowInfo.scaleVtoGrid;
10211021
*/
10221022

10231023
int nDataPoints = dataPointCU.size();
10241024
for (int i = 0; i < nDataPoints; i++) {
1025-
dataPointCU[i] = (dataPointCU[i] - sliceRowInfo.gridCorrU0) * sliceRowInfo.scaleCorrUtoGrid;
1026-
dataPointCV[i] = (dataPointCV[i] - sliceRowInfo.gridCorrV0) * sliceRowInfo.scaleCorrVtoGrid;
1025+
dataPointCU[i] = (dataPointCU[i] - rocRowInfo.gridCorrU0) * rocRowInfo.scaleCorrUtoGrid;
1026+
dataPointCV[i] = (dataPointCV[i] - rocRowInfo.gridCorrV0) * rocRowInfo.scaleCorrVtoGrid;
10271027
}
10281028

10291029
splineParameters.resize(spline.getNumberOfParameters());
@@ -1033,8 +1033,8 @@ void TPCFastSpaceChargeCorrectionHelper::initInverse(std::vector<o2::gpu::TPCFas
10331033
dataPointCU.data(), dataPointCV.data(),
10341034
dataPointF.data(), dataPointCU.size());
10351035

1036-
float* splineX = correction.getSplineData(slice, row, 1);
1037-
float* splineUV = correction.getSplineData(slice, row, 2);
1036+
float* splineX = correction.getSplineData(roc, row, 1);
1037+
float* splineUV = correction.getSplineData(roc, row, 2);
10381038
for (int i = 0; i < spline.getNumberOfParameters() / 3; i++) {
10391039
splineX[i] = splineParameters[3 * i + 0];
10401040
splineUV[2 * i + 0] = splineParameters[3 * i + 1];
@@ -1055,7 +1055,7 @@ void TPCFastSpaceChargeCorrectionHelper::initInverse(std::vector<o2::gpu::TPCFas
10551055
th.join();
10561056
}
10571057

1058-
} // slice
1058+
} // roc
10591059
float duration = watch.RealTime();
10601060
LOGP(info, "Inverse tooks: {}s", duration);
10611061
}

Detectors/TPC/reconstruction/src/TPCFastTransformHelperO2.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ void TPCFastTransformHelperO2::testGeometry(const TPCFastTransformGeo& geo) cons
192192
{
193193
const Mapper& mapper = Mapper::instance();
194194

195-
if (geo.getNumberOfSlices() != Sector::MAXSECTOR) {
196-
LOG(fatal) << "Wrong number of sectors :" << geo.getNumberOfSlices() << " instead of " << Sector::MAXSECTOR << std::endl;
195+
if (geo.getNumberOfRocs() != Sector::MAXSECTOR) {
196+
LOG(fatal) << "Wrong number of sectors :" << geo.getNumberOfRocs() << " instead of " << Sector::MAXSECTOR << std::endl;
197197
}
198198

199199
if (geo.getNumberOfRows() != mapper.getNumberOfRows()) {

0 commit comments

Comments
 (0)