-//---------------------------------------------------------------------------
-Int_t AliTRDtracker::FollowProlongationG(AliTRDtrack& t, Int_t rf)
-{
- // Starting from current position on track=t this function tries
- // to extrapolate the track up to timeBin=0 and to confirm prolongation
- // if a close cluster is found. Returns the number of clusters
- // expected to be found in sensitive layers
- // GeoManager used to estimate mean density
- Int_t sector;
- Int_t lastplane = GetLastPlane(&t);
- Int_t tryAgain=fMaxGap;
- Double_t alpha=t.GetAlpha();
- alpha = TVector2::Phi_0_2pi(alpha);
- Double_t radLength, rho, x, dx;
- //, y, ymax, z;
- Int_t expectedNumberOfClusters = 0;
- Double_t dxsample = fgkDriftCorrection*(Double_t) fPar->GetDriftVelocity()
- / fPar->GetSamplingFrequency();
- //
- //
- alpha=AliTRDgeometry::GetAlpha(); // note: change in meaning
- Double_t tanmax = TMath::Tan(0.5*alpha);
-
- for (Int_t nr=fTrSec[0]->GetLayerNumber(t.GetX()); nr>rf; nr--) {
- //
- // propagate track in non active layers
- //
- if (!(fTrSec[0]->GetLayer(nr)->IsSensitive())){
- Double_t xyz0[3],xyz1[3],param[7],x,y,z;
- t.GetGlobalXYZ(xyz0[0],xyz0[1],xyz0[2]); //starting global position
- while (nr >rf && (!(fTrSec[0]->GetLayer(nr)->IsSensitive()))){
- x = fTrSec[0]->GetLayer(nr)->GetX();
- nr--;
- if (!t.GetProlongation(x,y,z)) break;
- if (TMath::Abs(y)>x*tanmax){
- nr--;
- break;
- }
- }
- nr++;
- x = fTrSec[0]->GetLayer(nr)->GetX();
- if (!t.GetProlongation(x,y,z)) break;
- //
- // minimal mean and maximal budget scan
- Float_t minbudget =10000;
- Float_t meanbudget =0;
- Float_t maxbudget =-1;
-// Float_t normbudget =0;
-// for (Int_t idy=-1;idy<=1;idy++)
-// for (Int_t idz=-1;idz<=1;idz++){
- for (Int_t idy=0;idy<1;idy++)
- for (Int_t idz=0;idz<1;idz++){
- Double_t y2 = y+idy*TMath::Min(TMath::Sqrt(t.GetSigmaY2()),1.);
- Double_t z2 = z+idz*TMath::Min(TMath::Sqrt(t.GetSigmaY2()),1.);
- xyz1[0] = x*TMath::Cos(t.GetAlpha())-y2*TMath::Sin(t.GetAlpha());
- xyz1[1] = +x*TMath::Sin(t.GetAlpha())+y2*TMath::Cos(t.GetAlpha());
- xyz1[2] = z2;
- AliKalmanTrack::MeanMaterialBudget(xyz0,xyz1,param);
- Float_t budget = param[0]*param[4];
- meanbudget+=budget;
- if (budget<minbudget) minbudget=budget;
- if (budget>maxbudget) maxbudget=budget;
- }
- t.fBudget[0]+=minbudget;
- t.fBudget[1]+=meanbudget/9.;
- t.fBudget[2]+=minbudget;
- //
- //
- xyz1[0] = x*TMath::Cos(t.GetAlpha())-y*TMath::Sin(t.GetAlpha());
- xyz1[1] = +x*TMath::Sin(t.GetAlpha())+y*TMath::Cos(t.GetAlpha());
- xyz1[2] = z;
- AliKalmanTrack::MeanMaterialBudget(xyz0,xyz1,param);
-
- t.PropagateTo(x,param[1],param[0]);
- t.GetGlobalXYZ(xyz0[0],xyz0[1],xyz0[2]); //end global position
- AdjustSector(&t);
- continue;
- }
- //
- //
- // stop tracking for highly inclined tracks
- if (!AdjustSector(&t)) break;
- if (TMath::Abs(t.GetSnp())>0.95) break;
- //
- // propagate and update track in active layers
- //
- Int_t nr0 = nr; //first active layer
- if (nr >rf && (fTrSec[0]->GetLayer(nr)->IsSensitive())){
- Double_t xyz0[3],xyz1[3],param[7],x,y,z;
- t.GetGlobalXYZ(xyz0[0],xyz0[1],xyz0[2]); //starting global position
- while (nr >rf && ((fTrSec[0]->GetLayer(nr)->IsSensitive()))){
- x = fTrSec[0]->GetLayer(nr)->GetX();
- nr--;
- if (!t.GetProlongation(x,y,z)) break;
- if (TMath::Abs(y)>x*tanmax){
- nr--;
- break;
- }
- }
- // nr++;
- x = fTrSec[0]->GetLayer(nr)->GetX();
- if (!t.GetProlongation(x,y,z)) break;
- xyz1[0] = x*TMath::Cos(t.GetAlpha())-y*TMath::Sin(t.GetAlpha());
- xyz1[1] = +x*TMath::Sin(t.GetAlpha())+y*TMath::Cos(t.GetAlpha());
- xyz1[2] = z;
- // end global position
- AliKalmanTrack::MeanMaterialBudget(xyz0,xyz1,param);
- rho = param[0];
- radLength = param[1]; // get mean propagation parameters
- }
- //
- // propagate and update
- if (nr0-nr<5){
- // short tracklet - do not update - edge effect
- x = fTrSec[0]->GetLayer(nr)->GetX();
- t.PropagateTo(x,radLength,rho);
- AdjustSector(&t);
- continue;
- }
- sector = t.GetSector();
- //
- //
- for (Int_t ilayer=nr0;ilayer>=nr;ilayer--) {
- expectedNumberOfClusters++;
- t.fNExpected++;
- if (t.fX>345) t.fNExpectedLast++;
- AliTRDpropagationLayer& timeBin=*(fTrSec[sector]->GetLayer(ilayer));
- AliTRDcluster *cl=0;
- UInt_t index=0;
- Double_t maxChi2=fgkMaxChi2;
- dx = (fTrSec[sector]->GetLayer(ilayer+1))->GetX()-timeBin.GetX();
- x = timeBin.GetX();
- t.PropagateTo(x,radLength,rho);
- // Now go for the real cluster search
- if (timeBin) {
- AliTRDcluster * cl0 = timeBin[0];
- if (!cl0) continue; // no clusters in given time bin
- Int_t plane = fGeom->GetPlane(cl0->GetDetector());
- if (plane>lastplane) continue;
- Int_t timebin = cl0->GetLocalTimeBin();
- AliTRDcluster * cl2= GetCluster(&t,plane, timebin,index);
- //
- if (cl2) {
- cl =cl2;
- Double_t h01 = GetTiltFactor(cl);
- maxChi2=t.GetPredictedChi2(cl,h01);
- }
-
- if (cl) {
- // if (cl->GetNPads()<5)
- t.SetSampledEdx(TMath::Abs(cl->GetQ()/dxsample));
- Double_t h01 = GetTiltFactor(cl);
- Int_t det = cl->GetDetector();
- Int_t plane = fGeom->GetPlane(det);
- if (t.fX>345){
- t.fNLast++;
- t.fChi2Last+=maxChi2;
- }
- if(!t.UpdateMI(cl,maxChi2,index,h01,plane)) {
- if(!t.Update(cl,maxChi2,index,h01)) {
- //if(!tryAgain--) return 0;
- }
- }
- else tryAgain=fMaxGap;
- //
- }
- }
- }
- }
- return expectedNumberOfClusters;
-
-