+Double_t AliTPCPreprocessorOffline::EvalAtPar(Double_t phi0, Double_t snp, Double_t refX, Double_t theta, Int_t corr, Int_t ptype, Int_t nsteps){
+ //
+ // Fit the distortion along the line with the parabolic model
+ // Parameters:
+ // phi0 - phi at the entrance of the TPC
+ // snp - local inclination angle at the entrance of the TPC
+ // refX - ref X where the distortion is evanluated
+ // theta
+ //
+ static TLinearFitter fitter(3,"pol2");
+ fitter.ClearPoints();
+ if (nsteps<3) nsteps=3;
+ Double_t deltaX=(245-85)/(nsteps);
+ for (Int_t istep=0; istep<(nsteps+1); istep++){
+ //
+ Double_t localX =85.+deltaX*istep;
+ Double_t localPhi=phi0+deltaX*snp*istep;
+ Double_t sector = 9*localPhi/TMath::Pi();
+ if (sector<0) sector+=18;
+ Double_t y=AliTPCCorrection::GetCorrSector(sector,localX,theta,1,corr);
+ Double_t dlocalX=AliTPCCorrection::GetCorrSector(sector,localX,theta,0,corr);
+ Double_t x[1]={localX-dlocalX};
+ fitter.AddPoint(x,y);
+ }
+ fitter.Eval();
+ Double_t par[3];
+ par[0]=fitter.GetParameter(0);
+ par[1]=fitter.GetParameter(1);
+ par[2]=fitter.GetParameter(2);
+
+ if (ptype==0) return par[0]+par[1]*refX+par[2]*refX*refX;
+ if (ptype==2) return par[1]+2*par[2]*refX;
+ if (ptype==4) return par[2];
+ return 0;
+}
+
+
+
+
+