]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCExBEffective.cxx
Fix Coverity reports
[u/mrichter/AliRoot.git] / TPC / AliTPCExBEffective.cxx
index 016cdbe54254ef4b8eb312dfa6646052b7f5e3f7..13b217bb0016354ffa4caaa959e926f910d1e81d 100644 (file)
@@ -127,10 +127,16 @@ void AliTPCExBEffective::GetCorrection(const Float_t x[],const Short_t roc,Float
 
   Double_t dr    =   fC0 * erez + fC1 * erphiez;
   Double_t drphi =  -fC1 * erez + fC0 * erphiez;
-  //
-  dx[0]= TMath::Cos(phi)*dr-TMath::Sin(phi)*drphi;
-  dx[1]= TMath::Sin(phi)*dr+TMath::Cos(phi)*drphi;
-  dx[2]= 0;
+  
+  // Calculate distorted position
+  if ( r > 0.0 ) {
+    r   =  r   + dr;
+    phi =  phi + drphi/r;
+  }
+  // Calculate correction in cartesian coordinates
+  dx[0] = r * TMath::Cos(phi) - x[0];
+  dx[1] = r * TMath::Sin(phi) - x[1];
+  dx[2] = 0.; // z distortion not implemented (1st order distortions)
 
 }
 
@@ -138,7 +144,7 @@ void AliTPCExBEffective::GetCorrection(const Float_t x[],const Short_t roc,Float
 
 Double_t AliTPCExBEffective::GetSum(const TMatrixD& mpol, const TMatrixD&mcoef, Double_t r, Double_t drift, Double_t phi, Int_t coord) const {
   //
-  //
+  // Summation of the polynomials
   //
   Int_t npols=mpol.GetNrows();
   Double_t sum=0;
@@ -176,3 +182,24 @@ void AliTPCExBEffective::SetCoeficients(const TMatrixD *valA,const TMatrixD *val
   fPolynomValC = new TMatrixD(*valC);
 }
 
+
+
+
+void AliTPCExBEffective::Print(const Option_t* option) const {
+  //
+  // Print function to check the settings (e.g. the twist in the X direction)
+  // option=="a" prints the C0 and C1 coefficents for calibration purposes
+  //
+
+  TString opt = option; opt.ToLower();
+  printf("%s\t%s\n",GetName(),GetTitle());
+  
+  if (opt.Contains("a")) { // Print all details
+    printf(" - T1: %1.4f, T2: %1.4f \n",fT1,fT2);
+    printf(" - C0: %1.4f, C1: %1.4f \n",fC0,fC1);
+    fPolynomValA->Print();
+    fPolynomValC->Print();
+  }    
+}