@@ -381,7 +381,9 @@ void TPCFastSpaceChargeCorrectionHelper::testGeometry(const TPCFastTransformGeo&
381381}
382382
383383std::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
0 commit comments