]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCExBBShape.cxx
Fixes for CAF, etc
[u/mrichter/AliRoot.git] / TPC / AliTPCExBBShape.cxx
index 1df9c203c2beed4d991561e54d85955e73b9599b..9f95e82321c1a69fd663394e65d0a248c9078a8a 100644 (file)
  **************************************************************************/
 
 ////////////////////////////////////////////////////////////////////////////
-//                                                                        //
-// AliExBBShape class                                                     //
-// The class calculates the space point distortions due to the B field    //
-// shape imperfections using a second order technique based on integrals  //
-// over Bz (e.g. int By/Bz) obtained via the AliMagF class                //
-// The class allows "effective Omega Tau" corrections.                    //
-//                                                                        //
-// date: 27/04/2010                                                       //
-// Authors: Magnus Mager, Jim Thomas, Stefan Rossegger                    //
-//                                                                        //
-// Example usage:                                                         //
-//  AliMagF mag("mag","mag");                                             //
-//  AliTPCExBBShape exb;                                                  //
-//  exb.SetBField(&mag);             // use Bfield from AliMagF           //
-//  exb.SetOmegaTauT1T2(0.32,1.,1.); // values ideally from OCDB          //
-//  // plot dRPhi distortions ...                                         //
-//  exb.CreateHistoDRPhiinZR(0,100,100)->Draw("surf2");                   //
+// AliTPCExBBShape class                                                  //
 ////////////////////////////////////////////////////////////////////////////
 
 #include <AliMagF.h>
@@ -109,7 +93,7 @@ void AliTPCExBBShape::GetCorrection(const Float_t x[],const Short_t roc,Float_t
   }
 
   const Double_t xStart[3]={ x[0], x[1], x[2] };
-  const Double_t xEnd[3]={ x[0],  x[1],  roc%36<18?fgkTPC_Z0:-fgkTPC_Z0 };
+  const Double_t xEnd[3]={ x[0],  x[1],  roc%36<18?fgkTPCZ0:-fgkTPCZ0 };
 
   Double_t intBStart[3];
   Double_t intBEnd[3];
@@ -139,7 +123,7 @@ void AliTPCExBBShape::GetBxAndByOverBz(const Float_t x[],const Short_t roc,Float
   }
 
   const Double_t xStart[3]={ x[0], x[1], x[2] };
-  const Double_t xEnd[3]={ x[0],  x[1],  roc%36<18?fgkTPC_Z0:-fgkTPC_Z0 };
+  const Double_t xEnd[3]={ x[0],  x[1],  roc%36<18?fgkTPCZ0:-fgkTPCZ0 };
 
   Double_t intBStart[3];
   Double_t intBEnd[3];
@@ -170,3 +154,28 @@ void AliTPCExBBShape::Print(Option_t* option) const {
     printf(" - C1: %1.4f, C2: %1.4f \n",fC1,fC2);
   }    
 }
+
+Double_t AliTPCExBBShape::GetBFieldXYZ(Double_t gx, Double_t gy, Double_t gz, Int_t axisType){
+  //
+  // return B field at given x,y,z
+  // 
+  AliMagF* field = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
+  if (!field) return 0;
+  Double_t xyz[3]={gx,gy,gz};
+  Double_t bxyz[3]={0};
+  field->Field(xyz,bxyz);
+  //
+  Double_t r=TMath::Sqrt(gx*gx+gy*gy);
+  //  Double_t b=TMath::Sqrt(bxyz[0]*bxyz[0]+bxyz[1]*bxyz[1]);
+  if (axisType==0) {
+    return (xyz[0]*bxyz[1]-xyz[1]*bxyz[0])/(bxyz[2]*r);
+  }
+  if (axisType==1){
+    return (xyz[0]*bxyz[0]+xyz[1]*bxyz[1])/(bxyz[2]*r);
+  }
+  if (axisType==2) return bxyz[2];
+  if (axisType==3) return bxyz[0];
+  if (axisType==4) return bxyz[1];
+  if (axisType==5) return bxyz[2];
+  return bxyz[2];
+}