]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCExBEffective.cxx
compiler warnings (Jochen)
[u/mrichter/AliRoot.git] / TPC / AliTPCExBEffective.cxx
index 5209fc743ea5a8cdc822ed0c102b6da551ce89e6..13b217bb0016354ffa4caaa959e926f910d1e81d 100644 (file)
 //
 // Motivation:
 //   ExB correction: 
-//      dx =  c0* integral(Ex/Ez) + c1* integral(Ey/Ex)
-//      dy = -c1* integral(Ex/Ez) + c0* integral(Ex/Ex)
+//      dr    =  c0* integral(Er/Ez) + c1* integral(Erphi/Ez)
+//      drphi = -c1* integral(Er/Ez) + c0* integral(Erphi/Ez)
 //   Where:      
 //   wt = Bz*(k*vdrift/E)           ~ 0.3 at B=0.5 T 
 //   c0 = 1/(1+T2*T2*wt*wt) 
 //   c1 = T1*wt/(1+T1*T1*wt*wt)
 //   
-// Residual integral(Ex/Ez,Ey/Ez) obtained comparing the B field 0 and B field +-0.5 T setting
+// Residual integral(Er/Ez,Erphi/Ez) obtained comparing the B field 0 and B field +-0.5 T setting
 // minimizing track matching residuals 
-// delta(Ex/Ez) ~ sum[ poln(r) * polm(z) * cos(n,phi)] 
+// delta(Er/Ez) ~ sum[ poln(r) * polm(z) * cos(n,phi)] 
 //  
 ////////////////////////////////////////////////////////////////////////////
 #include "AliMagF.h"
@@ -118,19 +118,25 @@ void AliTPCExBEffective::GetCorrection(const Float_t x[],const Short_t roc,Float
   Double_t driftN   = 1.-TMath::Abs(x[2])/calROC->GetZLength(0);  // drift from 0 to 1
   Double_t localxN  = 2*(r-rmiddle)/(kRTPC1-kRTPC0);         // normalize local x position
   //
-  Double_t exez = 0;
-  Double_t eyez = 0;
-  if (roc%36<18)  exez= GetSum(*fPolynomA, *fPolynomValA, localxN, driftN, phi,0);
-  if (roc%36>=18) exez= GetSum(*fPolynomC, *fPolynomValC, localxN, driftN, phi,0);
-  if (roc%36<18)  eyez= GetSum(*fPolynomA, *fPolynomValA, localxN, driftN, phi,1);
-  if (roc%36>=18) eyez= GetSum(*fPolynomC, *fPolynomValC, localxN, driftN, phi,1);
+  Double_t erez = 0;
+  Double_t erphiez = 0;
+  if (roc%36<18)  erez= GetSum(*fPolynomA, *fPolynomValA, localxN, driftN, phi,0);
+  if (roc%36>=18) erez= GetSum(*fPolynomC, *fPolynomValC, localxN, driftN, phi,0);
+  if (roc%36<18)  erphiez= GetSum(*fPolynomA, *fPolynomValA, localxN, driftN, phi,1);
+  if (roc%36>=18) erphiez= GetSum(*fPolynomC, *fPolynomValC, localxN, driftN, phi,1);
 
-  Double_t drphi =  -fC1 * exez;
-  Double_t dr    =  fC1  * eyez;
-  //
-  dx[0]= TMath::Cos(phi)*dr-TMath::Sin(phi)*drphi;
-  dx[1]= TMath::Sin(phi)*dr+TMath::Cos(phi)*drphi;
-  dx[2]= 0;
+  Double_t dr    =   fC0 * erez + fC1 * erphiez;
+  Double_t drphi =  -fC1 * erez + fC0 * erphiez;
+  
+  // 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();
+  }    
+}