- Int_t nc=itrack->GetNumberOfClusters();
-#ifdef DEBUG
-for (Int_t k=0; k<nc; k++) {
- Int_t index=itrack->GetClusterIndex(k);
- AliITSclusterV2 *c=(AliITSclusterV2*)GetCluster(index);
- cout<<c->GetLabel(0)<<' '<<c->GetLabel(1)<<' '<<c->GetLabel(2)<<endl;
-}
-#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 "";
- }
-
- // remember old position [SR, GSI 18.02.2003]
- Double_t oldX, oldY, oldZ;
- fTrackToFollow.GetGlobalXYZat(fTrackToFollow.GetX(),oldX,oldY,oldZ);
- //
-
- 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);
- }
-
- // track time update [SR, GSI 17.02.2003]
- Double_t newX, newY, newZ;
- fTrackToFollow.GetGlobalXYZat(fTrackToFollow.GetX(),newX,newY,newZ);
- Double_t dL2 = (oldX-newX)*(oldX-newX)+(oldY-newY)*(oldY-newY)+(oldZ-newZ)*(oldZ-newZ);
- fTrackToFollow.AddTimeStep(TMath::Sqrt(dL2));
- //
-
- }