-#endif
- Int_t idx=0, l=0;
- const AliITSclusterV2 *c=0;
- if (nc--) {
- idx=itrack->GetClusterIndex(nc); l=(idx&0xf0000000)>>28;
- c=(AliITSclusterV2*)GetCluster(idx);
- }
- for (fI=0; fI<kMaxLayer; fI++) {
- AliITSlayer &layer=fLayers[fI];
- Double_t r=layer.GetR();
- if (fI==2 || fI==4) {
- Double_t rs=0.5*(fLayers[fI-1].GetR() + r);
- Double_t d=0.0034, x0=38.6;
- if (fI==2) {rs=9.; d=0.0097; x0=42.;}
- if (!fTrackToFollow.PropagateTo(rs,-d,x0)) throw "";
- }
-
- Double_t x,y,z;
- if (!fTrackToFollow.GetGlobalXYZat(r,x,y,z))
- throw "AliITStrackerV2::PropagateBack: failed to estimate track !";
- Double_t phi=TMath::ATan2(y,x);
- Int_t idet=layer.FindDetectorIndex(phi,z);
- if (idet<0)
- throw "AliITStrackerV2::PropagateBack: failed to find a detector !\n";
- const AliITSdetector &det=layer.GetDetector(idet);
- r=det.GetR(); phi=det.GetPhi();
- if (!fTrackToFollow.Propagate(phi,r)) throw "";
- fTrackToFollow.SetDetectorIndex(idet);
-
- const AliITSclusterV2 *cl=0;
- Int_t index=0;
- Double_t maxchi2=kMaxChi2;
-
- if (l==fI) {
- idet=c->GetDetectorIndex();
- if (idet != fTrackToFollow.GetDetectorIndex()) {
- const AliITSdetector &det=layer.GetDetector(idet);
- r=det.GetR(); phi=det.GetPhi();
- if (!fTrackToFollow.Propagate(phi,r)) throw "";
- fTrackToFollow.SetDetectorIndex(idet);
- }
- Double_t chi2=fTrackToFollow.GetPredictedChi2(c);
- if (chi2<kMaxChi2) {
- cl=c; maxchi2=chi2; index=idx;
- }
- if (nc--) {
- idx=itrack->GetClusterIndex(nc); l=(idx&0xf0000000)>>28;
- c=(AliITSclusterV2*)GetCluster(idx);
- }
- }
-
- if (fTrackToFollow.GetNumberOfClusters()>2) {
- Double_t dz=3*TMath::Sqrt(fTrackToFollow.GetSigmaZ2()+kSigmaZ2[fI]);
- Double_t dy=3*TMath::Sqrt(fTrackToFollow.GetSigmaY2()+kSigmaY2[fI]);
- Double_t zmin=fTrackToFollow.GetZ() - dz;
- Double_t zmax=fTrackToFollow.GetZ() + dz;
- Double_t ymin=fTrackToFollow.GetY() + phi*r - dy;
- Double_t ymax=fTrackToFollow.GetY() + phi*r + dy;
- layer.SelectClusters(zmin,zmax,ymin,ymax);
-
- const AliITSclusterV2 *cc=0; Int_t ci;
- while ((cc=layer.GetNextCluster(ci))!=0) {
- idet=cc->GetDetectorIndex();
- if (idet != fTrackToFollow.GetDetectorIndex()) continue;
- Double_t chi2=fTrackToFollow.GetPredictedChi2(cc);
- if (chi2<maxchi2) {
- cl=cc; index=(fI<<28)+ci; maxchi2=chi2;
- }
- }
- }
-
- if (cl) {
- if (!fTrackToFollow.Update(cl,maxchi2,index))
- cerr<<"AliITStrackerV2::PropagateBack: filtering failed !\n";
- }
- {
- Double_t x0;
- x=layer.GetThickness(fTrackToFollow.GetY(),fTrackToFollow.GetZ(),x0);
- fTrackToFollow.CorrectForMaterial(-x,x0);
- }
- }