Skip to content

Commit d26e34e

Browse files
committed
dev test: mirroring of the data
1 parent 56e5d47 commit d26e34e

4 files changed

Lines changed: 335 additions & 214 deletions

File tree

Detectors/TPC/calibration/include/TPCCalibration/TPCFastSpaceChargeCorrectionHelper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ class TPCFastSpaceChargeCorrectionHelper
9494
/// \note voxel trees wont be changed. They are read as non-const because of the ROOT::TTreeProcessorMT interface
9595
std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> createFromTrackResiduals(
9696
const o2::tpc::TrackResiduals& trackResiduals, TTree* voxResTree, TTree* voxResTreeInverse, //
97-
bool useSmoothed, bool invertSigns);
97+
bool useSmoothed, bool invertSigns, TPCFastSpaceChargeCorrectionMap* correctionMapDirect = nullptr,
98+
TPCFastSpaceChargeCorrectionMap* correctionMapInverse = nullptr);
9899

99100
/// _______________ Utilities ________________________
100101

Detectors/TPC/calibration/src/TPCFastSpaceChargeCorrectionHelper.cxx

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,9 @@ void TPCFastSpaceChargeCorrectionHelper::testGeometry(const TPCFastTransformGeo&
381381
}
382382

383383
std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrectionHelper::createFromTrackResiduals(
384-
const o2::tpc::TrackResiduals& trackResiduals, TTree* voxResTree, TTree* voxResTreeInverse, bool useSmoothed, bool invertSigns)
384+
const o2::tpc::TrackResiduals& trackResiduals, TTree* voxResTree, TTree* voxResTreeInverse, bool useSmoothed, bool invertSigns,
385+
TPCFastSpaceChargeCorrectionMap* correctionMapDirect,
386+
TPCFastSpaceChargeCorrectionMap* correctionMapInverse)
385387
{
386388
// create o2::gpu::TPCFastSpaceChargeCorrection from o2::tpc::TrackResiduals::VoxRes voxel tree
387389

@@ -603,6 +605,22 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
603605
processor.Process(myThread);
604606
}
605607

608+
// SG!! test: mirror the data for TPC C side
609+
610+
for (int iSector = 0; iSector < geo.getNumberOfSectorsA(); iSector++) {
611+
for (int iRow = 0; iRow < nRows; iRow++) {
612+
for (int iy = 0; iy < nY2Xbins; iy++) {
613+
for (int iz = 0; iz < nZ2Xbins; iz++) {
614+
auto& dataA = vSectorData[iSector * nRows + iRow][iy * nZ2Xbins + iz];
615+
auto& dataC = vSectorData[(iSector + geo.getNumberOfSectorsA()) * nRows + iRow][iy * nZ2Xbins + iz];
616+
dataC = dataA; // copy the data
617+
dataC.mZ = -dataC.mZ; // mirror the Z coordinate
618+
dataC.mCz = -dataC.mCz; // mirror the Z correction
619+
}
620+
}
621+
}
622+
}
623+
606624
for (int iSector = 0; iSector < nSectors; iSector++) {
607625

608626
// now process the data row-by-row
@@ -642,13 +660,23 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
642660
if (data.mNentries > 0) { // voxel contains data
643661
vox.mSmoothingStep = 0; // take original data
644662
isDataFound = true;
645-
if (fabs(x - data.mX) > 1. || fabs(vox.mY - data.mY) > 5. || fabs(vox.mZ - data.mZ) > 5.) {
646-
std::cout << directionName << ": fitted voxel is too far from the nominal position: "
647-
<< " sector " << iSector << " row " << iRow
648-
<< " center x " << x << " y " << vox.mY << " z " << vox.mZ
649-
<< " fitted x " << data.mX << " y " << data.mY << " z " << data.mZ
650-
<< std::endl;
663+
if (fabs(x - data.mX) > 1. || fabs(vox.mY - data.mY) > vox.mDy / 2 || fabs(vox.mZ - data.mZ) > vox.mDz / 2) {
664+
LOG(warning) << directionName << ": fitted voxel position is outside the voxel: "
665+
<< " sector " << iSector << " row " << iRow
666+
<< " center x " << x << " y " << vox.mY << " z " << vox.mZ
667+
// << " fitted x " << data.mX << " y " << data.mY << " z " << data.mZ
668+
<< " dx " << data.mX - x << " dy " << data.mY - vox.mY
669+
<< " dz " << data.mZ - vox.mZ
670+
<< " bin size y " << vox.mDy << " bin size z " << vox.mDz;
651671
}
672+
// SG!!! test
673+
if (fabs(vox.mY - data.mY) > vox.mDy / 2.) {
674+
data.mY = vox.mY;
675+
}
676+
if (fabs(vox.mZ - data.mZ) > vox.mDz / 2.) {
677+
data.mZ = vox.mZ;
678+
}
679+
652680
} else { // no data, take voxel center position
653681
data.mCx = 0.;
654682
data.mCy = 0.;
@@ -657,8 +685,9 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
657685
data.mY = vox.mY;
658686
data.mZ = vox.mZ;
659687
vox.mSmoothingStep = 100; // fill this data point with smoothed values from the neighbours
688+
//vox.mSmoothingStep = 0; // SG!! test
660689
}
661-
if (0) { // debug: always use voxel center instead of the mean position
690+
if (0) { // SG!!! debug: always use voxel center instead of the mean position
662691
data.mY = vox.mY;
663692
data.mZ = vox.mZ;
664693
}
@@ -723,8 +752,8 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
723752
vox.mSmoothingStep = ismooth;
724753
}
725754
} // iz
726-
} // iy
727-
} // ismooth
755+
} // iy
756+
} // ismooth
728757

729758
if (nRepairs > 0) {
730759
LOG(debug) << "Sector " << iSector << " row " << iRow << ": " << nRepairs << " voxel repairs for " << nY2Xbins * nZ2Xbins << " voxels";
@@ -784,7 +813,7 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
784813
} // iy
785814

786815
} // iRow
787-
}; // myThread
816+
}; // myThread
788817

789818
// run n threads
790819

@@ -809,6 +838,13 @@ std::unique_ptr<o2::gpu::TPCFastSpaceChargeCorrection> TPCFastSpaceChargeCorrect
809838

810839
TStopwatch watch4;
811840

841+
if (!processingInverseCorrection && correctionMapDirect) {
842+
*correctionMapDirect = helper->getCorrectionMap();
843+
}
844+
if (processingInverseCorrection && correctionMapInverse) {
845+
*correctionMapInverse = helper->getCorrectionMap();
846+
}
847+
812848
helper->fillSpaceChargeCorrectionFromMap(correction, processingInverseCorrection);
813849

814850
LOG(info) << "fast space charge correction helper: creation from the data map took " << watch4.RealTime() << "s";
@@ -1076,11 +1112,11 @@ void TPCFastSpaceChargeCorrectionHelper::MergeCorrections(
10761112
}
10771113

10781114
} // iv
1079-
} // iu
1080-
} // corrections
1115+
} // iu
1116+
} // corrections
10811117

10821118
} // row
1083-
}; // thread
1119+
}; // thread
10841120

10851121
std::vector<std::thread> threads(mNthreads);
10861122

GPU/TPCFastTransformation/TPCFastTransform.cxx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,7 @@ void TPCFastTransform::startConstruction(const TPCFastSpaceChargeCorrection& cor
102102
mTimeStamp = 0;
103103
mApplyCorrection = 1;
104104
mT0 = 0.f;
105-
mVdrift = 0.f;
106-
mVdriftCorrY = 0.f;
107-
mLdriftCorr = 0.f;
108-
mTOFcorr = 0.f;
109-
mPrimVtxZ = 0.f;
105+
mVdrift = 0.f;
110106
mLumi = DEFLUMI;
111107
mLumiError = 0.f;
112108
mIDC = DEFIDC;

0 commit comments

Comments
 (0)