]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCtrackerMI.cxx
Adding possibility to change the tracking window in ctgTheta
[u/mrichter/AliRoot.git] / TPC / AliTPCtrackerMI.cxx
index d8ef4372b48766caf355e80dab49da5721dea45e..a8500a27decbc07ea478f783632d00d944ce5b8a 100644 (file)
 /* $Id$ */
 
 
-#include <TObjArray.h>
-#include <TFile.h>
-#include <TTree.h>
-#include <TClonesArray.h>
 
 #include "Riostream.h"
+#include <TClonesArray.h>
+#include <TFile.h>
+#include <TObjArray.h>
+#include <TTree.h>
 
-#include "AliTPCclusterMI.h"
 #include "AliComplexCluster.h"
-#include "AliTPCParam.h"
-#include "AliTPCClustersRow.h"
-#include "AliTPCpolyTrack.h"
-#include "TStopwatch.h"
 #include "AliESD.h"
 #include "AliHelix.h"
-//
 #include "AliRunLoader.h"
-//
+#include "AliTPCClustersRow.h"
+#include "AliTPCParam.h"
+#include "AliTPCclusterMI.h"
+#include "AliTPCpolyTrack.h"
 #include "AliTPCreco.h" 
 #include "AliTPCtrackerMI.h"
+#include "TStopwatch.h"
 
-
+#include "AliTPCReconstructor.h"
+//
 
 ClassImp(AliTPCseed)
 ClassImp(AliTPCtrackerMI)
@@ -67,7 +66,7 @@ public:
 };
 
 Double_t AliTPCFastMath::fgFastAsin[20000];
-AliTPCFastMath gAliTPCFastMath;
+AliTPCFastMath gAliTPCFastMath; // needed to fill the LUT
 
 AliTPCFastMath::AliTPCFastMath(){
   //
@@ -258,7 +257,22 @@ AliTracker(), fkNIS(par->GetNInnerSector()/2), fkNOS(par->GetNOuterSector()/2)
   fDebug     =0;
   fEvent     =0;
 }
-
+//________________________________________________________________________
+AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCtrackerMI &t):
+  AliTracker(t),
+  fkNIS(t.fkNIS),
+  fkNOS(t.fkNOS)
+{
+  //------------------------------------
+  // dummy copy constructor
+  //------------------------------------------------------------------
+}
+AliTPCtrackerMI & AliTPCtrackerMI::operator=(const AliTPCtrackerMI& /*r*/){
+  //------------------------------
+  // dummy 
+  //--------------------------------------------------------------
+  return *this;
+}
 //_____________________________________________________________________________
 AliTPCtrackerMI::~AliTPCtrackerMI() {
   //------------------------------------------------------------------
@@ -276,9 +290,9 @@ void AliTPCtrackerMI::SetIO()
 {
   //
   fNewIO   =  kTRUE;
-  fInput   =  AliRunLoader::GetTreeR("TPC", kFALSE,AliConfig::fgkDefaultEventFolderName);
+  fInput   =  AliRunLoader::GetTreeR("TPC", kFALSE,AliConfig::GetDefaultEventFolderName());
   
-  fOutput  =  AliRunLoader::GetTreeT("TPC", kTRUE,AliConfig::fgkDefaultEventFolderName);
+  fOutput  =  AliRunLoader::GetTreeT("TPC", kTRUE,AliConfig::GetDefaultEventFolderName());
   if (fOutput){
     AliTPCtrack *iotrack= new AliTPCtrack;
     fOutput->Branch("tracks","AliTPCtrack",&iotrack,32000,100);
@@ -348,7 +362,7 @@ void AliTPCtrackerMI::FillESD(TObjArray* arr)
       AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);    
       if (!pt) continue; 
       pt->PropagateTo(fParam->GetInnerRadiusLow());
-      if (pt->GetNumberOfClusters()>70) {
+      if ( (pt->GetNumberOfClusters()>70)&& (Float_t(pt->GetNumberOfClusters())/Float_t(pt->fNFoundable))>0.55) {
        AliESDtrack iotrack;
        iotrack.UpdateTrackParams(pt,AliESDtrack::kTPCin);      
        //iotrack.SetTPCindex(i);
@@ -1402,23 +1416,34 @@ AliTPCclusterMI *AliTPCtrackerMI::GetClusterMI(Int_t index) const {
 
   const AliTPCRow * tpcrow=0;
   AliTPCclusterMI * clrow =0;
+
   if (sec<fkNIS*2){
     tpcrow = &(fInnerSec[sec%fkNIS][row]);
-    if (sec<fkNIS) 
+    if (tpcrow==0) return 0;
+
+    if (sec<fkNIS) {
+      if (tpcrow->fN1<=ncl) return 0;
       clrow = tpcrow->fClusters1;
-    else
+    }
+    else {
+      if (tpcrow->fN2<=ncl) return 0;
       clrow = tpcrow->fClusters2;
+    }
   }
-  else{
+  else {
     tpcrow = &(fOuterSec[(sec-fkNIS*2)%fkNOS][row]);
-    if (sec-2*fkNIS<fkNOS)
+    if (tpcrow==0) return 0;
+
+    if (sec-2*fkNIS<fkNOS) {
+      if (tpcrow->fN1<=ncl) return 0;
       clrow = tpcrow->fClusters1;
-    else
+    }
+    else {
+      if (tpcrow->fN2<=ncl) return 0;
       clrow = tpcrow->fClusters2;
+    }
   }
-  if (tpcrow==0) return 0;
-  if (tpcrow->GetN()<=ncl) return 0;
-  //  return (AliTPCclusterMI*)(*tpcrow)[ncl];      
+
   return &(clrow[ncl]);      
   
 }
@@ -1431,16 +1456,59 @@ Int_t AliTPCtrackerMI::FollowToNext(AliTPCseed& t, Int_t nr) {
   //-----------------------------------------------------------------
   //
   Double_t  x= GetXrow(nr), ymax=GetMaxY(nr);
-
-  //  if (t.GetRadius()>x+10 ) return 0;
-  //  t.PropagateTo(x+0.02);
-  //t.PropagateTo(x+0.01);
-  if (!t.PropagateTo(x)) {
-    t.fRemoval = 10;
-    return 0;
+  AliTPCclusterMI *cl=0;
+  Int_t tpcindex= t.GetClusterIndex2(nr);
+  //
+  // update current shape info every 5 pad-row
+  //  if ( (nr%5==0) || t.GetNumberOfClusters()<2 || (t.fCurrentSigmaY2<0.0001) ){
+    GetShape(&t,nr);    
+    //}
+  //  
+  if (fIteration>0 && tpcindex>=-1){  //if we have already clusters 
+    //        
+    if (tpcindex==-1) return 0; //track in dead zone
+    if (tpcindex>0){     //
+      cl = t.fClusterPointer[nr];
+      if ( (cl==0) ) cl = GetClusterMI(tpcindex);
+      t.fCurrentClusterIndex1 = tpcindex; 
+    }
+    if (cl){      
+      Int_t relativesector = ((tpcindex&0xff000000)>>24)%18;  // if previously accepted cluster in different sector
+      Float_t angle = relativesector*fSectors->GetAlpha()+fSectors->GetAlphaShift();
+      //
+      if (angle<-TMath::Pi()) angle += 2*TMath::Pi();
+      if (angle>=TMath::Pi()) angle -= 2*TMath::Pi();
+      
+      if (TMath::Abs(angle-t.GetAlpha())>0.001){
+       Double_t rotation = angle-t.GetAlpha();
+       t.fRelativeSector= relativesector;
+       t.Rotate(rotation);     
+      }
+      t.PropagateTo(x);
+      //
+      t.fCurrentCluster = cl; 
+      t.fRow = nr;
+      Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.);
+      if ((tpcindex&0x8000)==0) accept =0;
+      if (accept<3) { 
+       //if founded cluster is acceptible
+       if (cl->IsUsed(11)) {  // id cluster is shared inrease uncertainty
+         t.fErrorY2 += 0.03;
+         t.fErrorZ2 += 0.03; 
+         t.fErrorY2 *= 3;
+         t.fErrorZ2 *= 3; 
+       }
+       t.fNFoundable++;
+       UpdateTrack(&t,accept);
+       return 1;
+      }    
+    }
   }
+  if (fIteration>1) return 0;  // not look for new cluster during refitting
   //
-  Double_t  y=t.GetY(), z=t.GetZ();
+  UInt_t index=0;
+  if (TMath::Abs(t.GetSnp())>0.95 || TMath::Abs(x*t.GetC()-t.GetEta())>0.95) return 0;
+  Double_t  y=t.GetYat(x);
   if (TMath::Abs(y)>ymax){
     if (y > ymax) {
       t.fRelativeSector= (t.fRelativeSector+1) % fN;
@@ -1451,33 +1519,16 @@ Int_t AliTPCtrackerMI::FollowToNext(AliTPCseed& t, Int_t nr) {
       if (!t.Rotate(-fSectors->GetAlpha())) 
        return 0;
     }
-    //if (!t.PropagateTo(x)) {
-    //  return 0;
-    //}
-    return 1;
+    //return 1;
   }
   //
-  // update current shape info every 3 pad-row
-  if ( (nr%5==0) || t.GetNumberOfClusters()<2 || (t.fCurrentSigmaY2<0.0001) ){
-    //t.fCurrentSigmaY = GetSigmaY(&t);
-    //t.fCurrentSigmaZ = GetSigmaZ(&t);
-    GetShape(&t,nr);    
-  }
-  //  
-  AliTPCclusterMI *cl=0;
-  UInt_t index=0;
-  
-  
-  //Int_t nr2 = nr;
-  if (t.GetClusterIndex2(nr)>0){ 
-    //
-    //cl = GetClusterMI(t.GetClusterIndex2(nr));
-    index = t.GetClusterIndex2(nr);    
-    cl = t.fClusterPointer[nr];
-    if ( (cl==0) && (index>0)) cl = GetClusterMI(index);
-    t.fCurrentClusterIndex1 = index; 
+  if (!t.PropagateTo(x)) {
+    if (fIteration==0) t.fRemoval = 10;
+    return 0;
   }
-  
+  y=t.GetY(); 
+  Double_t z=t.GetZ();
+  //
   const AliTPCRow &krow=GetRow(t.fRelativeSector,nr);
   if ( (t.GetSigmaY2()<0) || t.GetSigmaZ2()<0) return 0;
   Double_t  roady  =1.;
@@ -1490,34 +1541,27 @@ Int_t AliTPCtrackerMI::FollowToNext(AliTPCseed& t, Int_t nr) {
   } 
   else
     {
-      if (TMath::Abs(z)<(1.05*x+10)) t.fNFoundable++;
+      if (TMath::Abs(z)<(AliTPCReconstructor::GetCtgRange()*x+10)) t.fNFoundable++;
       else
        return 0;
     }   
   //calculate 
-  if (cl){
-    t.fCurrentCluster = cl; 
-    t.fRow = nr;
-    Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.);
-    if (fIteration>0) accept =0;
-    if (accept<3) { 
-      //if founded cluster is acceptible
-      UpdateTrack(&t,accept);
-      return 1;
-    }    
-  }
-
   if (krow) {
     //    cl = krow.FindNearest2(y+10.,z,roady,roadz,index);    
     cl = krow.FindNearest2(y,z,roady,roadz,index);    
     if (cl) t.fCurrentClusterIndex1 = krow.GetIndex(index);       
   }  
-  //  t.fNoCluster++;
-
   if (cl) {
     t.fCurrentCluster = cl; 
     t.fRow = nr;
+    if (fIteration==2&&cl->IsUsed(10)) return 0; 
     Int_t accept = AcceptCluster(&t,t.fCurrentCluster,1.);
+    if (fIteration==2&&cl->IsUsed(11)) {
+      t.fErrorY2 += 0.03;
+      t.fErrorZ2 += 0.03; 
+      t.fErrorY2 *= 3;
+      t.fErrorZ2 *= 3; 
+    }
     /*    
     if (t.fCurrentCluster->IsUsed(10)){
       //
@@ -1553,7 +1597,6 @@ Int_t AliTPCtrackerMI::FollowToNextFast(AliTPCseed& t, Int_t nr) {
   //
   //
   if (TMath::Abs(y)>ymax){
-    return 0;
     
     if (y > ymax) {
       t.fRelativeSector= (t.fRelativeSector+1) % fN;
@@ -1595,7 +1638,7 @@ Int_t AliTPCtrackerMI::FollowToNextFast(AliTPCseed& t, Int_t nr) {
   } 
   else
     {
-      if (TMath::Abs(z)>(1.05*x+10)) t.SetClusterIndex2(row,-1);
+      if (TMath::Abs(z)>(AliTPCReconstructor::GetCtgRange()*x+10)) t.SetClusterIndex2(row,-1);
     }   
   //calculate 
   
@@ -1678,7 +1721,7 @@ Int_t AliTPCtrackerMI::UpdateClusters(AliTPCseed& t,  Int_t nr) {
   } 
   else
     {
-      if (TMath::Abs(t.GetZ())<(1.05*t.GetX()+10)) t.fNFoundable++;
+      if (TMath::Abs(t.GetZ())<(AliTPCReconstructor::GetCtgRange()*t.GetX()+10)) t.fNFoundable++;
       else
        return 0;      
     }
@@ -1780,7 +1823,8 @@ Int_t AliTPCtrackerMI::FollowProlongation(AliTPCseed& t, Int_t rf, Int_t step) {
     else
       fSectors = fOuterSec;
     if (FollowToNext(t,nr)==0) 
-      if (!t.IsActive()) return 0;
+      if (!t.IsActive()) 
+       return 0;
     
   }   
   return 1;
@@ -1823,11 +1867,10 @@ Int_t AliTPCtrackerMI::FollowBackProlongation(AliTPCseed& t, Int_t rf) {
   if (alpha < 0.            ) alpha += 2.*TMath::Pi();  
   t.fRelativeSector = Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN;
     
-  Int_t first = 0;
-  first = t.fFirstPoint+3;
+  Int_t first = t.fFirstPoint;
   //
   if (first<0) first=0;
-  for (Int_t nr=first+1; nr<=rf; nr++) {
+  for (Int_t nr=first; nr<=rf; nr++) {
     //if ( (t.GetSnp()<0.9))
     if (nr<fInnerSec->GetNRows()) 
       fSectors = fInnerSec;
@@ -1995,7 +2038,7 @@ void  AliTPCtrackerMI::RemoveDouble(TObjArray * arr, Float_t factor1, Float_t fa
   //sort trackss according sectors
   //
   if (fDebug&1) {
-    printf("Number of tracks before double removal- %d\n",arr->GetEntries());
+    Info("RemoveDouble","Number of tracks before double removal- %d\n",arr->GetEntries());
   }
   //
   for (Int_t i=0; i<arr->GetEntriesFast(); i++) {
@@ -2067,7 +2110,7 @@ void  AliTPCtrackerMI::RemoveDouble(TObjArray * arr, Float_t factor1, Float_t fa
   }
   arr->Compress();
   if (fDebug&1) {
-    printf("Number of tracks after double removal- %d\n",arr->GetEntries());
+    Info("RemoveDouble","Number of tracks after double removal- %d\n",arr->GetEntries());
   }
 }
 
@@ -2153,8 +2196,9 @@ void AliTPCtrackerMI::RemoveUsed(TObjArray * arr, Float_t factor1,  Float_t fact
     
   }
   fNtracks = good;
-
-  printf("\n*****\nNumber of good tracks after shared removal\t%d\n",fNtracks);
+  if (fDebug>0){
+    Info("RemoveUsed","\n*****\nNumber of good tracks after shared removal\t%d\n",fNtracks);
+  }
 }
 
 void AliTPCtrackerMI::UnsignClusters() 
@@ -2415,20 +2459,24 @@ Int_t AliTPCtrackerMI::RefitInward(AliESD *event)
   fIteration=2;
   //PrepareForProlongation(fSeeds,1);
   PropagateForward2(fSeeds);
+  Int_t ntracks=0;
   Int_t nseed = fSeeds->GetEntriesFast();
   for (Int_t i=0;i<nseed;i++){
     AliTPCseed * seed = (AliTPCseed*) fSeeds->UncheckedAt(i);
+    if (!seed) continue;
     seed->PropagateTo(fParam->GetInnerRadiusLow());
     AliESDtrack *esd=event->GetTrack(i);
     seed->CookdEdx(0.02,0.6);
     CookLabel(seed,0.1); //For comparison only
-    if (seed->GetNumberOfClusters()>20){
-      esd->UpdateTrackParams(seed,AliESDtrack::kTPCrefit);
+    if (seed->GetNumberOfClusters()>60){
+      esd->UpdateTrackParams(seed,AliESDtrack::kTPCrefit); 
+      ntracks++;
     }
     else{
       //printf("problem\n");
     }
   }
+  Info("RefitInward","Number of refitted tracks %d",ntracks);
   fEvent =0;
   //WriteTracks();
   return 0;
@@ -2446,13 +2494,19 @@ Int_t AliTPCtrackerMI::PropagateBack(AliESD *event)
   ReadSeeds(event,0);
   PropagateBack(fSeeds);
   Int_t nseed = fSeeds->GetEntriesFast();
+  Int_t ntracks=0;
   for (Int_t i=0;i<nseed;i++){
     AliTPCseed * seed = (AliTPCseed*) fSeeds->UncheckedAt(i);
+    if (!seed) continue;
     AliESDtrack *esd=event->GetTrack(i);
     seed->CookdEdx(0.02,0.6);
     CookLabel(seed,0.1); //For comparison only
-    esd->UpdateTrackParams(seed,AliESDtrack::kTPCout);
+    if (seed->GetNumberOfClusters()>60){
+      esd->UpdateTrackParams(seed,AliESDtrack::kTPCout);
+      ntracks++;
+    }
   }
+  Info("PropagateBack","Number of back propagated tracks %d",ntracks);
   fEvent =0;
   //WriteTracks();
   return 0;
@@ -2478,14 +2532,16 @@ void AliTPCtrackerMI::ReadSeeds(AliESD *event, Int_t direction)
   //read seeds from the event
   
   Int_t nentr=event->GetNumberOfTracks();
-  Info("PropagateBack", "Number of ESD tracks: %d\n", nentr);
+  if (fDebug>0){
+    Info("ReadSeeds", "Number of ESD tracks: %d\n", nentr);
+  }
   if (fSeeds) 
     DeleteSeeds();
   if (!fSeeds){   
-    fSeeds = new TObjArray;
+    fSeeds = new TObjArray(nentr);
   }
-  
-  //  Int_t ntrk=0;
+  UnsignClusters();
+  //  Int_t ntrk=0;  
   for (Int_t i=0; i<nentr; i++) {
     AliESDtrack *esd=event->GetTrack(i);
     ULong_t status=esd->GetStatus();    
@@ -2493,6 +2549,21 @@ void AliTPCtrackerMI::ReadSeeds(AliESD *event, Int_t direction)
     AliTPCseed *seed = new AliTPCseed(t,t.GetAlpha());
     if ((status==AliESDtrack::kTPCin)&&(direction==1)) seed->ResetCovariance(); 
     if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) == 0 ) seed->ResetCovariance();
+    if ( direction ==2 && ((status & AliESDtrack::kTPCout) == 0) ) {
+      fSeeds->AddAt(0,i);
+      delete seed;
+      continue;    
+    }
+    if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) > 0 )  {
+      Double_t par0[5],par1[5],x;
+      esd->GetInnerExternalParameters(x,par0);
+      esd->GetExternalParameters(x,par1);
+      Double_t delta1 = TMath::Abs(par0[4]-par1[4])/(0.000000001+TMath::Abs(par0[4]+par1[4]));
+      Double_t delta2 = TMath::Abs(par0[3]-par1[3]);
+      //reset covariance if suspicious 
+      if ( (delta1>0.1) || (delta2>0.006))
+       seed->ResetCovariance();
+    }
 
     //
     //
@@ -2505,8 +2576,13 @@ void AliTPCtrackerMI::ReadSeeds(AliESD *event, Int_t direction)
     if (alpha < 0.            ) alpha += 2.*TMath::Pi();
     Int_t ns=Int_t(alpha/fSectors->GetAlpha())%fN;
     alpha =ns*fSectors->GetAlpha() + fSectors->GetAlphaShift();
+    if (alpha<-TMath::Pi()) alpha += 2*TMath::Pi();
+    if (alpha>=TMath::Pi()) alpha -= 2*TMath::Pi();
     alpha-=seed->GetAlpha();  
-    if (!seed->Rotate(alpha)) continue;
+    if (!seed->Rotate(alpha)) {
+      delete seed;
+      continue;
+    }
     seed->fEsd = esd;
     //
     //seed->PropagateTo(fSectors->GetX(0));
@@ -2520,8 +2596,26 @@ void AliTPCtrackerMI::ReadSeeds(AliESD *event, Int_t direction)
     // seed = seed2;
     //  }
     //}
-    
-    fSeeds->AddLast(seed);
+    //
+    // sign clusters
+    for (Int_t irow=0;irow<160;irow++){
+      Int_t index = seed->GetClusterIndex2(irow);    
+      if (index>0){ 
+       //
+       AliTPCclusterMI * cl = GetClusterMI(index);
+       seed->fClusterPointer[irow] = cl;
+       if (cl){
+         if ((index & 0x8000)==0){
+           cl->Use(10);  // accepted cluster     
+         }else{
+           cl->Use(6);   // close cluster not accepted
+         }     
+       }else{
+          Info("ReadSeeds","Not found cluster");
+       }
+      }
+    }
+    fSeeds->AddAt(seed,i);
   }
 }
 
@@ -2837,8 +2931,8 @@ void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2,
       }
     }
   }
-  if (fDebug>1){
-    //    printf("\nSeeding statiistic:\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2);
+  if (fDebug>3){
+    Info("MakeSeeds3","\nSeeding statistic:\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2);
   }
   delete seed;
 }
@@ -3095,8 +3189,8 @@ void AliTPCtrackerMI::MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2,
     }
   }
   
-  if (fDebug>1){
-    //    printf("\nSeeding statiistic:\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2,nout3);
+  if (fDebug>3){
+    Info("MakeSeeds5","\nSeeding statiistic:\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2,nout3);
   }
   delete seed;
 }
@@ -3352,8 +3446,8 @@ void AliTPCtrackerMI::MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2,
       }
     }  // if accepted seed
   }
-  if (fDebug>1){
-    printf("\nSeeding statiistic:\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin3);
+  if (fDebug>3){
+    Info("MakeSeeds2","\nSeeding statiistic:\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin3);
   }
   delete seed;
 }
@@ -3528,7 +3622,7 @@ AliTPCseed *AliTPCtrackerMI::ReSeed(AliTPCseed *track, Float_t r0, Float_t r1, F
     Int_t clindex = track->GetClusterIndex2(row[ipoint]);
     AliTPCclusterMI * cl = GetClusterMI(clindex);
     if (cl==0) {
-      printf("Bug\n");
+      //Error("Bug\n");
       //      AliTPCclusterMI * cl = GetClusterMI(clindex);
       return 0;
     }
@@ -3696,7 +3790,7 @@ Int_t  AliTPCtrackerMI::CheckKinkPoint(AliTPCseed*seed, Float_t th)
       //Double_t xxh[5];
       //xxh[4]=F1old(x[i2],y[i2],x[padm],y[padm],x[i1],y[i1]);  
       //xxh[2]=F2old(x[i2],y[i2],x[padm],y[padm],x[i1],y[i1]);
-      printf("problem\n");
+      Error("AliTPCtrackerMI::CheckKinkPoint","problem\n");
     }
     y[i] = y[i] - yy;
     z[i] = z[i] - zz;
@@ -3919,6 +4013,7 @@ Int_t AliTPCtrackerMI::ReadSeeds(const TFile *inp) {
 Int_t AliTPCtrackerMI::Clusters2Tracks (AliESD *esd)
 {
   //
+  if (fSeeds) DeleteSeeds();
   fEvent = esd;
   Clusters2Tracks();
   if (!fSeeds) return 1;
@@ -3939,9 +4034,9 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() {
   fIteration = 0;
   fSeeds = Tracking();
 
-
-  printf("Time for tracking: \t");timer.Print();timer.Start();
-
+  if (fDebug>0){
+    Info("Clusters2Tracks","Time for tracking: \t");timer.Print();timer.Start();
+  }
   //activate again some tracks
   for (Int_t i=0; i<fSeeds->GetEntriesFast(); i++) {
     AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i), &t=*pt;    
@@ -3977,7 +4072,8 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() {
     CookLabel(pt,0.1); //For comparison only
     //if ((pt->IsActive() || (pt->fRemoval==10) )&& nc>50 &&pt->GetNumberOfClusters()>0.4*pt->fNFoundable){
     if ((pt->IsActive() || (pt->fRemoval==10) )){
-      cerr<<found++<<'\r';      
+      found++;      
+      if (fDebug>0) cerr<<found<<'\r';      
       pt->fLab2 = i;
     }
     else
@@ -4004,7 +4100,10 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() {
     //    CheckKinkPoint(&t,0.05);
     //if ((pt->IsActive() || (pt->fRemoval==10) )&& nc>50 &&pt->GetNumberOfClusters()>0.4*pt->fNFoundable){
     if ((pt->IsActive() || (pt->fRemoval==10) )){
-      cerr<<found++<<'\r';      
+      found++;
+      if (fDebug>0){
+       cerr<<found<<'\r';      
+      }
       pt->fLab2 = i;
     }
     else
@@ -4061,9 +4160,12 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() {
   */
  
   //  fNTracks = found;
-  printf("Time for overlap removal, track writing and dedx cooking: \t"); timer.Print();timer.Start();
+  if (fDebug>0){
+    Info("Clusters2Tracks","Time for overlap removal, track writing and dedx cooking: \t"); timer.Print();timer.Start();
+  }
   //
-  cerr<<"Number of found tracks : "<<"\t"<<found<<endl;  
+  //  cerr<<"Number of found tracks : "<<"\t"<<found<<endl;  
+  Info("Clusters2Tracks","Number of found tracks %d",found);  
   savedir->cd();
   //  UnloadClusters();
   //  
@@ -4098,7 +4200,7 @@ TObjArray * AliTPCtrackerMI::Tracking(Int_t seedtype, Int_t i1, Int_t i2, Float_
     if (seedtype==2) MakeSeeds2(arr,sec,i1,i2,cuts,dy);
   }
   if (fDebug>0){
-    printf("\nSeeding - %d\t%d\t%d\t%d\n",seedtype,i1,i2,arr->GetEntriesFast());
+    Info("Tracking","\nSeeding - %d\t%d\t%d\t%d\n",seedtype,i1,i2,arr->GetEntriesFast());
     timer.Print();
     timer.Start();
   }
@@ -4184,7 +4286,7 @@ TObjArray * AliTPCtrackerMI::Tracking()
   fdensity = 2.;
   
   if (fDebug>0){
-    printf("\n\nPrimary seeding\t%d\n\n",seeds->GetEntriesFast());
+    Info("Tracking()","\n\nPrimary seeding\t%d\n\n",seeds->GetEntriesFast());
     timer.Print();
     timer.Start();
   }
@@ -4253,7 +4355,7 @@ TObjArray * AliTPCtrackerMI::Tracking()
   }
  
   if (fDebug>0){
-    printf("\n\nSecondary seeding\t%d\n\n",seeds->GetEntriesFast());
+    Info("Tracking()","\n\nSecondary seeding\t%d\n\n",seeds->GetEntriesFast());
     timer.Print();
     timer.Start();
   }
@@ -4416,19 +4518,15 @@ Int_t AliTPCtrackerMI::PropagateBack(TObjArray * arr)
   for (Int_t i=0;i<nseed;i++){
     AliTPCseed *pt = (AliTPCseed*)arr->UncheckedAt(i);
     if (pt) { 
-      AliTPCseed *pt2 = new AliTPCseed(*pt);
+      //AliTPCseed *pt2 = new AliTPCseed(*pt);
       fSectors = fInnerSec;
       //FollowBackProlongation(*pt,fInnerSec->GetNRows()-1);
       //fSectors = fOuterSec;
-      FollowBackProlongation(*pt,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1);
-     
-      if (pt->GetNumberOfClusters()<20 && pt->GetLabel()>0 ){
-       printf("\n%d",pt->GetLabel());
-       fSectors = fInnerSec;
-       //FollowBackProlongation(*pt2,fInnerSec->GetNRows()-1);
-       //fSectors = fOuterSec;
-       FollowBackProlongation(*pt2,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1);
-      }
+      FollowBackProlongation(*pt,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1);     
+      //if (pt->GetNumberOfClusters()<(pt->fEsd->GetTPCclusters(0)) ){
+      //       Error("PropagateBack","Not prolonged track %d",pt->GetLabel());
+      //       FollowBackProlongation(*pt2,fInnerSec->GetNRows()+fOuterSec->GetNRows()-1);
+      //}
     }      
   }
   return 0;
@@ -4441,16 +4539,12 @@ Int_t AliTPCtrackerMI::PropagateForward2(TObjArray * arr)
   // make forward propagation
   //
   Int_t nseed= arr->GetEntriesFast();
+  //
   for (Int_t i=0;i<nseed;i++){
     AliTPCseed *pt = (AliTPCseed*)arr->UncheckedAt(i);
     if (pt) { 
-      AliTPCseed *pt2 = new AliTPCseed(*pt);
       FollowProlongation(*pt,0);
-      if (pt->GetNumberOfClusters()<35 && pt->GetLabel()>0 ){
-       FollowProlongation(*pt2,0);
-      }
-      delete pt2;
-    }      
+    }
   }
   return 0;
 }
@@ -4460,7 +4554,7 @@ Int_t AliTPCtrackerMI::PropagateForward()
 {
   //
   // propagate track forward
-  UnsignClusters();
+  //UnsignClusters();
   Int_t nseed = fSeeds->GetEntriesFast();
   for (Int_t i=0;i<nseed;i++){
     AliTPCseed *pt = (AliTPCseed*)fSeeds->UncheckedAt(i);
@@ -4878,8 +4972,14 @@ AliTPCseed::AliTPCseed():AliTPCtrack(){
   fSeed1 =-1;
   fSeed2 =-1;
   fCurrentCluster =0;
+  fCurrentSigmaY2=0;
+  fCurrentSigmaZ2=0;
+}
+AliTPCseed::AliTPCseed(const AliTPCseed &s):AliTPCtrack(s){
+  //---------------------
+  // dummy copy constructor
+  //-------------------------
 }
-
 AliTPCseed::AliTPCseed(const AliTPCtrack &t):AliTPCtrack(t){
   //
   //copy constructor
@@ -4892,7 +4992,7 @@ AliTPCseed::AliTPCseed(const AliTPCtrack &t):AliTPCtrack(t){
   for (Int_t i=0;i<160;i++) {
     fClusterPointer[i] = 0;
     Int_t index = t.GetClusterIndex(i);
-    if (index>0) {
+    if (index>=-1){ 
       SetClusterIndex2(i,index);
     }
     else{
@@ -4905,7 +5005,8 @@ AliTPCseed::AliTPCseed(const AliTPCtrack &t):AliTPCtrack(t){
   fSeed1 =-1;
   fSeed2 =-1;
   fCurrentCluster =0;
-
+  fCurrentSigmaY2=0;
+  fCurrentSigmaZ2=0;
 }
 
 AliTPCseed::AliTPCseed(const AliKalmanTrack &t, Double_t a):AliTPCtrack(t,a){
@@ -4931,6 +5032,9 @@ AliTPCseed::AliTPCseed(const AliKalmanTrack &t, Double_t a):AliTPCtrack(t,a){
   fSeed1 =-1;
   fSeed2 =-1;
   fCurrentCluster =0;
+  fCurrentSigmaY2=0;
+  fCurrentSigmaZ2=0;
+
 }
 
 AliTPCseed::AliTPCseed(UInt_t index, const Double_t xx[5], const Double_t cc[15], 
@@ -4957,7 +5061,8 @@ AliTPCseed::AliTPCseed(UInt_t index, const Double_t xx[5], const Double_t cc[15]
   fSeed1 =-1;
   fSeed2 =-1;
   fCurrentCluster =0;
-
+  fCurrentSigmaY2=0;
+  fCurrentSigmaZ2=0;
 }
 
 AliTPCseed::~AliTPCseed(){
@@ -5057,9 +5162,9 @@ void AliTPCseed::GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_
     }
     
   }
-  if (shared>found){
-    printf("problem\n");
-  }
+  //if (shared>found){
+    //Error("AliTPCseed::GetClusterStatistic","problem\n");
+  //}
 }
 
 //_____________________________________________________________________________
@@ -5161,7 +5266,7 @@ void AliTPCseed::CookdEdx(Double_t low, Double_t up,Int_t i1, Int_t i2, Bool_t o
          //  TMath::Abs( Int_t(iz) - iz + 0.5);
          //ampc *= 1.15*(1-0.3*dy);
          //ampc *= 1.15*(1-0.3*dz);
-         //      Float_t zfactor = (1.05-0.0004*TMath::Abs(point->GetCPoint().GetZ()));
+         //      Float_t zfactor = (AliTPCReconstructor::GetCtgRange()-0.0004*TMath::Abs(point->GetCPoint().GetZ()));
          //ampc               *=zfactor; 
        }
        else{