+Int_t AliTPCtracker::FollowBackProlongation
+(AliTPCseed& seed, const AliTPCtrack &track) {
+ //-----------------------------------------------------------------
+ // This function propagates tracks back through the TPC
+ //-----------------------------------------------------------------
+ Double_t alpha=seed.GetAlpha() - fSectors->GetAlphaShift();
+ if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi();
+ if (alpha < 0. ) alpha += 2.*TMath::Pi();
+ Int_t s=Int_t(alpha/fSectors->GetAlpha())%fN;
+
+ Int_t idx=-1, sec=-1, row=-1;
+ Int_t nc=track.GetNumberOfClusters();
+
+ if (nc--) {
+ idx=track.GetClusterIndex(nc);
+ sec=(idx&0xff000000)>>24; row=(idx&0x00ff0000)>>16;
+ }
+ if (fSectors==fInnerSec) { if (sec >= fkNIS) row=-1; }
+ else { if (sec < fkNIS) row=-1; }
+
+ Int_t nr=fSectors->GetNRows();
+ for (Int_t i=0; i<nr; i++) {
+ Double_t x=fSectors->GetX(i), ymax=fSectors->GetMaxY(i);
+ Double_t y;
+ if (!seed.GetYAt(x,GetBz(),y)) return 0;
+
+ if (y > ymax) {
+ s = (s+1) % fN;
+ if (!seed.Rotate(fSectors->GetAlpha())) return 0;
+ } else if (y <-ymax) {
+ s = (s-1+fN) % fN;
+ if (!seed.Rotate(-fSectors->GetAlpha())) return 0;
+ }
+
+ if (!seed.PropagateTo(x)) return 0;
+
+ AliTPCcluster *cl=0;
+ Int_t index=0;
+ Double_t maxchi2=kMaxCHI2;
+ Double_t pt=seed.GetSignedPt();
+ Double_t sy2=AliTPCcluster::SigmaY2(seed.GetX(),seed.GetTgl(),pt);
+ Double_t sz2=AliTPCcluster::SigmaZ2(seed.GetX(),seed.GetTgl());
+ Double_t road=4.*sqrt(seed.GetSigmaY2() + sy2), z=seed.GetZ();
+ if (road>kMaxROAD) {
+ Warning("FollowBackProlongation","Too broad road !");
+ return 0;
+ }
+
+ Int_t accepted=seed.GetNumberOfClusters();
+ if (row==i) {
+ //try to accept already found cluster
+ AliTPCcluster *c=(AliTPCcluster*)GetCluster(idx);
+ Double_t chi2;
+ if ((chi2=seed.GetPredictedChi2(c))<maxchi2 || accepted<27) {
+ index=idx; cl=c; maxchi2=chi2;
+ } //else cerr<<"AliTPCtracker::FollowBackProlongation: oulier !\n";
+
+ if (nc--) {
+ idx=track.GetClusterIndex(nc);
+ sec=(idx&0xff000000)>>24; row=(idx&0x00ff0000)>>16;
+ }
+ if (fSectors==fInnerSec) { if (sec >= fkNIS) row=-1; }
+ else { if (sec < fkNIS) row=-1; }
+
+ }
+ if (!cl) {
+ //try to fill the gap
+ const AliTPCRow &krow=fSectors[s][i];
+ if (accepted>27)
+ if (krow) {
+ for (Int_t i=krow.Find(y-road); i<krow; i++) {
+ AliTPCcluster *c=(AliTPCcluster*)(krow[i]);
+ if (c->GetY() > y+road) break;
+ if (c->IsUsed()) continue;
+ if ((c->GetZ()-z)*(c->GetZ()-z)>16.*(seed.GetSigmaZ2()+sz2)) continue;
+ Double_t chi2=seed.GetPredictedChi2(c);
+ if (chi2 > maxchi2) continue;
+ maxchi2=chi2;
+ cl=c;
+ index=krow.GetIndex(i);
+ }
+ }
+ }
+
+ if (cl) {
+ Float_t l=fSectors->GetPadPitchWidth();
+ Float_t corr=1.; if (i>63) corr=0.67; // new (third) pad response !
+ seed.SetSampledEdx(cl->GetQ()/l*corr,seed.GetNumberOfClusters());
+ seed.Update(cl,maxchi2,index);
+ }
+
+ }
+
+ return 1;
+}
+
+//_____________________________________________________________________________
+void AliTPCtracker::MakeSeeds(Int_t i1, Int_t i2) {