]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
M AliTPCCorrection.h - Update also input parameters - not const
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 6 May 2010 10:18:32 +0000 (10:18 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 6 May 2010 10:18:32 +0000 (10:18 +0000)
M      AliTPCcalibCalib.cxx   - Use PropagateBxByBy
M      AliTPCcalibDB.cxx      - read the correction entry form the OCDB
M      AliTPCcalibTime.cxx    - Use PropagateBxByBz
                              - Use only TRD tracks with refit flag
                              - Smaller outlyer removal deepnes in history (median calc)
M      AliTPCCorrection.cxx   - Adding MakeTrackDistortionTree - used for global minimization
M      AliTPCExBConical.cxx   - Sign

Marian

TPC/AliTPCCorrection.cxx
TPC/AliTPCCorrection.h
TPC/AliTPCExBConical.cxx
TPC/AliTPCcalibCalib.cxx
TPC/AliTPCcalibDB.cxx
TPC/AliTPCcalibTime.cxx

index 32622d3af3cdc64afe66e4ed055181ac6da04b04..2ba9416d1bd9fc3e6f86e37c856f874bc41df1d6 100644 (file)
@@ -38,6 +38,7 @@
 // date: 27/04/2010                                                           //
 // Authors: Magnus Mager, Stefan Rossegger, Jim Thomas                        //
 ////////////////////////////////////////////////////////////////////////////////
+#include "Riostream.h"
 
 #include <TH2F.h>
 #include <TMath.h>
@@ -478,7 +479,7 @@ void AliTPCCorrection::Search( const Int_t n, const Double_t xArray[], const Dou
 }
 
 
-AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(const AliExternalTrackParam * trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream){
+AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(AliExternalTrackParam & trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream){
   //
   // Fit the track parameters - without and with distortion
   // 1. Space points in the TPC are simulated along the trajectory  
@@ -507,7 +508,7 @@ AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(const AliExternalTra
   const Double_t kSigmaZ=0.1;
   const Double_t kMass = TDatabasePDG::Instance()->GetParticle("pi+")->Mass();
 
-  AliExternalTrackParam  track(*trackIn); // 
+  AliExternalTrackParam  track(trackIn); // 
   // generate points
   AliTrackPointArray pointArray0(npoints0);
   AliTrackPointArray pointArray1(npoints0);
@@ -596,7 +597,7 @@ AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(const AliExternalTra
 
   AliTrackerBase::PropagateTrackTo(track0,refX,kMass,2.,kTRUE,kMaxSnp);
   track1->Rotate(track0->GetAlpha());
-  AliTrackerBase::PropagateTrackTo(track1,refX,kMass,2.,kFALSE,kMaxSnp);
+  track1->PropagateTo(track0->GetX(),AliTrackerBase::GetBz());
 
   if (pcstream) (*pcstream)<<Form("fitDistort%s",GetName())<<
     "point0.="<<&pointArray0<<   //  points
@@ -605,6 +606,7 @@ AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(const AliExternalTra
     "track0.="<<track0<<         //  fitted track
     "track1.="<<track1<<         //  fitted distorted track
     "\n";
+  new(&trackIn) AliExternalTrackParam(*track0);
   delete track0;
   return track1;
 }
@@ -675,6 +677,96 @@ TTree* AliTPCCorrection::CreateDistortionTree(Double_t step){
 
 
 
+
+void AliTPCCorrection::MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t ptype, TObjArray * corrArray, Int_t step, Bool_t debug ){
+  //
+  // Make a fit tree:
+  // For each partial correction (specified in array) and given track topology (phi, theta, snp, refX)
+  // calculates partial distortions
+  // Partial distortion is stored in the resulting tree
+  // Output is storred in the file distortion_<dettype>_<partype>.root
+  // Partial  distortion is stored with the name given by correction name
+  //
+  //
+  // Parameters of function:
+  // input     - input tree
+  // dtype     - distortion type 0 - ITSTPC,  1 -TPCTRD, 2 - TPCvertex 
+  // ppype     - parameter type
+  // corrArray - array with partial corrections
+  // step      - skipe entries  - if 1 all entries processed - it is slow
+  // debug     0 if debug on also space points dumped - it is slow
+  const Int_t kMinEntries=50;
+  Double_t phi,theta, snp, mean,rms, entries;
+  tinput->SetBranchAddress("theta",&theta);
+  tinput->SetBranchAddress("phi", &phi);
+  tinput->SetBranchAddress("snp",&snp);
+  tinput->SetBranchAddress("mean",&mean);
+  tinput->SetBranchAddress("rms",&rms);
+  tinput->SetBranchAddress("entries",&entries);
+  TTreeSRedirector *pcstream = new TTreeSRedirector(Form("distortion%d_%d.root",dtype,ptype));
+  //
+  Int_t nentries=tinput->GetEntries();
+  Int_t ncorr=corrArray->GetEntries();
+  Double_t corrections[100]; //
+  Double_t tPar[5];
+  Double_t cov[15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+  Double_t refX=0;
+  Int_t dir=0;
+  if (dtype==0) {refX=85; dir=-1;}
+  if (dtype==1) {refX=245; dir=1;}
+  if (dtype==2) {refX=0; dir=-1;}
+  //
+  for (Int_t ientry=0; ientry<nentries; ientry+=step){
+    tinput->GetEntry(ientry);
+    tPar[0]=0;
+    tPar[1]=theta*refX;
+    tPar[2]=snp;
+    tPar[3]=theta;
+    tPar[4]=0.00001;  // should be calculated - non equal to 0
+    cout<<endl<<endl;
+    cout<<"Entry\n\n"<<ientry<<endl;
+    cout<<"dtype="<<dtype<<   // detector match type
+      "ptype="<<ptype<<   // parameter type
+      "theta="<<theta<<   // theta
+      "phi="<<phi<<       // phi 
+      "snp="<<phi<<       // snp
+      "mean="<<mean<<     // mean dist value
+      "rms="<<rms<<       // rms
+      "entries="<<entries<<endl; // number of entries in bin      
+    
+    if (TMath::Abs(snp)>0.251) continue;
+    (*pcstream)<<"fit"<<
+      "dtype="<<dtype<<   // detector match type
+      "ptype="<<ptype<<   // parameter type
+      "theta="<<theta<<   // theta
+      "phi="<<phi<<       // phi 
+      "snp="<<snp<<       // snp
+      "mean="<<mean<<     // mean dist value
+      "rms="<<rms<<       // rms
+      "entries="<<entries;// number of entries in bin
+    //
+    for (Int_t icorr=0; icorr<ncorr; icorr++) {
+      AliTPCCorrection *corr = (AliTPCCorrection*)corrArray->At(icorr);
+      corrections[icorr]=0;
+      if (entries>kMinEntries){
+       AliExternalTrackParam trackIn(refX,phi,tPar,cov);
+       AliExternalTrackParam *trackOut = 0;
+       if (debug) trackOut=corr->FitDistortedTrack(trackIn, refX, dir,pcstream);
+       if (!debug) trackOut=corr->FitDistortedTrack(trackIn, refX, dir,0);
+       corrections[icorr]= trackOut->GetParameter()[ptype]-trackIn.GetParameter()[ptype];
+       delete trackOut;      
+      }      
+      (*pcstream)<<"fit"<<
+       Form("%s=",corr->GetName())<<corrections[icorr];   // dump correction value
+    }
+    (*pcstream)<<"fit"<<"\n";
+  }
+  delete pcstream;
+}
+
+
+
+
 void AliTPCCorrection::StoreInOCDB(Int_t startRun, Int_t endRun, const char *comment){
   //
   // Store object in the OCDB
index d67d0622b3084a17e4b22bad6cfdb80e5cd456fc..d5fbfa98d4b891b4218ca21b2e52523b24a72106 100644 (file)
@@ -73,8 +73,9 @@ public:
 
   // normally called directly in the correction classes which inherit from this class
   virtual void SetOmegaTauT1T2(Float_t omegaTau,Float_t t1,Float_t t2);
-  AliExternalTrackParam * FitDistortedTrack(const AliExternalTrackParam * trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream);
+  AliExternalTrackParam * FitDistortedTrack(AliExternalTrackParam & trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream);
   void StoreInOCDB(Int_t startRun, Int_t endRun, const char *comment=0);
+  static void MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t ptype, TObjArray * corrArray, Int_t step=1, Bool_t debug=0);
 protected:
   TH2F* CreateTH2F(const char *name,const char *title,
                   const char *xlabel,const char *ylabel,const char *zlabel,
index b601e1da36ed54dd523b954a48f97812ccb2593f..4d89ac95ef2d278b3a0beac88235fa6262eb7fea 100644 (file)
@@ -127,7 +127,7 @@ void AliTPCExBConical::GetCorrection(const Float_t x[],const Short_t roc,Float_t
   Double_t dr   =fC2*corr;
   dx[0]= TMath::Cos(phi)*dr-TMath::Sin(phi)*drphi;
   dx[1]= TMath::Sin(phi)*dr+TMath::Cos(phi)*drphi;
-  dx[2]= 0.001*dTheta*(r-rmiddle); // dtheta in mrad
+  dx[2]= -0.001*dTheta*(r-rmiddle); // dtheta in mrad
 
 }
 
index db4544942e8db54ade623fb32488ffa2a20341b3..4383d6d8add41c42a1111ee62705256ca082e2d3 100644 (file)
@@ -65,7 +65,7 @@
 #include "AliTPCPointCorrection.h"
 #include <TGeoManager.h>
 #include <TGeoPhysicalNode.h>
-
+#include "TDatabasePDG.h"
 ClassImp(AliTPCcalibCalib)
 
 AliTPCcalibCalib::AliTPCcalibCalib():
@@ -321,6 +321,8 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
   AliExternalTrackParam * trackInOld  = (AliExternalTrackParam*)track->GetInnerParam();
   AliExternalTrackParam * trackOuter = (AliExternalTrackParam*)track->GetOuterParam();
   AliExternalTrackParam * trackOutOld   = (AliExternalTrackParam *)friendTrack->GetTPCOut();
+  Double_t mass =    TDatabasePDG::Instance()->GetParticle("pi+")->Mass();
+
     
 
   AliExternalTrackParam trackIn  = *trackOutOld;
@@ -336,7 +338,6 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
   //
   // Refit in
   //
-
   for (Int_t irow=159; irow>0; irow--){
     AliTPCclusterMI *cl=seed->GetClusterPointer(irow);
     if (!cl) continue;
@@ -352,9 +353,11 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
     cov[0]*=cov[0];
     cov[2]*=cov[2];
     trackIn.GetXYZ(xyz);
-    Double_t bz = AliTracker::GetBz(xyz);
+    //    Double_t bz = AliTracker::GetBz(xyz);
+
+    //    if (!trackIn.PropagateTo(r[0],bz)) continue;
+    if (!AliTracker::PropagateTrackToBxByBz(&trackIn, r[0],mass,0.1,kFALSE)) continue;
 
-    if (!trackIn.PropagateTo(r[0],bz)) continue;
     if (RejectCluster(cl,&trackIn)) continue;
     nclIn++;
     trackIn.Update(&r[1],cov);    
@@ -389,8 +392,10 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
     cov[0]*=cov[0];
     cov[2]*=cov[2];
     trackOut.GetXYZ(xyz);
-    Double_t bz = AliTracker::GetBz(xyz);
-    if (!trackOut.PropagateTo(r[0],bz)) continue;
+    //Double_t bz = AliTracker::GetBz(xyz);
+    //    if (!trackOut.PropagateTo(r[0],bz)) continue;
+    if (!AliTracker::PropagateTrackToBxByBz(&trackOut, r[0],mass,0.1,kFALSE)) continue;
+
     if (RejectCluster(cl,&trackOut)) continue;
     nclOut++;
     trackOut.Update(&r[1],cov);        
@@ -425,9 +430,11 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
     cov[0]*=cov[0];
     cov[2]*=cov[2];
     trackIn.GetXYZ(xyz);
-    Double_t bz = AliTracker::GetBz(xyz);
+    //Double_t bz = AliTracker::GetBz(xyz);
+
+    //    if (!trackIn.PropagateTo(r[0],bz)) continue;
+    if (!AliTracker::PropagateTrackToBxByBz(&trackIn, r[0],mass,0.1,kFALSE)) continue;
 
-    if (!trackIn.PropagateTo(r[0],bz)) continue;
     if (RejectCluster(cl,&trackIn)) continue;
     nclIn++;
     trackIn.Update(&r[1],cov);    
index 59fe2e51f826781f22002bf1f1745d20da0ee2cf..b13439869deee835f49b6bee27c7082251ecc769 100644 (file)
@@ -321,7 +321,7 @@ void AliTPCcalibDB::Update(){
     entry->SetOwner(kTRUE);
     fPadGainFactor = (AliTPCCalPad*)entry->GetObject();
   }else{
-    AliFatal("TPC - Missing calibration entry")
+    AliFatal("TPC - Missing calibration entry TPC/Calib/PadGainFactor")
   }
   //
   entry          = GetCDBEntry("TPC/Calib/TimeGain");
@@ -330,7 +330,7 @@ void AliTPCcalibDB::Update(){
     entry->SetOwner(kTRUE);
     fTimeGainSplines = (TObjArray*)entry->GetObject();
   }else{
-    AliFatal("TPC - Missing calibration entry")
+    AliFatal("TPC - Missing calibration entry TPC/Calib/Timegain")
   }
   //
   entry          = GetCDBEntry("TPC/Calib/GainFactorDedx");
@@ -338,7 +338,7 @@ void AliTPCcalibDB::Update(){
     entry->SetOwner(kTRUE);
     fDedxGainFactor = (AliTPCCalPad*)entry->GetObject();
   }else{
-    AliFatal("TPC - Missing calibration entry")
+    AliFatal("TPC - Missing calibration entry TPC/Calib/gainFactordEdx")
   }
   //
   entry          = GetCDBEntry("TPC/Calib/PadTime0");
@@ -350,7 +350,7 @@ void AliTPCcalibDB::Update(){
     AliFatal("TPC - Missing calibration entry")
   }
 
-  entry          = GetCDBEntry("TPC/Calib/Distortion");
+  entry          = GetCDBEntry("TPC/Calib/Distortion TPC/Calib/PadTime0");
   if (entry){
     //if (fPadTime0) delete fPadTime0;
     entry->SetOwner(kTRUE);
@@ -391,7 +391,7 @@ void AliTPCcalibDB::Update(){
     entry->SetOwner(kTRUE);
     fParam = (AliTPCParam*)(entry->GetObject()->Clone());
   }else{
-    AliFatal("TPC - Missing calibration entry")
+    AliFatal("TPC - Missing calibration entry TPC/Calib/Parameters")
   }
 
   entry          = GetCDBEntry("TPC/Calib/ClusterParam");
@@ -448,6 +448,16 @@ void AliTPCcalibDB::Update(){
   }else{
     AliError("TPC - Missing calibration entry")
   }  
+  //TPC space point correction data
+  entry          = GetCDBEntry("TPC/Calib/Correction");
+  if (entry){
+    //entry->SetOwner(kTRUE);
+    fComposedCorrection=dynamic_cast<AliTPCCorrection*>(entry->GetObject());
+    fComposedCorrection->Init();
+  }else{
+    AliError("TPC - Missing calibration entry-  TPC/Calib/Correction")
+  }  
+
   //
   if (!fTransform) {
     fTransform=new AliTPCTransform(); 
index 430e9bae2e9bad049cdbf481ef197b9883c99945..f2425b521ceba9facb9bc4c3df117b3426985f54 100644 (file)
@@ -1219,7 +1219,7 @@ void  AliTPCcalibTime::ProcessAlignITS(AliESDtrack *const track, AliESDfriendTra
   const Double_t kVdYErr  = 0.05;  // initial uncertainty of the vd correction 
   const Double_t kOutCut  = 1.0;   // outlyer cut in AliRelAlgnmentKalman
   const Double_t kMinPt   = 0.3;   // minimal pt
-  const  Int_t     kN=500;         // deepnes of history
+  const  Int_t     kN=50;         // deepnes of history
   static Int_t     kglast=0;
   static Double_t* kgdP[4]={new Double_t[kN], new Double_t[kN], new Double_t[kN], new Double_t[kN]};
   /*
@@ -1246,7 +1246,9 @@ void  AliTPCcalibTime::ProcessAlignITS(AliESDtrack *const track, AliESDfriendTra
   AliExternalTrackParam pITS(*(friendTrack->GetITSOut()));   // ITS standalone if possible
   AliExternalTrackParam pITS2(*(friendTrack->GetITSOut()));  //TPC-ITS track
   pITS2.Rotate(pTPC.GetAlpha());
-  pITS2.PropagateTo(pTPC.GetX(),fMagF);
+  //  pITS2.PropagateTo(pTPC.GetX(),fMagF);
+  AliTracker::PropagateTrackToBxByBz(&pITS2,pTPC.GetX(),0.1,0.1,kFALSE);
+
   AliESDfriendTrack *itsfriendTrack=0;
   //
   // try to find standalone ITS track corresponing to the TPC if possible
@@ -1263,7 +1265,8 @@ void  AliTPCcalibTime::ProcessAlignITS(AliESDtrack *const track, AliESDfriendTra
     pITS=(*(itsfriendTrack->GetITSOut()));
     //
     pITS.Rotate(pTPC.GetAlpha());
-    pITS.PropagateTo(pTPC.GetX(),fMagF);
+    //pITS.PropagateTo(pTPC.GetX(),fMagF);
+    AliTracker::PropagateTrackToBxByBz(&pITS,pTPC.GetX(),0.1,0.1,kFALSE);
     if (TMath::Abs(pITS2.GetY()-pITS.GetY())> kMaxDy) continue;
     hasAlone=kTRUE;
   }
@@ -1414,7 +1417,8 @@ void  AliTPCcalibTime::ProcessAlignTRD(AliESDtrack *const track, AliESDfriendTra
   const Double_t kVdErr   = 0.1;  // initial uncertainty of the vd correction 
   const Double_t kVdYErr  = 0.05;  // initial uncertainty of the vd correction 
   const Double_t kOutCut  = 1.0;   // outlyer cut in AliRelAlgnmentKalman
-  const  Int_t     kN=500;         // deepnes of history
+  const Double_t kRefX    = 275;   // reference X
+  const  Int_t     kN=50;         // deepnes of history
   static Int_t     kglast=0;
   static Double_t* kgdP[4]={new Double_t[kN], new Double_t[kN], new Double_t[kN], new Double_t[kN]};
   //
@@ -1424,16 +1428,21 @@ void  AliTPCcalibTime::ProcessAlignTRD(AliESDtrack *const track, AliESDfriendTra
   if (track->GetTRDclusters(dummycl)<kMinTRD) return;  // minimal amount of clusters
   if (track->GetTPCNcls()<kMinTPC) return;  // minimal amount of clusters cut
   if (!friendTrack->GetTRDIn()) return;  
+  if (!track->IsOn(AliESDtrack::kTRDrefit)) return;  
+  if (!track->IsOn(AliESDtrack::kTRDout)) return;  
   if (!track->GetInnerParam())   return;
-  if (!track->GetOuterParam())   return;
+  if (!friendTrack->GetTPCOut())   return;
   // exclude crossing track
-  if (track->GetOuterParam()->GetZ()*track->GetInnerParam()->GetZ()<0)   return;
+  if (friendTrack->GetTPCOut()->GetZ()*track->GetInnerParam()->GetZ()<0)   return;
   if (TMath::Abs(track->GetInnerParam()->GetZ())<kMinZ)   return;
   //
-  AliExternalTrackParam &pTPC=(AliExternalTrackParam &)(*(track->GetOuterParam()));
+  AliExternalTrackParam &pTPC=(AliExternalTrackParam &)(*(friendTrack->GetTPCOut()));
+  AliTracker::PropagateTrackToBxByBz(&pTPC,kRefX,0.1,0.1,kFALSE);
   AliExternalTrackParam pTRD(*(friendTrack->GetTRDIn()));
   pTRD.Rotate(pTPC.GetAlpha());
-  pTRD.PropagateTo(pTPC.GetX(),fMagF);
+  //  pTRD.PropagateTo(pTPC.GetX(),fMagF);
+  AliTracker::PropagateTrackToBxByBz(&pTRD,pTPC.GetX(),0.1,0.1,kFALSE);
+
   ((Double_t*)pTRD.GetCovariance())[2]+=3.*3.;   // increas sys errors
   ((Double_t*)pTRD.GetCovariance())[9]+=0.1*0.1; // increse sys errors
 
@@ -1455,6 +1464,7 @@ void  AliTPCcalibTime::ProcessAlignTRD(AliESDtrack *const track, AliESDfriendTra
   Int_t entries=(kglast<kN)?kglast:kN;
   for (Int_t i=0;i<4;i++){
     vecMedian[i] = TMath::Median(entries,kgdP[i]);
+
     vecRMS[i]    = TMath::RMS(entries,kgdP[i]);
     vecDeltaN[i] = 0;
     if (vecRMS[i]>0.){
@@ -1573,7 +1583,7 @@ void  AliTPCcalibTime::ProcessAlignTOF(AliESDtrack *const track, AliESDfriendTra
   const Double_t   kVdYErr  = 0.05;  // initial uncertainty of the vd correction 
 
   const Double_t   kOutCut  = 1.0;   // outlyer cut in AliRelAlgnmentKalman
-  const  Int_t     kN=1000;         // deepnes of history
+  const  Int_t     kN=50;         // deepnes of history
   static Int_t     kglast=0;
   static Double_t* kgdP[4]={new Double_t[kN], new Double_t[kN], new Double_t[kN], new Double_t[kN]};
   //
@@ -1583,10 +1593,10 @@ void  AliTPCcalibTime::ProcessAlignTOF(AliESDtrack *const track, AliESDfriendTra
   if (track->GetTOFsignal()<=0)  return;
   if (!friendTrack->GetTPCOut()) return;
   if (!track->GetInnerParam())   return;
-  if (!track->GetOuterParam())   return;
+  if (!friendTrack->GetTPCOut())   return;
   const AliTrackPointArray *points=friendTrack->GetTrackPointArray();
   if (!points) return;
-  AliExternalTrackParam pTPC(*(track->GetOuterParam()));
+  AliExternalTrackParam pTPC(*(friendTrack->GetTPCOut()));
   AliExternalTrackParam pTOF(pTPC);
   Double_t mass = TDatabasePDG::Instance()->GetParticle("mu+")->Mass();
   Int_t npoints = points->GetNPoints();
@@ -1619,7 +1629,7 @@ void  AliTPCcalibTime::ProcessAlignTOF(AliESDtrack *const track, AliESDfriendTra
   //
   if (track->GetTPCNcls()<kMinTPC) return;  // minimal amount of clusters cut
   // exclude crossing track
-  if (track->GetOuterParam()->GetZ()*track->GetInnerParam()->GetZ()<0)   return;
+  if (friendTrack->GetTPCOut()->GetZ()*track->GetInnerParam()->GetZ()<0)   return;
   //
   if (TMath::Abs(pTOF.GetY()-pTPC.GetY())    >kMaxDy)    return;
   if (TMath::Abs(pTOF.GetSnp()-pTPC.GetSnp())>kMaxAngle) return;
@@ -1768,10 +1778,10 @@ void  AliTPCcalibTime::BookDistortionMaps(){
   axisName[3]  ="snp";
   //
   // delta y
-  xminTrack[0] =-1.0; xmaxTrack[0]=1.0;  // 
+  xminTrack[0] =-1.5; xmaxTrack[0]=1.5;  // 
   fResHistoTPCITS[0] = new THnSparseS("TPCITS#Delta_{Y} (cm)","#Delta_{Y} (cm)",    4, binsTrack,xminTrack, xmaxTrack);
   fResHistoTPCvertex[0]    = new THnSparseS("TPCVertex#Delta_{Y} (cm)","#Delta_{Y} (cm)", 4, binsTrack,xminTrack, xmaxTrack);
-  xminTrack[0] =-1.0; xmaxTrack[0]=1.0;  // 
+  xminTrack[0] =-1.5; xmaxTrack[0]=1.5;  // 
   fResHistoTPCTRD[0] = new THnSparseS("TPCTRD#Delta_{Y} (cm)","#Delta_{Y} (cm)", 4, binsTrack,xminTrack, xmaxTrack);
   //
   // delta z
@@ -1841,11 +1851,14 @@ void        AliTPCcalibTime::FillResHistoTPC(const AliESDtrack * pTrack){
   //
   Double_t histoX[4];
   const AliExternalTrackParam * pTPCIn = pTrack->GetInnerParam();
-  const AliExternalTrackParam * pTPCvertex  = pTrack->GetTPCInnerParam();
+  AliExternalTrackParam pTPCvertex(*(pTrack->GetInnerParam()));
   //
   AliExternalTrackParam lits(*pTrack);
-  lits.Rotate(pTPCvertex->GetAlpha());
-  lits.PropagateTo(pTPCvertex->GetX(),fMagF);
+  if (TMath::Abs(pTrack->GetY())>3) return;  // beam pipe
+  pTPCvertex.Rotate(lits.GetAlpha());
+  //pTPCvertex.PropagateTo(pTPCvertex->GetX(),fMagF);
+  AliTracker::PropagateTrackToBxByBz(&pTPCvertex,lits.GetX(),0.1,2,kFALSE);
+  AliTracker::PropagateTrackToBxByBz(&pTPCvertex,lits.GetX(),0.1,0.1,kFALSE);
   Double_t xyz[3];
   pTPCIn->GetXYZ(xyz);
   Double_t phi= TMath::ATan2(xyz[1],xyz[0]);
@@ -1856,8 +1869,8 @@ void        AliTPCcalibTime::FillResHistoTPC(const AliESDtrack * pTrack){
   Float_t dca[2], cov[3];
   pTrack->GetImpactParametersTPC(dca,cov);
   for (Int_t ihisto=0; ihisto<5; ihisto++){
-    histoX[0]=pTPCvertex->GetParameter()[ihisto]-lits.GetParameter()[ihisto];
-    if (ihisto<2) histoX[0]=dca[ihisto];
+    histoX[0]=pTPCvertex.GetParameter()[ihisto]-lits.GetParameter()[ihisto];
+    //    if (ihisto<2) histoX[0]=dca[ihisto];
     fResHistoTPCvertex[ihisto]->Fill(histoX);
   }
 }
@@ -1877,7 +1890,8 @@ void        AliTPCcalibTime::FillResHistoTPCTRD(const AliExternalTrackParam * pT
   //
   AliExternalTrackParam ltrd(*pTRDIn);
   ltrd.Rotate(pTPCOut->GetAlpha());
-  ltrd.PropagateTo(pTPCOut->GetX(),fMagF);
+  //  ltrd.PropagateTo(pTPCOut->GetX(),fMagF);
+  AliTracker::PropagateTrackToBxByBz(&ltrd,pTPCOut->GetX(),0.1,0.1,kFALSE);
 
   for (Int_t ihisto=0; ihisto<5; ihisto++){
     histoX[0]=pTPCOut->GetParameter()[ihisto]-ltrd.GetParameter()[ihisto];