2121/// root -l TPCFastTransformInit.C'("debugVoxRes.root")'
2222///
2323
24+ #include "Algorithm/RangeTokenizer.h"
25+
2426#if !defined(__CLING__ ) || defined(__ROOTCLING__ )
2527
28+ #include <filesystem>
29+ #include <string>
2630#include "TFile.h"
2731#include "TSystem.h"
2832#include "TTree.h"
2933#include "TNtuple.h"
3034#include "Riostream.h"
3135
36+ #include "Algorithm/RangeTokenizer.h"
37+ #include "Framework/Logger.h"
3238#include "GPU/TPCFastTransform.h"
3339#include "SpacePoints/TrackResiduals.h"
3440#include "TPCReconstruction/TPCFastTransformHelperO2.h"
3541#include "TPCCalibration/TPCFastSpaceChargeCorrectionHelper.h"
36-
3742#endif
3843
3944using namespace o2 ::tpc ;
@@ -54,6 +59,7 @@ void TPCFastTransformInit(const char* fileName = "debugVoxRes.root",
5459 corr->Draw("cx:y:z","iRoc==0&&iRow==10","")
5560 grid->Draw("cx:y:z","iRoc==0&&iRow==10","same")
5661 vox->Draw("vx:y:z","iRoc==0&&iRow==10","same")
62+ points->Draw("px:y:z","iRoc==0&&iRow==10","same")
5763 */
5864
5965 if (gSystem -> AccessPathName (fileName )) {
@@ -75,15 +81,42 @@ void TPCFastTransformInit(const char* fileName = "debugVoxRes.root",
7581 return ;
7682 }
7783
84+ auto userInfo = voxResTree -> GetUserInfo ();
85+
86+ if (!userInfo -> FindObject ("y2xBinning" ) || !userInfo -> FindObject ("z2xBinning" )) {
87+ std ::cout << "'y2xBinning' or 'z2xBinning' not found in UserInfo, but required to get the correct binning" << std ::endl ;
88+ return ;
89+ }
90+
91+ userInfo -> Print ();
92+
93+ // required for the binning that was used
7894 o2 ::tpc ::TrackResiduals trackResiduals ;
79- trackResiduals .init (); // also initializes the default binning which was used
95+ auto y2xBins = o2 ::RangeTokenizer ::tokenize < float > (userInfo -> FindObject ("y2xBinning" )-> GetTitle ());
96+ auto z2xBins = o2 ::RangeTokenizer ::tokenize < float > (userInfo -> FindObject ("z2xBinning" )-> GetTitle ());
97+ trackResiduals .setY2XBinning (y2xBins );
98+ trackResiduals .setZ2XBinning (z2xBins );
99+ trackResiduals .init ();
100+
101+ std ::cout << "y2xBins: " << y2xBins .size () << " z2xBins: " << z2xBins .size () << std ::endl ;
80102
103+ for (auto y2x : y2xBins ) {
104+ std ::cout << "y2x: " << y2x << std ::endl ;
105+ }
106+
107+ std ::cout << std ::endl ;
108+
109+ for (auto z2x : z2xBins ) {
110+ std ::cout << "z2x: " << z2x << std ::endl ;
111+ }
81112 std ::cout << "create fast transformation ... " << std ::endl ;
82113
83114 auto* helper = o2 ::tpc ::TPCFastTransformHelperO2 ::instance ();
84115
85116 o2 ::tpc ::TPCFastSpaceChargeCorrectionHelper * corrHelper = o2 ::tpc ::TPCFastSpaceChargeCorrectionHelper ::instance ();
86117
118+ corrHelper -> setNthreadsToMaximum ();
119+
87120 auto corrPtr = corrHelper -> createFromTrackResiduals (trackResiduals , voxResTree , useSmoothed , invertSigns );
88121
89122 std ::unique_ptr < o2 ::gpu ::TPCFastTransform > fastTransform (
@@ -162,6 +195,9 @@ void TPCFastTransformInit(const char* fileName = "debugVoxRes.root",
162195 branch -> SetAddress (& v );
163196 branch -> SetAutoDelete (kTRUE );
164197
198+ int iRocLast = -1 ;
199+ int iRowLast = -1 ;
200+
165201 for (int32_t iVox = 0 ; iVox < voxResTree -> GetEntriesFast (); iVox ++ ) {
166202
167203 voxResTree -> GetEntry (iVox );
@@ -180,6 +216,9 @@ void TPCFastTransformInit(const char* fileName = "debugVoxRes.root",
180216 int32_t iRoc = (int32_t )v -> bsec ;
181217 int32_t iRow = (int32_t )xBin ;
182218
219+ iRocLast = iRoc ;
220+ iRowLast = iRow ;
221+
183222 double x = trackResiduals .getX (xBin ); // radius of the pad row
184223
185224 double y2x = trackResiduals .getY2X (
0 commit comments