Skip to content

Commit a3fa1a9

Browse files
cbmswdavidrohr
authored andcommitted
TPCFastTransform: test macro: add test of POD version
1 parent d59e09a commit a3fa1a9

1 file changed

Lines changed: 41 additions & 2 deletions

File tree

GPU/TPCFastTransformation/macro/TPCFastTransformInit.C

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ void TPCFastTransformInit(const char* fileName = "debugVoxRes.root", const char*
210210

211211
o2::gpu::TPCFastSpaceChargeCorrection& corr = fastTransform->getCorrection();
212212

213+
aligned_unique_buffer_ptr<TPCFastTransformPOD> podBuffer;
214+
TPCFastTransformPOD* corrPODptr = TPCFastTransformPOD::create(podBuffer, *fastTransform);
215+
216+
if (!corrPODptr) {
217+
throw std::runtime_error("Failed to create TPCFastTransformPOD");
218+
}
219+
const TPCFastTransformPOD& corrPOD = *corrPODptr;
220+
213221
// a debug file with some NTuples
214222

215223
TDirectory* currDir = gDirectory;
@@ -302,19 +310,35 @@ void TPCFastTransformInit(const char* fileName = "debugVoxRes.root", const char*
302310

303311
const o2::gpu::TPCFastTransformGeo& geo = helper->getGeometry();
304312

313+
float maxPodDiff[6] = {0., 0., 0., 0., 0., 0.};
314+
305315
auto getInvCorrections = [&](int iSector, int iRow, float realY, float realZ, float& ix, float& iy, float& iz) {
306316
// get the inverse corrections ix, iy, iz at x,y,z
307317
ix = corr.getCorrectionXatRealYZ(iSector, iRow, realY, realZ);
308318
corr.getCorrectionYZatRealYZ(iSector, iRow, realY, realZ, iy, iz);
319+
320+
float ixPod = corrPOD.getCorrectionXatRealYZ(iSector, iRow, realY, realZ);
321+
float iyPod, izPod;
322+
corrPOD.getCorrectionYZatRealYZ(iSector, iRow, realY, realZ, iyPod, izPod);
323+
324+
maxPodDiff[3] = std::max(maxPodDiff[3], fabs(ix - ixPod));
325+
maxPodDiff[4] = std::max(maxPodDiff[4], fabs(iy - iyPod));
326+
maxPodDiff[5] = std::max(maxPodDiff[5], fabs(iz - izPod));
309327
};
310328

311329
auto getAllCorrections = [&](int iSector, int iRow, float y, float z, float& cx, float& cy, float& cz, float& ix, float& iy, float& iz) {
312330
// get the corrections cx,cy,cz at x,y,z
313331
corr.getCorrectionLocal(iSector, iRow, y, z, cx, cy, cz);
314332
getInvCorrections(iSector, iRow, y + cy, z + cz, ix, iy, iz);
333+
334+
float cxPod, cyPod, czPod;
335+
corrPOD.getCorrectionLocal(iSector, iRow, y, z, cxPod, cyPod, czPod);
336+
maxPodDiff[0] = std::max(maxPodDiff[0], fabs(cx - cxPod));
337+
maxPodDiff[1] = std::max(maxPodDiff[1], fabs(cy - cyPod));
338+
maxPodDiff[2] = std::max(maxPodDiff[2], fabs(cz - czPod));
315339
};
316340

317-
for (int direction = 0; direction < 2; direction++) { // 0 - normal, 1 - inverse
341+
for (int direction = 0; direction < 2; direction++) { // 0 - direct, 1 - inverse
318342

319343
std::string directionName = (direction == 0) ? "direct" : "inverse";
320344

@@ -594,7 +618,9 @@ void TPCFastTransformInit(const char* fileName = "debugVoxRes.root", const char*
594618
for (int32_t i = 0; i < 3; i++) {
595619
sumDiff[i] = sqrt(sumDiff[i]) / nDiff;
596620
}
621+
597622
LOG(info) << directionName << " correction: max and mean differences between spline and voxel corrections:";
623+
598624
LOG(info) << "Max difference in x : " << maxDiff[0] << " at Sector "
599625
<< maxDiffSector[0] << " row " << maxDiffRow[0];
600626

@@ -605,9 +631,22 @@ void TPCFastTransformInit(const char* fileName = "debugVoxRes.root", const char*
605631
<< maxDiffSector[2] << " row " << maxDiffRow[2];
606632

607633
LOG(info) << "Mean difference in x,y,z : " << sumDiff[0] << " " << sumDiff[1]
608-
<< " " << sumDiff[2] << std::endl;
634+
<< " " << sumDiff[2];
635+
636+
LOG(info) << std::endl;
637+
609638
} // direction
610639

640+
LOG(info) << " max difference between POD and original corrections: ";
641+
LOG(info) << " x " << maxPodDiff[0];
642+
LOG(info) << " y " << maxPodDiff[1];
643+
LOG(info) << " z " << maxPodDiff[2];
644+
LOG(info) << " inverse x " << maxPodDiff[3];
645+
LOG(info) << " inverse y " << maxPodDiff[4];
646+
LOG(info) << " inverse z " << maxPodDiff[5];
647+
648+
LOG(info) << std::endl;
649+
611650
corr.testInverse(true);
612651

613652
debugFile->cd();

0 commit comments

Comments
 (0)