Changes for the ExB and tpc coordinate transformation (Marian, Magnus)
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Jul 2007 16:51:04 +0000 (16:51 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Jul 2007 16:51:04 +0000 (16:51 +0000)
TPC/AliTPCExB.h
TPC/AliTPCExBExact.cxx
TPC/AliTPCExBExact.h
TPC/AliTPCExBFirst.cxx
TPC/AliTPCExBFirst.h
TPC/AliTPCcalibDB.cxx
TPC/AliTPCcalibDB.h
TPC/TPCbaseLinkDef.h
TPC/libTPCbase.pkg

index e8fd263..d9cd1f3 100644 (file)
@@ -1,18 +1,19 @@
 #ifndef ALITPC_EXB
 #define ALITPC_EXB
 
-#include "AliCorrector.h"
+#include "TObject.h"
 
-class AliTPCExB:public AliCorrector {
+class AliTPCExB:public TObject {
 public:
   virtual ~AliTPCExB() {};
-  void SetDriftVelocity(Double_t driftVelocity) {
-    fDriftVelocity=driftVelocity;
-  };
-protected:
-  Double_t fDriftVelocity; // The electron drift velocity.
-  
-  ClassDef(AliTPCExB,1)
+  virtual void Correct(const Double_t *position,Double_t *corrected)=0;
+  virtual void CorrectInverse(const Double_t *position,Double_t *corrected) {
+    Correct(position,corrected);
+    for (Int_t i=0;i<3;++i)
+      corrected[i]=position[i]-(corrected[i]-position[i]);
+  }
+
+  ClassDef(AliTPCExB,0)
 };
 
 #endif
index 053ecb2..0366f2e 100644 (file)
@@ -7,13 +7,27 @@ ClassImp(AliTPCExBExact)
 const Double_t AliTPCExBExact::fgkEM=1.602176487e-19/9.10938215e-31;
 const Double_t AliTPCExBExact::fgkDriftField=40.e3;
 
+AliTPCExBExact::AliTPCExBExact()
+  : fDriftVelocity(0),
+    fkMap(0),fkField(0),fkN(0),
+    fkNX(0),fkNY(0),fkNZ(0),
+    fkXMin(-250.),fkXMax(250.),fkYMin(-250.),fkYMax(250.),
+    fkZMin(-250.),fkZMax(250.),
+    fkNLook(0),fkLook(0) {
+  //
+  // purely for I/O
+  //
+}
+
 AliTPCExBExact::AliTPCExBExact(const AliMagF *bField,
                               Double_t driftVelocity,
                               Int_t nx,Int_t ny,Int_t nz,Int_t n)
-  : fkMap(0),fkField(bField),fkN(n),
+  : fDriftVelocity(driftVelocity),
+    fkMap(0),fkField(bField),fkN(n),
     fkNX(nx),fkNY(ny),fkNZ(nz),
     fkXMin(-250.),fkXMax(250.),fkYMin(-250.),fkYMax(250.),
-    fkZMax(250.) {
+    fkZMin(-250.),fkZMax(250.),
+    fkNLook(0),fkLook(0) {
   //
   // The constructor. One has to supply a magnetic field and an (initial)
   // drift velocity. Since some kind of lookuptable is created the
@@ -21,20 +35,23 @@ AliTPCExBExact::AliTPCExBExact(const AliMagF *bField,
   // n sets the number of integration steps to be used when integrating
   // over the full drift length.
   //
-  fDriftVelocity=driftVelocity;
   CreateLookupTable();
 }
 
 AliTPCExBExact::AliTPCExBExact(const AliFieldMap *bFieldMap,
                               Double_t driftVelocity,Int_t n) 
-  : fkMap(bFieldMap),fkField(0),fkN(n) {
+  : fDriftVelocity(driftVelocity),
+    fkMap(bFieldMap),fkField(0),fkN(n), 
+    fkNX(0),fkNY(0),fkNZ(0),
+    fkXMin(-250.),fkXMax(250.),fkYMin(-250.),fkYMax(250.),
+    fkZMin(-250.),fkZMax(250.),
+    fkNLook(0),fkLook(0) {
   //
   // The constructor. One has to supply a field map and an (initial)
   // drift velocity.
   // n sets the number of integration steps to be used when integrating
   // over the full drift length.
   //
-  fDriftVelocity=driftVelocity;
 
   fkXMin=bFieldMap->Xmin()
     -TMath::Ceil( (bFieldMap->Xmin()+250.0)/bFieldMap->DelX())
@@ -64,59 +81,70 @@ AliTPCExBExact::~AliTPCExBExact() {
   //
   // destruct the poor object.
   //
-  delete[] fLook;
+  delete[] fkLook;
 }
 
-void AliTPCExBExact::Correct(const Double_t *position,Double_t *corrected) {
-  Double_t r=TMath::Sqrt(position[0]*position[0]+position[1]*position[1]);
-  if (TMath::Abs(position[2])>250.||r<90.||250.<r) {
-    for (Int_t i=0;i<3;++i) corrected[i]=position[i];
+void AliTPCExBExact::Correct(const Double_t *position, Double_t *corrected) {
+  //
+  // correct for the distortion
+  //
+  Double_t x=(position[0]-fkXMin)/(fkXMax-fkXMin)*(fkNX-1);
+  Int_t xi1=static_cast<Int_t>(x);
+  xi1=TMath::Max(TMath::Min(xi1,fkNX-2),0);
+  Int_t xi2=xi1+1;
+  Double_t dx=(x-xi1);
+  Double_t dx1=(xi2-x);
+  
+  Double_t y=(position[1]-fkYMin)/(fkYMax-fkYMin)*(fkNY-1);
+  Int_t yi1=static_cast<Int_t>(y);
+  yi1=TMath::Max(TMath::Min(yi1,fkNY-2),0);
+  Int_t yi2=yi1+1;
+  Double_t dy=(y-yi1);
+  Double_t dy1=(yi2-y);
+  
+  Double_t z=position[2]/fkZMax*(fkNZ-1);
+  Int_t side;
+  if (z>0) {
+    side=1;
   }
   else {
-    Double_t x=(position[0]-fkXMin)/(fkXMax-fkXMin)*(fkNX-1);
-    Int_t xi1=static_cast<Int_t>(x);
-    xi1=TMath::Max(TMath::Min(xi1,fkNX-2),0);
-    Int_t xi2=xi1+1;
-    Double_t dx=(x-xi1);
-    Double_t dx1=(xi2-x);
-
-    Double_t y=(position[1]-fkYMin)/(fkYMax-fkYMin)*(fkNY-1);
-    Int_t yi1=static_cast<Int_t>(y);
-    yi1=TMath::Max(TMath::Min(yi1,fkNY-2),0);
-    Int_t yi2=yi1+1;
-    Double_t dy=(y-yi1);
-    Double_t dy1=(yi2-y);
+    z=-z;
+    side=0;
+  }
+  Int_t zi1=static_cast<Int_t>(z);
+  zi1=TMath::Max(TMath::Min(zi1,fkNZ-2),0);
+  Int_t zi2=zi1+1;
+  Double_t dz=(z-zi1);
+  Double_t dz1=(zi2-z);
   
-    Double_t z=position[2]/fkZMax*(fkNZ-1);
-    Int_t side;
-    if (z>0) {
-      side=1;
-    }
-    else {
-      z=-z;
-      side=0;
-    }
-    Int_t zi1=static_cast<Int_t>(z);
-    zi1=TMath::Max(TMath::Min(zi1,fkNZ-2),0);
-    Int_t zi2=zi1+1;
-    Double_t dz=(z-zi1);
-    Double_t dz1=(zi2-z);
+  for (int i=0;i<3;++i)
+    corrected[i]
+      =fkLook[(((xi1*fkNY+yi1)*fkNZ+zi1)*2+side)*3+i]*dx1*dy1*dz1
+      +fkLook[(((xi1*fkNY+yi1)*fkNZ+zi2)*2+side)*3+i]*dx1*dy1*dz
+      +fkLook[(((xi1*fkNY+yi2)*fkNZ+zi1)*2+side)*3+i]*dx1*dy *dz1
+      +fkLook[(((xi1*fkNY+yi2)*fkNZ+zi2)*2+side)*3+i]*dx1*dy *dz
+      +fkLook[(((xi2*fkNY+yi2)*fkNZ+zi1)*2+side)*3+i]*dx *dy *dz1
+      +fkLook[(((xi2*fkNY+yi2)*fkNZ+zi2)*2+side)*3+i]*dx *dy *dz
+      +fkLook[(((xi2*fkNY+yi1)*fkNZ+zi1)*2+side)*3+i]*dx *dy1*dz1
+      +fkLook[(((xi2*fkNY+yi1)*fkNZ+zi2)*2+side)*3+i]*dx *dy1*dz ;
+  //    corrected[2]=position[2];
+}
 
-    for (int i=0;i<3;++i)
-      corrected[i]
-       =fLook[(((xi1*fkNY+yi1)*fkNZ+zi1)*2+side)*3+i]*dx1*dy1*dz1
-       +fLook[(((xi1*fkNY+yi1)*fkNZ+zi2)*2+side)*3+i]*dx1*dy1*dz
-       +fLook[(((xi1*fkNY+yi2)*fkNZ+zi1)*2+side)*3+i]*dx1*dy *dz1
-       +fLook[(((xi1*fkNY+yi2)*fkNZ+zi2)*2+side)*3+i]*dx1*dy *dz
-       +fLook[(((xi2*fkNY+yi2)*fkNZ+zi1)*2+side)*3+i]*dx *dy *dz1
-       +fLook[(((xi2*fkNY+yi2)*fkNZ+zi2)*2+side)*3+i]*dx *dy *dz
-       +fLook[(((xi2*fkNY+yi1)*fkNZ+zi1)*2+side)*3+i]*dx *dy1*dz1
-       +fLook[(((xi2*fkNY+yi1)*fkNZ+zi2)*2+side)*3+i]*dx *dy1*dz ;
-    //    corrected[2]=position[2];
-  }
+void AliTPCExBExact::TestThisBeautifulObject(const AliFieldMap *bFieldMap,
+                                            const char* fileName) {
+  fkMap=bFieldMap;
+  fkField=0;
+  TestThisBeautifulObjectGeneric(fileName);
+}
+
+void AliTPCExBExact::TestThisBeautifulObject(const AliMagF *bField,
+                                            const char* fileName) {
+  fkField=bField;
+  fkMap=0;
+  TestThisBeautifulObjectGeneric(fileName);
 }
 
-void AliTPCExBExact::TestThisBeautifulObject(const char* fileName) {
+void AliTPCExBExact::TestThisBeautifulObjectGeneric(const char* fileName) {
   //
   // well, as the name sais...
   //
@@ -166,7 +194,8 @@ void AliTPCExBExact::CreateLookupTable() {
   //
   // Helper function to fill the lookup table.
   //
-  fLook=new Double_t[fkNX*fkNY*fkNZ*2*3];
+  fkNLook=fkNX*fkNY*fkNZ*2*3;
+  fkLook=new Double_t[fkNLook];
   Double_t x[3];
   for (int i=0;i<fkNX;++i) {
     x[0]=fkXMin+(fkXMax-fkXMin)/(fkNX-1)*i;
@@ -175,9 +204,9 @@ void AliTPCExBExact::CreateLookupTable() {
       for (int k=0;k<fkNZ;++k) {
        x[2]=1.*fkZMax/(fkNZ-1)*k;
        x[2]=TMath::Max((Double_t)0.0001,x[2]); //ugly
-       CalculateDistortion(x,&fLook[(((i*fkNY+j)*fkNZ+k)*2+1)*3]);
+       CalculateDistortion(x,&fkLook[(((i*fkNY+j)*fkNZ+k)*2+1)*3]);
        x[2]=-x[2];
-       CalculateDistortion(x,&fLook[(((i*fkNY+j)*fkNZ+k)*2+0)*3]);
+       CalculateDistortion(x,&fkLook[(((i*fkNY+j)*fkNZ+k)*2+0)*3]);
       }
     }
   }
index c9a86f3..0e04c0f 100644 (file)
@@ -7,37 +7,44 @@
 
 class AliTPCExBExact:public AliTPCExB  {
 public:
+  AliTPCExBExact(); // just for the I/O stuff
   AliTPCExBExact(const AliFieldMap *bFieldMap,Double_t driftVelocity,
                 Int_t n=100);
   AliTPCExBExact(const AliMagF *bField,Double_t driftVelocity,Int_t n=100,
-                Int_t nx=100,Int_t ny=100,Int_t nz=100);
+                Int_t nx=30,Int_t ny=30,Int_t nz=100);
   virtual ~AliTPCExBExact();
   virtual void Correct(const Double_t *position,Double_t *corrected);
-  void TestThisBeautifulObject(const char* fileName);
+  void TestThisBeautifulObject(const AliFieldMap *bFieldMap,
+                              const char* fileName);
+  void TestThisBeautifulObject(const AliMagF *bField,const char* fileName);
+protected:
+  Double_t fDriftVelocity; // The electron drift velocity.
 private:
   AliTPCExBExact& operator=(const AliTPCExBExact&); // don't assign me
   AliTPCExBExact(const AliTPCExBExact&); // don't copy me
+  void TestThisBeautifulObjectGeneric(const char* fileName);
   void CreateLookupTable();
   void GetE(Double_t *E,const Double_t *x) const;
   void GetB(Double_t *B,const Double_t *x) const;
   void Motion(const Double_t *x,Double_t t,Double_t *dxdt) const;
   void CalculateDistortion(const Double_t *x,Double_t *dist) const;
   void DGLStep(Double_t *x,Double_t t,Double_t h) const;
-  const AliFieldMap *fkMap; // the magnetic field map as supplied by the user
-  const AliMagF *fkField;   // the magnetic field as supplied by the user
-  Int_t fkN;       // max number of integration steps
-  Int_t fkNX;      // field mesh points in x direction
-  Int_t fkNY;      // field mesh points in y direction
-  Int_t fkNZ;      // field mesh points in z direction
-  Double_t fkXMin; // the first grid point in x direction
-  Double_t fkXMax; // the last grid point in x direction
-  Double_t fkYMin; // the first grid point in y direction
-  Double_t fkYMax; // the last grid point in y direction
-  Double_t fkZMin; // the first grid point in z direction
-  Double_t fkZMax; // the last grid point in z direction
-  Double_t *fLook; // the great lookup table
-  static const Double_t fgkEM; // elementary charge over electron mass (C/kg)
-  static const Double_t fgkDriftField; // the TPC drift field (V/m) (modulus)
+  const AliFieldMap *fkMap; //! the magnetic field map as supplied by the user
+  const AliMagF *fkField;   //! the magnetic field as supplied by the user
+  Int_t fkN;        // max number of integration steps
+  Int_t fkNX;       // field mesh points in x direction
+  Int_t fkNY;       // field mesh points in y direction
+  Int_t fkNZ;       // field mesh points in z direction
+  Double_t fkXMin;  // the first grid point in x direction
+  Double_t fkXMax;  // the last grid point in x direction
+  Double_t fkYMin;  // the first grid point in y direction
+  Double_t fkYMax;  // the last grid point in y direction
+  Double_t fkZMin;  // the first grid point in z direction
+  Double_t fkZMax;  // the last grid point in z direction
+  Int_t fkNLook;    // size of the lookup table
+  Double_t *fkLook; //[fkNLook] the great lookup table
+  static const Double_t fgkEM; //! elementary charge over electron mass (C/kg)
+  static const Double_t fgkDriftField; //! the TPC drift field (V/m) (modulus)
 
   ClassDef(AliTPCExBExact,1)
 };
index e793246..41942fe 100644 (file)
@@ -7,28 +7,47 @@ ClassImp(AliTPCExBFirst)
 const Double_t AliTPCExBFirst::fgkEM=1.602176487e-19/9.10938215e-31;
 const Double_t AliTPCExBFirst::fgkDriftField=40.e3;
 
+AliTPCExBFirst::AliTPCExBFirst()
+  : fDriftVelocity(0),
+    fkNX(0),fkNY(0),fkNZ(0),
+    fkXMin(-250.),fkXMax(250.),fkYMin(-250.),fkYMax(250.),
+    fkZMin(-250.),fkZMax(250.),
+    fkNMean(0),
+    fkMeanBx(0),fkMeanBy(0),fkMeanBz(0.) {
+  //
+  // purely for I/O
+  //
+}
+
 AliTPCExBFirst::AliTPCExBFirst(const AliMagF *bField,
                               Double_t driftVelocity,
                               Int_t nx,Int_t ny,Int_t nz)
-  : fkNX(nx),fkNY(ny),fkNZ(nz),
+  : fDriftVelocity(driftVelocity),
+    fkNX(nx),fkNY(ny),fkNZ(nz),
     fkXMin(-250.),fkXMax(250.),fkYMin(-250.),fkYMax(250.),
-    fkZMin(-250.),fkZMax(250.) {
+    fkZMin(-250.),fkZMax(250.),
+    fkNMean(0),
+    fkMeanBx(0),fkMeanBy(0),fkMeanBz(0.) {
   //
   // The constructor. One has to supply a magnetic field and an (initial)
   // drift velocity. Since some kind of lookuptable is created the
   // number of its meshpoints can be supplied.
   //
-  fDriftVelocity=driftVelocity;
   ConstructCommon(0,bField);
 }
 
 AliTPCExBFirst::AliTPCExBFirst(const AliFieldMap *bFieldMap,
-                              Double_t driftVelocity) {
+                              Double_t driftVelocity) 
+  : fDriftVelocity(driftVelocity),
+    fkNX(0),fkNY(0),fkNZ(0),
+    fkXMin(-250.),fkXMax(250.),fkYMin(-250.),fkYMax(250.),
+    fkZMin(-250.),fkZMax(250.),
+    fkNMean(0),
+    fkMeanBx(0),fkMeanBy(0),fkMeanBz(0.) {
   //
   // The constructor. One has to supply a field map and an (initial)
   // drift velocity.
   //
-  fDriftVelocity=driftVelocity;
 
   fkXMin=bFieldMap->Xmin()
     -TMath::Ceil( (bFieldMap->Xmin()+250.0)/bFieldMap->DelX())
@@ -60,53 +79,47 @@ AliTPCExBFirst::~AliTPCExBFirst() {
   //
   // destruct the poor object.
   //
-  delete[] fMeanBx;
-  delete[] fMeanBy;
+  delete[] fkMeanBx;
+  delete[] fkMeanBy;
 }
 
 void AliTPCExBFirst::Correct(const Double_t *position,Double_t *corrected) {
   //
   // correct for the distortion
   //
-  Double_t r=TMath::Sqrt(position[0]*position[0]+position[1]*position[1]);
-  if (TMath::Abs(position[2])>250.||r<90.||250.<r) {
-    for (Int_t i=0;i<3;++i) corrected[i]=position[i];
-  }
-  else {
-    Double_t Bx,By;
-    GetMeanFields(position[0],position[1],position[2],&Bx,&By);
-    if (position[2]>0.) {
-      Double_t Bxe,Bye;
-      GetMeanFields(position[0],position[1],250.,&Bxe,&Bye);
-      if (position[2]!=250.) {
-       Bx=(500.*Bxe-(position[2]+250.)*Bx)/(250.-position[2]);
-       By=(500.*Bye-(position[2]+250.)*By)/(250.-position[2]);
-      }
-      else {
-       Bx=Bxe;
-       By=Bye;
-      }
-    }
-
-    Double_t mu=fDriftVelocity/fgkDriftField;
-    Double_t wt=mu*fMeanBz;
-
-    corrected[0]=mu*(wt*Bx-By)/(1.+wt*wt);
-    corrected[1]=mu*(wt*By+Bx)/(1.+wt*wt);
-
-    if (position[2]>0.) {
-      corrected[0]*=(250.-position[2]);
-      corrected[1]*=(250.-position[2]);
+  Double_t Bx,By;
+  GetMeanFields(position[0],position[1],position[2],&Bx,&By);
+  if (position[2]>0.) {
+    Double_t Bxe,Bye;
+    GetMeanFields(position[0],position[1],250.,&Bxe,&Bye);
+    if (position[2]!=250.) {
+      Bx=(500.*Bxe-(position[2]+250.)*Bx)/(250.-position[2]);
+      By=(500.*Bye-(position[2]+250.)*By)/(250.-position[2]);
     }
     else {
-      corrected[0]*=(-250.-position[2]);
-      corrected[1]*=(-250.-position[2]);
+      Bx=Bxe;
+      By=Bye;
     }
-
-    corrected[0]=position[0]-corrected[0];
-    corrected[1]=position[1]-corrected[1];
-    corrected[2]=position[2];
   }
+  
+  Double_t mu=fDriftVelocity/fgkDriftField;
+  Double_t wt=mu*fkMeanBz;
+  
+  corrected[0]=mu*(wt*Bx-By)/(1.+wt*wt);
+  corrected[1]=mu*(wt*By+Bx)/(1.+wt*wt);
+  
+  if (position[2]>0.) {
+    corrected[0]*=(250.-position[2]);
+    corrected[1]*=(250.-position[2]);
+  }
+  else {
+    corrected[0]*=(-250.-position[2]);
+    corrected[1]*=(-250.-position[2]);
+  }
+
+  corrected[0]=position[0]-corrected[0];
+  corrected[1]=position[1]-corrected[1];
+  corrected[2]=position[2];
 }
 
 void AliTPCExBFirst::TestThisBeautifulObject(const char* fileName) {
@@ -152,12 +165,13 @@ void AliTPCExBFirst::ConstructCommon(const AliFieldMap *bFieldMap,
   //
   // THIS IS PRIVATE! (a helper for the constructor)
   //
-  fMeanBx=new Double_t[fkNX*fkNY*fkNZ];
-  fMeanBy=new Double_t[fkNX*fkNY*fkNZ];
+  fkNMean=fkNX*fkNY*fkNZ;
+  fkMeanBx=new Double_t[fkNMean];
+  fkMeanBy=new Double_t[fkNMean];
 
   Double_t x[3];
   Double_t nBz=0;
-  fMeanBz=0.;
+  fkMeanBz=0.;
   for (int i=0;i<fkNX;++i) {
     x[0]=fkXMin+i*(fkXMax-fkXMin)/(fkNX-1);
     for (int j=0;j<fkNY;++j) {
@@ -178,19 +192,19 @@ void AliTPCExBFirst::ConstructCommon(const AliFieldMap *bFieldMap,
        Bx+=B[0]/10.;
        By+=B[1]/10.;
        /*old
-       fMeanBx[(k*fkNY+j)*fkNX+i]=Bx/(k+1);
-       fMeanBy[(k*fkNY+j)*fkNX+i]=By/(k+1);
+       fkMeanBx[(k*fkNY+j)*fkNX+i]=Bx/(k+1);
+       fkMeanBy[(k*fkNY+j)*fkNX+i]=By/(k+1);
        */
-       fMeanBx[(k*fkNY+j)*fkNX+i]=Bx;
-       fMeanBy[(k*fkNY+j)*fkNX+i]=By;
+       fkMeanBx[(k*fkNY+j)*fkNX+i]=Bx;
+       fkMeanBy[(k*fkNY+j)*fkNX+i]=By;
        if (90.<=R&&R<=250.) {
-         fMeanBz+=B[2]/10.;
+         fkMeanBz+=B[2]/10.;
          ++nBz;
        }
       }
     }
   }
-  fMeanBz/=nBz;
+  fkMeanBz/=nBz;
 }
 
 void AliTPCExBFirst::GetMeanFields(Double_t rx,Double_t ry,Double_t rz,
@@ -218,44 +232,44 @@ void AliTPCExBFirst::GetMeanFields(Double_t rx,Double_t ry,Double_t rz,
   Int_t zi2=zi1+1;
   Double_t dz=(z-zi1);
 
-  double s0x=fMeanBx[yi1*fkNX+xi1]*dx1*dy1
-           +fMeanBx[yi2*fkNX+xi1]*dx1*dy
-            +fMeanBx[yi1*fkNX+xi2]*dx *dy
-            +fMeanBx[yi2*fkNX+xi2]*dx *dy1;
-  double s0y=fMeanBy[yi1*fkNX+xi1]*dx1*dy1
-           +fMeanBy[yi2*fkNX+xi1]*dx1*dy
-            +fMeanBy[yi1*fkNX+xi2]*dx *dy
-            +fMeanBy[yi2*fkNX+xi2]*dx *dy1;
+  double s0x=fkMeanBx[yi1*fkNX+xi1]*dx1*dy1
+           +fkMeanBx[yi2*fkNX+xi1]*dx1*dy
+            +fkMeanBx[yi1*fkNX+xi2]*dx *dy
+            +fkMeanBx[yi2*fkNX+xi2]*dx *dy1;
+  double s0y=fkMeanBy[yi1*fkNX+xi1]*dx1*dy1
+           +fkMeanBy[yi2*fkNX+xi1]*dx1*dy
+            +fkMeanBy[yi1*fkNX+xi2]*dx *dy
+            +fkMeanBy[yi2*fkNX+xi2]*dx *dy1;
   Int_t zi0=zi1-1;
   double snmx,snmy;
   if (zi0>=0) {
-    snmx=fMeanBx[(zi0*fkNY+yi1)*fkNX+xi1]*dx1*dy1
-        +fMeanBx[(zi0*fkNY+yi2)*fkNX+xi1]*dx1*dy
-        +fMeanBx[(zi0*fkNY+yi1)*fkNX+xi2]*dx *dy
-        +fMeanBx[(zi0*fkNY+yi2)*fkNX+xi2]*dx *dy1;
-    snmy=fMeanBy[(zi0*fkNY+yi1)*fkNX+xi1]*dx1*dy1
-        +fMeanBy[(zi0*fkNY+yi2)*fkNX+xi1]*dx1*dy
-        +fMeanBy[(zi0*fkNY+yi1)*fkNX+xi2]*dx *dy
-        +fMeanBy[(zi0*fkNY+yi2)*fkNX+xi2]*dx *dy1;
+    snmx=fkMeanBx[(zi0*fkNY+yi1)*fkNX+xi1]*dx1*dy1
+        +fkMeanBx[(zi0*fkNY+yi2)*fkNX+xi1]*dx1*dy
+        +fkMeanBx[(zi0*fkNY+yi1)*fkNX+xi2]*dx *dy
+        +fkMeanBx[(zi0*fkNY+yi2)*fkNX+xi2]*dx *dy1;
+    snmy=fkMeanBy[(zi0*fkNY+yi1)*fkNX+xi1]*dx1*dy1
+        +fkMeanBy[(zi0*fkNY+yi2)*fkNX+xi1]*dx1*dy
+        +fkMeanBy[(zi0*fkNY+yi1)*fkNX+xi2]*dx *dy
+        +fkMeanBy[(zi0*fkNY+yi2)*fkNX+xi2]*dx *dy1;
   }
   else
     snmx=snmy=0.;
-  double snx=fMeanBx[(zi1*fkNY+yi1)*fkNX+xi1]*dx1*dy1
-           +fMeanBx[(zi1*fkNY+yi2)*fkNX+xi1]*dx1*dy
-            +fMeanBx[(zi1*fkNY+yi1)*fkNX+xi2]*dx *dy
-            +fMeanBx[(zi1*fkNY+yi2)*fkNX+xi2]*dx *dy1;
-  double sny=fMeanBy[(zi1*fkNY+yi1)*fkNX+xi1]*dx1*dy1
-           +fMeanBy[(zi1*fkNY+yi2)*fkNX+xi1]*dx1*dy
-            +fMeanBy[(zi1*fkNY+yi1)*fkNX+xi2]*dx *dy
-            +fMeanBy[(zi1*fkNY+yi2)*fkNX+xi2]*dx *dy1;
-  double snpx=fMeanBx[(zi2*fkNY+yi1)*fkNX+xi1]*dx1*dy1
-            +fMeanBx[(zi2*fkNY+yi2)*fkNX+xi1]*dx1*dy
-             +fMeanBx[(zi2*fkNY+yi1)*fkNX+xi2]*dx *dy
-             +fMeanBx[(zi2*fkNY+yi2)*fkNX+xi2]*dx *dy1;
-  double snpy=fMeanBy[(zi2*fkNY+yi1)*fkNX+xi1]*dx1*dy1
-            +fMeanBy[(zi2*fkNY+yi2)*fkNX+xi1]*dx1*dy
-             +fMeanBy[(zi2*fkNY+yi1)*fkNX+xi2]*dx *dy
-             +fMeanBy[(zi2*fkNY+yi2)*fkNX+xi2]*dx *dy1;
+  double snx=fkMeanBx[(zi1*fkNY+yi1)*fkNX+xi1]*dx1*dy1
+           +fkMeanBx[(zi1*fkNY+yi2)*fkNX+xi1]*dx1*dy
+            +fkMeanBx[(zi1*fkNY+yi1)*fkNX+xi2]*dx *dy
+            +fkMeanBx[(zi1*fkNY+yi2)*fkNX+xi2]*dx *dy1;
+  double sny=fkMeanBy[(zi1*fkNY+yi1)*fkNX+xi1]*dx1*dy1
+           +fkMeanBy[(zi1*fkNY+yi2)*fkNX+xi1]*dx1*dy
+            +fkMeanBy[(zi1*fkNY+yi1)*fkNX+xi2]*dx *dy
+            +fkMeanBy[(zi1*fkNY+yi2)*fkNX+xi2]*dx *dy1;
+  double snpx=fkMeanBx[(zi2*fkNY+yi1)*fkNX+xi1]*dx1*dy1
+            +fkMeanBx[(zi2*fkNY+yi2)*fkNX+xi1]*dx1*dy
+             +fkMeanBx[(zi2*fkNY+yi1)*fkNX+xi2]*dx *dy
+             +fkMeanBx[(zi2*fkNY+yi2)*fkNX+xi2]*dx *dy1;
+  double snpy=fkMeanBy[(zi2*fkNY+yi1)*fkNX+xi1]*dx1*dy1
+            +fkMeanBy[(zi2*fkNY+yi2)*fkNX+xi1]*dx1*dy
+             +fkMeanBy[(zi2*fkNY+yi1)*fkNX+xi2]*dx *dy
+             +fkMeanBy[(zi2*fkNY+yi2)*fkNX+xi2]*dx *dy1;
   *Bx=0.5*(((snpx-2.*snx+snmx)*dz+2.*(snx-snmx))*dz+snx-s0x+snmx);
   *By=0.5*(((snpy-2.*sny+snmy)*dz+2.*(sny-snmy))*dz+sny-s0y+snmy);
   //TODO: make this nice
index c003ea0..b53820e 100644 (file)
@@ -7,32 +7,39 @@
 
 class AliTPCExBFirst:public AliTPCExB {
 public:
+  AliTPCExBFirst();
   AliTPCExBFirst(const AliFieldMap *bFieldMap,Double_t driftVelocity);
   AliTPCExBFirst(const AliMagF *bField,Double_t driftVelocity,
                 Int_t nx=100,Int_t ny=100,Int_t nz=100);
   virtual ~AliTPCExBFirst();
   virtual void Correct(const Double_t *position,Double_t *corrected);
   void TestThisBeautifulObject(const char* fileName);
+  void SetDriftVelocity(Double_t driftVelocity) {
+    fDriftVelocity=driftVelocity;
+  };
+protected:
+  Double_t fDriftVelocity; // The electron drift velocity.
 private:
   AliTPCExBFirst& operator=(const AliTPCExBFirst&); // don't assign me
   AliTPCExBFirst(const AliTPCExBFirst&); // don't copy me
   void ConstructCommon(const AliFieldMap *bFieldMap,const AliMagF *bField);
   void GetMeanFields(Double_t rx,Double_t ry,Double_t rz,
                     Double_t *Bx,Double_t *By) const;
-  Int_t fkNX;        // field mesh points in x direction
-  Int_t fkNY;        // field mesh points in y direction
-  Int_t fkNZ;        // field mesh points in z direction
-  Double_t fkXMin;   // the first grid point in x direction
-  Double_t fkXMax;   // the last grid point in x direction
-  Double_t fkYMin;   // the first grid point in y direction
-  Double_t fkYMax;   // the last grid point in y direction
-  Double_t fkZMin;   // the first grid point in z direction
-  Double_t fkZMax;   // the last grid point in z direction
-  Double_t *fMeanBx; // the mean field in x direction upto a certain z value
-  Double_t *fMeanBy; // the mean field in y direction upto a certain z value
-  Double_t fMeanBz;  // the mean field in z direction inside the TPC volume
-  static const Double_t fgkEM; // elementary charge over electron mass (C/kg)
-  static const Double_t fgkDriftField; // the TPC drift field (V/m) (modulus)
+  Int_t fkNX;         // field mesh points in x direction
+  Int_t fkNY;         // field mesh points in y direction
+  Int_t fkNZ;         // field mesh points in z direction
+  Double_t fkXMin;    // the first grid point in x direction
+  Double_t fkXMax;    // the last grid point in x direction
+  Double_t fkYMin;    // the first grid point in y direction
+  Double_t fkYMax;    // the last grid point in y direction
+  Double_t fkZMin;    // the first grid point in z direction
+  Double_t fkZMax;    // the last grid point in z direction
+  Int_t fkNMean;      // size of the tablE the mean fields
+  Double_t *fkMeanBx; //[fkNMean] the mean field in x direction upto a certain z value
+  Double_t *fkMeanBy; //[fkNMean] the mean field in y direction upto a certain z value
+  Double_t fkMeanBz;  // the mean field in z direction inside the TPC volume
+  static const Double_t fgkEM; //! elementary charge over electron mass (C/kg)
+  static const Double_t fgkDriftField; //! the TPC drift field (V/m) (modulus)
 
   ClassDef(AliTPCExBFirst,1)
 };
index ce23fc8..40ba1c8 100644 (file)
@@ -99,6 +99,7 @@ void AliTPCcalibDB::Terminate()
 //_____________________________________________________________________________
 AliTPCcalibDB::AliTPCcalibDB():
   fRun(-1),
+  fExB(0),
   fPadGainFactor(0),
   fPadTime0(0),
   fPadPRFWidth(0),
@@ -106,8 +107,8 @@ AliTPCcalibDB::AliTPCcalibDB():
   fPedestals(0),
   fTemperature(0),
   fPressure(0),
-  fParam(0)
-
+  fParam(0),
+  fTrafo(0)
 {
   //
   // constructor
@@ -221,7 +222,6 @@ void AliTPCcalibDB::Update(){
     fPressure = (AliDCSSensorArray*)entry->GetObject();
   }
 
-
   entry          = GetCDBEntry("TPC/Calib/Parameters");
   if (entry){
     //if (fPadNoise) delete fPadNoise;
@@ -229,6 +229,14 @@ void AliTPCcalibDB::Update(){
     fParam = (AliTPCParam*)(entry->GetObject()->Clone());
   }
 
+  entry          = GetCDBEntry("TPC/Calib/ExB");
+  if (entry) {
+    entry->SetOwner(kTRUE);
+    fExB=dynamic_cast<AliTPCExB*>(entry->GetObject()->Clone());
+  }
+
+  delete fTrafo;
+  fTrafo=new AliTPCTransform(); 
 
   //
   AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache
index e86ed4d..e7b7950 100644 (file)
@@ -10,6 +10,8 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 
+#include "AliTPCTransform.h"
+#include "AliTPCExB.h"
 #include "TObject.h"
 class AliTPCCalPad;
 class AliTPCSensorTempArray;
@@ -27,6 +29,8 @@ class AliTPCcalibDB : public TObject
   static void Terminate();
   void   SetRun(Long64_t run);   
   //
+  AliTPCTransform* GetTransform() {return fTrafo;}
+  AliTPCExB* GetExB() {return fExB;}
   AliTPCCalPad* GetPadGainFactor() {return fPadGainFactor;}
   AliTPCCalPad* GetPadTime0() {return fPadTime0;}
   AliTPCCalPad* GetPadPRFWidth() {return fPadPRFWidth;}
@@ -42,7 +46,9 @@ class AliTPCcalibDB : public TObject
 protected:
   void         Update();  //update entries
   AliCDBEntry* GetCDBEntry(const char* cdbPath);   
-  Long64_t        fRun;         // current run number            
+  Long64_t        fRun;         // current run number
+  AliTPCTransform *fTrafo; // object responsible for spacial corrections
+  AliTPCExB *fExB;
 //  AliCDBStorage* fLocator;      // Storage locator retrieved from AliCDBManager
   //
   // calibration parameters per pad
index 488c685..7567a24 100644 (file)
 #pragma link C++ class AliTPCTempMap+;
 
 
-#pragma link C++ class AliCorrector+;
 #pragma link C++ class AliTPCExBExact+;
 #pragma link C++ class AliTPCExBFirst+ ;
 #pragma link C++ class AliTPCExB+;
-
+#pragma link C++ class AliTransform+;
+#pragma link C++ class AliTPCTransform+;
 
 
 #endif
index b4bbea1..dbf4459 100644 (file)
@@ -13,8 +13,9 @@ SRCS:=  AliSegmentID.cxx  AliSegmentArray.cxx AliDigits.cxx AliH2F.cxx \
         AliTPCPreprocessor.cxx  \
         AliTPCCalibViewer.cxx  AliTPCCalibViewerGUI.cxx \
         AliTPCGenDBTemp.cxx AliTPCGenDBConf.cxx \
-       AliCorrector.cxx  AliTPCExB.cxx  AliTPCExBExact.cxx AliTPCExBFirst.cxx \
-        AliTPCTempMap.cxx AliTPCCalibVdrift.cxx
+       AliTPCExB.cxx  AliTPCExBExact.cxx AliTPCExBFirst.cxx \
+        AliTPCTempMap.cxx AliTPCCalibVdrift.cxx \
+        AliTransform.cxx AliTPCTransform.cxx