]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added support for the parameterized integral of the Bx/Bz.By/Bz and
authorshahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Apr 2010 09:54:20 +0000 (09:54 +0000)
committershahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Apr 2010 09:54:20 +0000 (09:54 +0000)
(Bx/Bz)^2+(By/Bz)^2 (and the same in the cyl.frame) calculation:
AliMagF::GetTPCRatInt(xyz,ratint)
AliMagF::GetTPCRatIntCyl(rphiz,ratint_cyl)
The ratios integrals (as well as the integrals of the components, GetTPCInt)
are calculated from 0 to provided z.

STEER/AliMagF.cxx
STEER/AliMagF.h
STEER/AliMagWrapCheb.cxx
STEER/AliMagWrapCheb.h

index f7960fece85c5cf9392810c8ab378abb62a3721d..abe97074891229251b3d7b6f9b7b4237885256a4 100644 (file)
@@ -26,8 +26,7 @@
 ClassImp(AliMagF)
 
 const Double_t AliMagF::fgkSol2DipZ    =  -700.;  
-const UShort_t AliMagF::fgkPolarityConvention = kConvLHC;
-
+const UShort_t AliMagF::fgkPolarityConvention = AliMagF::kConvLHC;
 /*
  Explanation for polarity conventions: these are the mapping between the
  current signs and main field components in L3 (Bz) and Dipole (Bx) (in Alice frame)
@@ -357,7 +356,7 @@ void AliMagF::MachineField(const Double_t *x, Double_t *b) const
 //_______________________________________________________________________
 void AliMagF::GetTPCInt(const Double_t *xyz, Double_t *b) const
 {
-  // Method to calculate the integral of magnetic integral from xyz to nearest cathode plane
+  // Method to calculate the integral_0^z of br,bt,bz 
   b[0]=b[1]=b[2]=0.0;
   if (fMeasuredMap) {
     fMeasuredMap->GetTPCInt(xyz,b);
@@ -365,10 +364,21 @@ void AliMagF::GetTPCInt(const Double_t *xyz, Double_t *b) const
   }
 }
 
+//_______________________________________________________________________
+void AliMagF::GetTPCRatInt(const Double_t *xyz, Double_t *b) const
+{
+  // Method to calculate the integral_0^z of bx/bz,by/bz and (bx/bz)^2+(by/bz)^2
+  b[0]=b[1]=b[2]=0.0;
+  if (fMeasuredMap) {
+    fMeasuredMap->GetTPCRatInt(xyz,b);
+    b[2] /= 100;
+  }
+}
+
 //_______________________________________________________________________
 void AliMagF::GetTPCIntCyl(const Double_t *rphiz, Double_t *b) const
 {
-  // Method to calculate the integral of magnetic integral from point to nearest cathode plane
+  // Method to calculate the integral_0^z of br,bt,bz 
   // in cylindrical coordiates ( -pi<phi<pi convention )
   b[0]=b[1]=b[2]=0.0;
   if (fMeasuredMap) {
@@ -377,6 +387,18 @@ void AliMagF::GetTPCIntCyl(const Double_t *rphiz, Double_t *b) const
   }
 }
 
+//_______________________________________________________________________
+void AliMagF::GetTPCRatIntCyl(const Double_t *rphiz, Double_t *b) const
+{
+  // Method to calculate the integral_0^z of bx/bz,by/bz and (bx/bz)^2+(by/bz)^2
+  // in cylindrical coordiates ( -pi<phi<pi convention )
+  b[0]=b[1]=b[2]=0.0;
+  if (fMeasuredMap) {
+    fMeasuredMap->GetTPCRatIntCyl(rphiz,b);
+    b[2] /= 100;
+  }
+}
+
 //_______________________________________________________________________
 void AliMagF::SetFactorSol(Float_t fc)
 {
index a068580305c69431abab0e0d65a682eb692bae26..b2ed8e0e798ee84a30262cfdfd65c4630dfd6491 100644 (file)
@@ -32,9 +32,11 @@ class AliMagF : public TVirtualMagField
   virtual ~AliMagF();
   //
   virtual void Field(const Double_t *x, Double_t *b);
-  void       GetTPCInt(const Double_t *xyz, Double_t *b)        const;
-  void       GetTPCIntCyl(const Double_t *rphiz, Double_t *b)   const;
-  Double_t   GetBz(const Double_t *xyz)                         const;
+  void       GetTPCInt(const Double_t *xyz, Double_t *b)         const;
+  void       GetTPCRatInt(const Double_t *xyz, Double_t *b)      const;
+  void       GetTPCIntCyl(const Double_t *rphiz, Double_t *b)    const;
+  void       GetTPCRatIntCyl(const Double_t *rphiz, Double_t *b) const;
+  Double_t   GetBz(const Double_t *xyz)                          const;
   //
   AliMagWrapCheb* GetMeasuredMap()                              const {return fMeasuredMap;}
   //
index 5b5a841e34e812813cdb608d88025bc21e4dad4b..063da67f3ed4254c5d2e7d0c405bb3b6f2a82692 100644 (file)
@@ -29,6 +29,10 @@ fNParamsSol(0),fNZSegSol(0),fNPSegSol(0),fNRSegSol(0),
   fNParamsTPC(0),fNZSegTPC(0),fNPSegTPC(0),fNRSegTPC(0),
   fSegZTPC(0),fSegPTPC(0),fSegRTPC(0),
   fBegSegPTPC(0),fNSegPTPC(0),fBegSegRTPC(0),fNSegRTPC(0),fSegIDTPC(0),fMinZTPC(1.e6),fMaxZTPC(-1.e6),fParamsTPC(0),fMaxRTPC(0),
+//
+  fNParamsTPCRat(0),fNZSegTPCRat(0),fNPSegTPCRat(0),fNRSegTPCRat(0),
+  fSegZTPCRat(0),fSegPTPCRat(0),fSegRTPCRat(0),
+  fBegSegPTPCRat(0),fNSegPTPCRat(0),fBegSegRTPCRat(0),fNSegRTPCRat(0),fSegIDTPCRat(0),fMinZTPCRat(1.e6),fMaxZTPCRat(-1.e6),fParamsTPCRat(0),fMaxRTPCRat(0),
 //
   fNParamsDip(0),fNZSegDip(0),fNYSegDip(0),fNXSegDip(0),
   fSegZDip(0),fSegYDip(0),fSegXDip(0),
@@ -48,6 +52,10 @@ AliMagWrapCheb::AliMagWrapCheb(const AliMagWrapCheb& src) :
   fNParamsTPC(0),fNZSegTPC(0),fNPSegTPC(0),fNRSegTPC(0),
   fSegZTPC(0),fSegPTPC(0),fSegRTPC(0),
   fBegSegPTPC(0),fNSegPTPC(0),fBegSegRTPC(0),fNSegRTPC(0),fSegIDTPC(0),fMinZTPC(1.e6),fMaxZTPC(-1.e6),fParamsTPC(0),fMaxRTPC(0),
+//
+  fNParamsTPCRat(0),fNZSegTPCRat(0),fNPSegTPCRat(0),fNRSegTPCRat(0),
+  fSegZTPCRat(0),fSegPTPCRat(0),fSegRTPCRat(0),
+  fBegSegPTPCRat(0),fNSegPTPCRat(0),fBegSegRTPCRat(0),fNSegRTPCRat(0),fSegIDTPCRat(0),fMinZTPCRat(1.e6),fMaxZTPCRat(-1.e6),fParamsTPCRat(0),fMaxRTPCRat(0),
 //
   fNParamsDip(0),fNZSegDip(0),fNYSegDip(0),fNXSegDip(0),
   fSegZDip(0),fSegYDip(0),fSegXDip(0),
@@ -105,6 +113,26 @@ void AliMagWrapCheb::CopyFrom(const AliMagWrapCheb& src)
     for (int i=0;i<fNParamsTPC;i++) fParamsTPC->AddAtAndExpand(new AliCheb3D(*src.GetParamTPCInt(i)),i);
   }
   //
+  fNParamsTPCRat    = src.fNParamsTPCRat;
+  fNZSegTPCRat      = src.fNZSegTPCRat;
+  fNPSegTPCRat      = src.fNPSegTPCRat;
+  fNRSegTPCRat      = src.fNRSegTPCRat;  
+  fMinZTPCRat       = src.fMinZTPCRat;
+  fMaxZTPCRat       = src.fMaxZTPCRat;
+  fMaxRTPCRat       = src.fMaxRTPCRat;
+  if (src.fNParamsTPCRat) {
+    memcpy(fSegZTPCRat   = new Float_t[fNZSegTPCRat], src.fSegZTPCRat, sizeof(Float_t)*fNZSegTPCRat);
+    memcpy(fSegPTPCRat   = new Float_t[fNPSegTPCRat], src.fSegPTPCRat, sizeof(Float_t)*fNPSegTPCRat);
+    memcpy(fSegRTPCRat   = new Float_t[fNRSegTPCRat], src.fSegRTPCRat, sizeof(Float_t)*fNRSegTPCRat);
+    memcpy(fBegSegPTPCRat= new Int_t[fNZSegTPCRat], src.fBegSegPTPCRat, sizeof(Int_t)*fNZSegTPCRat);
+    memcpy(fNSegPTPCRat  = new Int_t[fNZSegTPCRat], src.fNSegPTPCRat, sizeof(Int_t)*fNZSegTPCRat);
+    memcpy(fBegSegRTPCRat= new Int_t[fNPSegTPCRat], src.fBegSegRTPCRat, sizeof(Int_t)*fNPSegTPCRat);
+    memcpy(fNSegRTPCRat  = new Int_t[fNPSegTPCRat], src.fNSegRTPCRat, sizeof(Int_t)*fNPSegTPCRat);
+    memcpy(fSegIDTPCRat  = new Int_t[fNRSegTPCRat], src.fSegIDTPCRat, sizeof(Int_t)*fNRSegTPCRat);
+    fParamsTPCRat        = new TObjArray(fNParamsTPCRat);
+    for (int i=0;i<fNParamsTPCRat;i++) fParamsTPCRat->AddAtAndExpand(new AliCheb3D(*src.GetParamTPCRatInt(i)),i);
+  }
+  //
   fNParamsDip    = src.fNParamsDip;
   fNZSegDip      = src.fNZSegDip;
   fNYSegDip      = src.fNYSegDip;
@@ -174,6 +202,22 @@ void AliMagWrapCheb::Clear(const Option_t *)
   fMaxZTPC = -1e6;
   fMaxRTPC = 0;
   //
+  if (fNParamsTPCRat) {
+    delete   fParamsTPCRat;  fParamsTPCRat = 0;
+    delete[] fSegZTPCRat;    fSegZTPCRat   = 0;
+    delete[] fSegPTPCRat;    fSegPTPCRat   = 0;
+    delete[] fSegRTPCRat;    fSegRTPCRat   = 0;
+    delete[] fBegSegPTPCRat; fBegSegPTPCRat = 0;
+    delete[] fNSegPTPCRat;   fNSegPTPCRat   = 0;
+    delete[] fBegSegRTPCRat; fBegSegRTPCRat = 0;
+    delete[] fNSegRTPCRat;   fNSegRTPCRat   = 0;
+    delete[] fSegIDTPCRat;   fSegIDTPCRat   = 0;   
+  }
+  fNParamsTPCRat = fNZSegTPCRat = fNPSegTPCRat = fNRSegTPCRat = 0;
+  fMinZTPCRat = 1e6;
+  fMaxZTPCRat = -1e6;
+  fMaxRTPCRat = 0;
+  //
   if (fNParamsDip) {
     delete   fParamsDip;  fParamsDip = 0;
     delete[] fSegZDip;    fSegZDip   = 0;
@@ -265,6 +309,15 @@ void AliMagWrapCheb::Print(Option_t *) const
     }
   }
   //
+  printf("Segmentation for TPC field ratios integral (%+.2f<Z<%+.2f cm | R<%.2f cm)\n",fMinZTPCRat,fMaxZTPCRat,fMaxRTPCRat);
+  //
+  if (fParamsTPCRat) {
+    for (int i=0;i<fNParamsTPCRat;i++) {
+      printf("TPCRat%4d ",i);
+      GetParamTPCRatInt(i)->Print();
+    }
+  }
+  //
   printf("Segmentation for Dipole (%+.2f<Z<%+.2f cm)\n",fMinZDip,fMaxZDip);
   if (fParamsDip) {
     for (int i=0;i<fNParamsDip;i++) {
@@ -371,6 +424,38 @@ Int_t AliMagWrapCheb::FindTPCSegment(const Double_t *rpz) const
   return fSegIDTPC[rid];
 }
 
+//__________________________________________________________________________________________________
+Int_t AliMagWrapCheb::FindTPCRatSegment(const Double_t *rpz) const 
+{
+  // find the segment containing point xyz. If it is outside find the closest segment 
+  if (!fNParamsTPCRat) return -1;
+  int rid,pid,zid = TMath::BinarySearch(fNZSegTPCRat,fSegZTPCRat,(Float_t)rpz[2]); // find zsegment
+  //
+  Bool_t reCheck = kFALSE;
+  while(1) {
+    int psegBeg = fBegSegPTPCRat[zid];
+    //
+    for (pid=0;pid<fNSegPTPCRat[zid];pid++) if (rpz[1]<fSegPTPCRat[psegBeg+pid]) break;
+    if ( --pid < 0 ) pid = 0;
+    pid +=  psegBeg;
+    //
+    int rsegBeg = fBegSegRTPCRat[pid];
+    for (rid=0;rid<fNSegRTPCRat[pid];rid++) if (rpz[0]<fSegRTPCRat[rsegBeg+rid]) break;
+    if ( --rid < 0) rid = 0;
+    rid +=  rsegBeg;
+    //
+    // to make sure that due to the precision problems we did not pick the next Zbin    
+    if (!reCheck && (rpz[2] - fSegZSol[zid] < 3.e-5) && zid &&
+       !GetParamSol(fSegIDSol[rid])->IsInside(rpz)) {  // check the previous Z bin
+      zid--;
+      reCheck = kTRUE;
+      continue;
+    } 
+    break;
+  }
+  return fSegIDTPCRat[rid];
+}
+
 
 //__________________________________________________________________________________________
 void AliMagWrapCheb::GetTPCInt(const Double_t *xyz, Double_t *b) const
@@ -394,6 +479,28 @@ void AliMagWrapCheb::GetTPCInt(const Double_t *xyz, Double_t *b) const
   //
 }
 
+//__________________________________________________________________________________________
+void AliMagWrapCheb::GetTPCRatInt(const Double_t *xyz, Double_t *b) const
+{
+  // compute TPCRat region field integral in cartesian coordinates.
+  // If point is outside of the parameterized region get it at closeset valid point
+  static Double_t rphiz[3];
+  //
+  // TPCRatInt region
+  // convert coordinates to cyl system
+  CartToCyl(xyz,rphiz);
+#ifndef _BRING_TO_BOUNDARY_
+  if ( (rphiz[2]>GetMaxZTPCRatInt()||rphiz[2]<GetMinZTPCRatInt()) ||
+       rphiz[0]>GetMaxRTPCRatInt()) {for (int i=3;i--;) b[i]=0; return;}
+#endif
+  //
+  GetTPCRatIntCyl(rphiz,b);
+  //
+  // convert field to cartesian system
+  CylToCartCylB(rphiz, b,b);
+  //
+}
+
 //__________________________________________________________________________________________
 void AliMagWrapCheb::FieldCylSol(const Double_t *rphiz, Double_t *b) const
 {
@@ -436,7 +543,30 @@ void AliMagWrapCheb::GetTPCIntCyl(const Double_t *rphiz, Double_t *b) const
     return;
   }
   AliCheb3D* par = GetParamTPCInt(id);
-  if (par->IsInside(rphiz)) {par->Eval(rphiz,b); return;}
+  if (par->IsInside(rphiz)) {
+    par->Eval(rphiz,b); 
+    return;
+  }
+  b[0] = b[1] = b[2] = 0;
+  return;
+  //
+}
+
+//__________________________________________________________________________________________
+void AliMagWrapCheb::GetTPCRatIntCyl(const Double_t *rphiz, Double_t *b) const
+{
+  // compute field integral in TPCRat region in Cylindircal coordinates
+  // note: the check for the point being inside the parameterized region is done outside
+  int id = FindTPCRatSegment(rphiz);
+  if (id<0) {
+    b[0] = b[1] = b[2] = 0;
+    return;
+  }
+  AliCheb3D* par = GetParamTPCRatInt(id);
+  if (par->IsInside(rphiz)) {
+    par->Eval(rphiz,b); 
+    return;
+  }
   b[0] = b[1] = b[2] = 0;
   return;
   //
@@ -507,6 +637,27 @@ void AliMagWrapCheb::LoadData(const char* inpfile)
     exit(1);
   }
   //
+  // TPCRatInt part     -----------------------------------------------------------
+  AliCheb3DCalc::ReadLine(buffs,stream);
+  if (!buffs.BeginsWith("START TPCRatINT")) {
+    Error("LoadData","Expected: \"START TPCRatINT\", found \"%s\"\nStop\n",buffs.Data());
+    exit(1);
+  }
+  AliCheb3DCalc::ReadLine(buffs,stream); // nparam
+  int nparTPCRatInt = buffs.Atoi(); 
+  //
+  for (int ip=0;ip<nparTPCRatInt;ip++) {
+    AliCheb3D* cheb = new AliCheb3D();
+    cheb->LoadData(stream);
+    AddParamTPCRatInt(cheb);
+  }
+  //
+  AliCheb3DCalc::ReadLine(buffs,stream);
+  if (!buffs.BeginsWith("END TPCRatINT")) {
+    Error("LoadData","Expected \"END TPCRatINT\", found \"%s\"\nStop\n",buffs.Data());
+    exit(1);
+  }
+  //
   // Dipole part    -----------------------------------------------------------
   AliCheb3DCalc::ReadLine(buffs,stream);
   if (!buffs.BeginsWith("START DIPOLE")) {
@@ -539,6 +690,7 @@ void AliMagWrapCheb::LoadData(const char* inpfile)
   BuildTableSol();
   BuildTableDip();
   BuildTableTPCInt();
+  BuildTableTPCRatInt();
   //
   printf("Loaded magnetic field \"%s\" from %s\n",GetName(),strf.Data());
   //
@@ -580,6 +732,18 @@ void AliMagWrapCheb::BuildTableTPCInt()
             &fSegIDTPC);
 }
 
+//__________________________________________________________________________________________
+void AliMagWrapCheb::BuildTableTPCRatInt()
+{
+  BuildTable(fNParamsTPCRat,fParamsTPCRat,
+            fNZSegTPCRat,fNPSegTPCRat,fNRSegTPCRat,
+            fMinZTPCRat,fMaxZTPCRat, 
+            &fSegZTPCRat,&fSegPTPCRat,&fSegRTPCRat,
+            &fBegSegPTPCRat,&fNSegPTPCRat,
+            &fBegSegRTPCRat,&fNSegRTPCRat, 
+            &fSegIDTPCRat);
+}
+
 #endif
 
 //_______________________________________________
@@ -594,6 +758,10 @@ AliMagWrapCheb::AliMagWrapCheb(const char* inputFile) :
   fNParamsTPC(0),fNZSegTPC(0),fNPSegTPC(0),fNRSegTPC(0),
   fSegZTPC(0),fSegPTPC(0),fSegRTPC(0),
   fBegSegPTPC(0),fNSegPTPC(0),fBegSegRTPC(0),fNSegRTPC(0),fSegIDTPC(0),fMinZTPC(1.e6),fMaxZTPC(-1.e6),fParamsTPC(0),fMaxRTPC(0),
+//
+  fNParamsTPCRat(0),fNZSegTPCRat(0),fNPSegTPCRat(0),fNRSegTPCRat(0),
+  fSegZTPCRat(0),fSegPTPCRat(0),fSegRTPCRat(0),
+  fBegSegPTPCRat(0),fNSegPTPCRat(0),fBegSegRTPCRat(0),fNSegRTPCRat(0),fSegIDTPCRat(0),fMinZTPCRat(1.e6),fMaxZTPCRat(-1.e6),fParamsTPCRat(0),fMaxRTPCRat(0),
 //
   fNParamsDip(0),fNZSegDip(0),fNYSegDip(0),fNXSegDip(0),
   fSegZDip(0),fSegYDip(0),fSegXDip(0),
@@ -630,6 +798,19 @@ void AliMagWrapCheb::AddParamTPCInt(const AliCheb3D* param)
   //
 }
 
+//__________________________________________________________________________________________
+void AliMagWrapCheb::AddParamTPCRatInt(const AliCheb3D* param)
+{
+  // adds new parameterization piece for TPCRatInt
+  // NOTE: pieces must be added strictly in increasing R then increasing Z order
+  //
+  if (!fParamsTPCRat) fParamsTPCRat = new TObjArray();
+  fParamsTPCRat->Add( (AliCheb3D*)param);
+  fNParamsTPCRat++;
+  if (fMaxRTPCRat<param->GetBoundMax(0)) fMaxRTPCRat = param->GetBoundMax(0);
+  //
+}
+
 //__________________________________________________________________________________________
 void AliMagWrapCheb::AddParamDip(const AliCheb3D* param)
 {
@@ -663,6 +844,28 @@ void AliMagWrapCheb::ResetTPCInt()
   //
 }
 
+//__________________________________________________________________________________________
+void AliMagWrapCheb::ResetTPCRatInt()
+{
+  // clean TPCRat field integral (used for update)
+  if (fNParamsTPCRat) {
+    delete   fParamsTPCRat;  fParamsTPCRat = 0;
+    delete[] fSegZTPCRat;    fSegZTPCRat   = 0;
+    delete[] fSegPTPCRat;    fSegPTPCRat   = 0;
+    delete[] fSegRTPCRat;    fSegRTPCRat   = 0;
+    delete[] fBegSegPTPCRat; fBegSegPTPCRat = 0;
+    delete[] fNSegPTPCRat;   fNSegPTPCRat   = 0;
+    delete[] fBegSegRTPCRat; fBegSegRTPCRat = 0;
+    delete[] fNSegRTPCRat;   fNSegRTPCRat   = 0;
+    delete[] fSegIDTPCRat;   fSegIDTPCRat   = 0;   
+  }
+  fNParamsTPCRat = fNZSegTPCRat = fNPSegTPCRat = fNRSegTPCRat = 0;
+  fMinZTPCRat = 1e6;
+  fMaxZTPCRat = -1e6;
+  fMaxRTPCRat = 0;
+  //
+}
+
 
 //__________________________________________________
 void AliMagWrapCheb::BuildTable(Int_t npar,TObjArray *parArr, Int_t &nZSeg, Int_t &nYSeg, Int_t &nXSeg,
@@ -875,6 +1078,12 @@ void AliMagWrapCheb::SaveData(const char* outfile) const
   for (int ip=0;ip<fNParamsTPC;ip++) GetParamTPCInt(ip)->SaveData(stream);
   fprintf(stream,"#\nEND TPCINT\n");
   //
+  // TPCRatInt part ---------------------------------------------------------
+  fprintf(stream,"# Set of Chebyshev parameterizations for ALICE magnetic field\nSTART %s\n",GetName());
+  fprintf(stream,"START TPCRatINT\n#Number of pieces\n%d\n",fNParamsTPCRat);
+  for (int ip=0;ip<fNParamsTPCRat;ip++) GetParamTPCRatInt(ip)->SaveData(stream);
+  fprintf(stream,"#\nEND TPCRatINT\n");
+  //
   // Dip part   ---------------------------------------------------------
   fprintf(stream,"START DIPOLE\n#Number of pieces\n%d\n",fNParamsDip);
   for (int ip=0;ip<fNParamsDip;ip++) GetParamDip(ip)->SaveData(stream);
index 6c79770a1f0e51c16b278d0522c07cd30c2951cf..c1de663752dc2fed797cc529889c8a2c81e0c0d2 100644 (file)
@@ -63,6 +63,9 @@ class AliMagWrapCheb: public TNamed
   Int_t      GetNParamsTPCInt()                           const {return fNParamsTPC;}
   Int_t      GetNSegZTPCInt()                             const {return fNZSegTPC;}
   //
+  Int_t      GetNParamsTPCRatInt()                        const {return fNParamsTPCRat;}
+  Int_t      GetNSegZTPCRatInt()                          const {return fNZSegTPCRat;}
+  //
   Int_t      GetNParamsDip()                              const {return fNParamsDip;}
   Int_t      GetNSegZDip()                                const {return fNZSegDip;}
   //
@@ -80,7 +83,12 @@ class AliMagWrapCheb: public TNamed
   Float_t    GetMaxZTPCInt()                              const {return fMaxZTPC;}
   Float_t    GetMaxRTPCInt()                              const {return fMaxRTPC;}
   //
+  Float_t    GetMinZTPCRatInt()                           const {return fMinZTPCRat;}
+  Float_t    GetMaxZTPCRatInt()                           const {return fMaxZTPCRat;}
+  Float_t    GetMaxRTPCRatInt()                           const {return fMaxRTPCRat;}
+  //
   AliCheb3D* GetParamSol(Int_t ipar)                      const {return (AliCheb3D*)fParamsSol->UncheckedAt(ipar);}
+  AliCheb3D* GetParamTPCRatInt(Int_t ipar)                const {return (AliCheb3D*)fParamsTPCRat->UncheckedAt(ipar);}
   AliCheb3D* GetParamTPCInt(Int_t ipar)                   const {return (AliCheb3D*)fParamsTPC->UncheckedAt(ipar);}
   AliCheb3D* GetParamDip(Int_t ipar)                      const {return (AliCheb3D*)fParamsDip->UncheckedAt(ipar);}
   //
@@ -89,12 +97,15 @@ class AliMagWrapCheb: public TNamed
   virtual void Field(const Double_t *xyz, Double_t *b)    const;
   Double_t     GetBz(const Double_t *xyz)                 const;
   //
-  void FieldCyl(const Double_t *rphiz, Double_t  *b)      const;
+  void FieldCyl(const Double_t *rphiz, Double_t  *b)      const;  
   void GetTPCInt(const Double_t *xyz, Double_t *b)        const;
   void GetTPCIntCyl(const Double_t *rphiz, Double_t *b)   const;
+  void GetTPCRatInt(const Double_t *xyz, Double_t *b)     const;
+  void GetTPCRatIntCyl(const Double_t *rphiz, Double_t *b) const;
   //
   Int_t       FindSolSegment(const Double_t *xyz)         const; 
   Int_t       FindTPCSegment(const Double_t *xyz)         const; 
+  Int_t       FindTPCRatSegment(const Double_t *xyz)      const; 
   Int_t       FindDipSegment(const Double_t *xyz)         const; 
   static void CylToCartCylB(const Double_t *rphiz, const Double_t *brphiz,Double_t *bxyz);
   static void CylToCartCartB(const Double_t *xyz,  const Double_t *brphiz,Double_t *bxyz);
@@ -113,6 +124,7 @@ class AliMagWrapCheb: public TNamed
   //
   void       AddParamSol(const AliCheb3D* param);
   void       AddParamTPCInt(const AliCheb3D* param);
+  void       AddParamTPCRatInt(const AliCheb3D* param);
   void       AddParamDip(const AliCheb3D* param);
   void       BuildTable(Int_t npar,TObjArray *parArr, Int_t &nZSeg, Int_t &nYSeg, Int_t &nXSeg,
                        Float_t &minZ,Float_t &maxZ,Float_t **segZ,Float_t **segY,Float_t **segX,
@@ -120,7 +132,9 @@ class AliMagWrapCheb: public TNamed
   void       BuildTableSol();
   void       BuildTableDip();
   void       BuildTableTPCInt();
+  void       BuildTableTPCRatInt();
   void       ResetTPCInt();
+  void       ResetTPCRatInt();
   //
   //
 #endif
@@ -165,6 +179,23 @@ class AliMagWrapCheb: public TNamed
   TObjArray* fParamsTPC;             // Parameterization pieces for TPCint field
   Float_t    fMaxRTPC;               // max raduis for Solenoid field integral in TPC
   //
+  Int_t      fNParamsTPCRat;         // Total number of parameterization pieces for tr.field to Bz integrals in TPC region 
+  Int_t      fNZSegTPCRat;           // number of distinct Z segments in TpcRatInt
+  Int_t      fNPSegTPCRat;           // number of distinct P segments in TpcRatInt
+  Int_t      fNRSegTPCRat;           // number of distinct R segments in TpcRatInt
+  Float_t*   fSegZTPCRat;            //[fNZSegTPCRat] coordinates of distinct Z segments in TpcRatInt
+  Float_t*   fSegPTPCRat;            //[fNPSegTPCRat] coordinated of P segments for each Zsegment in TpcRatInt
+  Float_t*   fSegRTPCRat;            //[fNRSegTPCRat] coordinated of R segments for each Psegment in TpcRatInt
+  Int_t*     fBegSegPTPCRat;         //[fNPSegTPCRat] beginning of P segments array for each Z segment
+  Int_t*     fNSegPTPCRat;           //[fNZSegTPCRat] number of P segments for each Z segment
+  Int_t*     fBegSegRTPCRat;         //[fNPSegTPCRat] beginning of R segments array for each P segment
+  Int_t*     fNSegRTPCRat;           //[fNPSegTPCRat] number of R segments for each P segment
+  Int_t*     fSegIDTPCRat;           //[fNRSegTPCRat] ID of the TpcRatInt parameterization for given RPZ segment
+  Float_t    fMinZTPCRat;            // Min Z of TpcRatInt parameterization
+  Float_t    fMaxZTPCRat;            // Max Z of TpcRatInt parameterization
+  TObjArray* fParamsTPCRat;          // Parameterization pieces for TpcRatInt field
+  Float_t    fMaxRTPCRat;            // max raduis for Solenoid field ratios integral in TPC 
+  //
   Int_t      fNParamsDip;            // Total number of parameterization pieces for dipole 
   Int_t      fNZSegDip;              // number of distinct Z segments in Dipole
   Int_t      fNYSegDip;              // number of distinct Y segments in Dipole
@@ -181,7 +212,7 @@ class AliMagWrapCheb: public TNamed
   Float_t    fMaxZDip;               // Max Z of Dipole parameterization
   TObjArray* fParamsDip;             // Parameterization pieces for Dipole field
   //
-  ClassDef(AliMagWrapCheb,5)         // Wrapper class for the set of Chebishev parameterizations of Alice mag.field
+  ClassDef(AliMagWrapCheb,7)         // Wrapper class for the set of Chebishev parameterizations of Alice mag.field
   //
  };