From de5d3595a25d5599bf451b5ebfa2154f8e15627b Mon Sep 17 00:00:00 2001 From: hristov Date: Thu, 19 Feb 2004 11:28:22 +0000 Subject: [PATCH] New tunning for the tracking V2. Keep set of best candidates to check the cluster sharing. New criteria for the best candidates (M.Ivanov) --- ITS/AliITSrecoV2.h | 6 +- ITS/AliITStrackV2.h | 1 + ITS/AliITStrackerV2.cxx | 258 ++++++++++++++++++++++++++++++++++++---- ITS/AliITStrackerV2.h | 9 +- 4 files changed, 243 insertions(+), 31 deletions(-) diff --git a/ITS/AliITSrecoV2.h b/ITS/AliITSrecoV2.h index 1cac9ab4c64..72213fcb8ac 100644 --- a/ITS/AliITSrecoV2.h +++ b/ITS/AliITSrecoV2.h @@ -14,7 +14,7 @@ const Int_t kMaxClusterPerLayer=7000*10; const Int_t kMaxDetectorPerLayer=1000; - const Int_t kLayersNotToSkip[]={1,1,1,1,1,1}; + const Int_t kLayersNotToSkip[]={0,0,0,0,0,0}; const Int_t kLastLayerToTrackTo=0; const Int_t kMaxLayer=6; @@ -27,8 +27,8 @@ }; const Double_t kChi2PerCluster=7.; - const Double_t kMaxChi2=20.; - const Double_t kMaxRoad=3.0; + const Double_t kMaxChi2=25.; + const Double_t kMaxRoad=6.0; const Double_t kXV=0.0e+0; const Double_t kYV=0.0e+0; diff --git a/ITS/AliITStrackV2.h b/ITS/AliITStrackV2.h index 12691a194f8..e26a27a44d6 100644 --- a/ITS/AliITStrackV2.h +++ b/ITS/AliITStrackV2.h @@ -34,6 +34,7 @@ class AliTPCtrack; //_____________________________________________________________________________ class AliITStrackV2 : public AliKalmanTrack { + friend class AliITStrackerV2; public: AliITStrackV2(); AliITStrackV2(const AliTPCtrack& t) throw (const Char_t *); diff --git a/ITS/AliITStrackerV2.cxx b/ITS/AliITStrackerV2.cxx index f8e17fead56..5e26df14fe6 100644 --- a/ITS/AliITStrackerV2.cxx +++ b/ITS/AliITStrackerV2.cxx @@ -218,11 +218,12 @@ Int_t AliITStrackerV2::Clusters2Tracks(AliESD *event) { itsTracks.Sort(); Int_t nentr=itsTracks.GetEntriesFast(); - + fTrackHypothesys.Expand(nentr); Int_t ntrk=0; for (fPass=0; fPass<2; fPass++) { Int_t &constraint=fConstraint[fPass]; if (constraint<0) continue; for (Int_t i=0; iGetLabel(); //save the TPC track label @@ -231,29 +232,58 @@ Int_t AliITStrackerV2::Clusters2Tracks(AliESD *event) { ResetBestTrack(); for (FollowProlongation(); fISetLabel(tpcLabel); + besttrack->CookdEdx(); + CookLabel(besttrack,0.); //For comparison only + besttrack->UpdateESDtrack(AliESDtrack::kITSin); + delete itsTracks.RemoveAt(i); + ntrk++; + } } - itsTracks.Delete(); - + // + Int_t entries = fTrackHypothesys.GetEntriesFast(); + for (Int_t ientry=0;ientryGetEntriesFast(); + for (Int_t j=0;jUncheckedAt(j); + if (track){ + delete array->RemoveAt(j); + } + } + delete fTrackHypothesys.RemoveAt(ientry); + } + } + fTrackHypothesys.Delete(); Info("Clusters2Tracks","Number of prolonged tracks: %d\n",ntrk); return 0; @@ -342,7 +372,7 @@ Int_t AliITStrackerV2::Clusters2Tracks(TTree *tpcTree, TTree *itsTree) { fBestTrack.CookdEdx(); CookLabel(&fBestTrack,0.); //For comparison only itsTree->Fill(); - UseClusters(&fBestTrack); + //UseClusters(&fBestTrack); delete itsTracks.RemoveAt(i); } } @@ -402,7 +432,7 @@ Int_t AliITStrackerV2::PropagateBack(AliESD *event) { //fTrackToFollow.CookdEdx(); CookLabel(&fTrackToFollow,0.); //For comparison only fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSout); - UseClusters(&fTrackToFollow); + //UseClusters(&fTrackToFollow); ntrk++; } delete t; @@ -454,7 +484,7 @@ Int_t AliITStrackerV2::RefitInward(AliESD *event) { if (RefitAt(3.7, &fTrackToFollow, t)) { fTrackToFollow.SetLabel(t->GetLabel()); fTrackToFollow.CookdEdx(); - CookLabel(&fTrackToFollow,0.); //For comparison only + CookLabel(&fTrackToFollow,0.0); //For comparison only if (fTrackToFollow.PropagateTo(3.,0.0028,65.19)) {//The beam pipe Double_t a=fTrackToFollow.GetAlpha(); @@ -473,7 +503,7 @@ Int_t AliITStrackerV2::RefitInward(AliESD *event) { if (fTrackToFollow.Propagate(fv+a,xv)) { fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSrefit); - UseClusters(&fTrackToFollow); + //UseClusters(&fTrackToFollow); { AliITSclusterV2 c; c.SetY(yv); c.SetZ(GetZ()); c.SetSigmaY2(GetSigmaY()*GetSigmaY()); @@ -509,6 +539,7 @@ void AliITStrackerV2::FollowProlongation() { //-------------------------------------------------------------------- //This function finds a track prolongation //-------------------------------------------------------------------- + Int_t skipped=0; while (fI>fLastLayerToTrackTo) { Int_t i=fI-1; @@ -584,24 +615,31 @@ void AliITStrackerV2::FollowProlongation() { fI--; //take another prolongation - if (!TakeNextProlongation()) - if (fLayersNotToSkip[fI]) return; - + if (!TakeNextProlongation()){ + skipped++; + if (fLayersNotToSkip[fI]||skipped>1) return; + } } //deal with the best track Int_t ncl=fTrackToFollow.GetNumberOfClusters(); Int_t nclb=fBestTrack.GetNumberOfClusters(); - if (ncl) - if (ncl >= nclb) { - Double_t chi2=fTrackToFollow.GetChi2(); - if (chi2/ncl < kChi2PerCluster) { - if (ncl > nclb || chi2 < fBestTrack.GetChi2()) { - ResetBestTrack(); + if (ncl){ + if ( (ncl>1) && (nclb>3) && ((fTrackToFollow.GetChi2()/ncl)<(2*fBestTrack.GetChi2()/(nclb)))) + AddTrackHypothesys(new AliITStrackV2(fTrackToFollow), fCurrentEsdTrack); + else if (ncl>3) AddTrackHypothesys(new AliITStrackV2(fTrackToFollow), fCurrentEsdTrack); + if (ncl >= nclb) { + Double_t chi2=fTrackToFollow.GetChi2(); + if (chi2/ncl < kChi2PerCluster) { + if (ncl > nclb ) { + ResetBestTrack(); } - } + if ( (ncl == nclb) && chi2 < fBestTrack.GetChi2()) { + ResetBestTrack(); + } + } + } } - } Int_t AliITStrackerV2::TakeNextProlongation() { @@ -1111,3 +1149,171 @@ void AliITStrackerV2::UseClusters(const AliKalmanTrack *t, Int_t from) const { if (c->GetSigmaZ2()>0.1) c->Use(); } + + +void AliITStrackerV2::AddTrackHypothesys(AliITStrackV2 * track, Int_t esdindex) +{ + //------------------------------------------------------------------ + // add track to the list of hypothesys + //------------------------------------------------------------------ + + if (esdindex>=fTrackHypothesys.GetEntriesFast()) fTrackHypothesys.Expand(esdindex*2+10); + // + TObjArray * array = (TObjArray*) fTrackHypothesys.UncheckedAt(esdindex); + if (!array) { + array = new TObjArray(10); + fTrackHypothesys.AddAt(array,esdindex); + } + array->AddLast(track); +} + +void AliITStrackerV2::CompressTrackHypothesys(Int_t esdindex, Int_t maxsize) +{ + //------------------------------------------------------------------- + // compress array of track hypothesys + // keep only maxsize best hypothesys + //------------------------------------------------------------------- + if (! (fTrackHypothesys.UncheckedAt(esdindex)) ) return; + TObjArray * array = (TObjArray*) fTrackHypothesys.UncheckedAt(esdindex); + Int_t entries = array->GetEntries(); + if (entriesGetEntriesFast();i++){ + AliITStrackV2 * track = (AliITStrackV2*)array->UncheckedAt(i); + if (!track) continue; + chi2[current] = track->GetNumberOfClusters()+0.001+track->GetChi2()/track->GetNumberOfClusters(); + current++; + } + TMath::Sort(current,chi2,index,kFALSE); + TObjArray * newarray = new TObjArray(); + maxsize = TMath::Min(current, maxsize); + for (Int_t i=0;iAddLast(array->RemoveAt(index[i])); + } + array->Delete(); + delete array; + fTrackHypothesys.AddAt(newarray,esdindex); + +} + + + +AliITStrackV2 * AliITStrackerV2::GetBestHypothesys(Int_t esdindex, AliITStrackV2 * original) +{ + //------------------------------------------------------------- + // try to find best hypothesy + // currently - minimal chi2 of track+backpropagated track+matching to the tpc track + //------------------------------------------------------------- + TObjArray * array = (TObjArray*) fTrackHypothesys.At(esdindex); + if (!array) return 0; + Int_t entries = array->GetEntriesFast(); + if (!entries) return 0; + Float_t minchi2 = 100000; + Int_t maxn = 2; + AliITStrackV2 * besttrack=0; + // + // calculate "weight of the cluster" + // + Int_t clusterindex[6][100]; + Double_t clusterweight[6][100]; + for (Int_t ilayer=0;ilayer<6;ilayer++) + for (Int_t icluster=0;icluster<100;icluster++){ + clusterindex[ilayer][icluster] = -1; + clusterweight[ilayer][icluster] = 0; + } + //printf("%d\t%d\n",esdindex, entries); + // + Float_t sumchi2=0; + for (Int_t itrack=0;itrackAt(itrack); + if (!track) continue; + sumchi2 +=track->GetChi2(); + } + for (Int_t itrack=0;itrackAt(itrack); + if (!track) continue; + for (Int_t icluster=0;iclusterGetNumberOfClusters();icluster++){ + Int_t tindex = track->GetClusterIndex(icluster); + Int_t ilayer = (tindex & 0xf0000000) >> 28; + if (tindex<0) continue; + Int_t cindex =0; + // + for (cindex=0;cindex<100;cindex++){ + if (clusterindex[ilayer][cindex]<0) break; + if (clusterindex[ilayer][cindex]==tindex) break; + } + if (cindex>100) break; + if (clusterindex[ilayer][cindex]!=tindex) clusterindex[ilayer][cindex] = tindex; + clusterweight[ilayer][cindex]+= track->GetChi2()/sumchi2; + } + } + // + for (Int_t i=0;iAt(i); + if (!track) continue; + AliITStrackV2 * backtrack = new AliITStrackV2(*track); + backtrack->ResetCovariance(); + backtrack->ResetClusters(); + Double_t x = original->GetX(); + RefitAt(x,backtrack,track); + if (track->GetNumberOfClusters()GetC()-original->GetC(); + Double_t deltatgl = backtrack->GetTgl()-original->GetTgl(); + Double_t poolc = (deltac*deltac)/(original->fC44); + Double_t pooltgl = (deltatgl*deltatgl)/(original->fC33); + Double_t chi2 = 0.5*(track->GetChi2()+backtrack->GetChi2())+poolc+pooltgl; + + if (track->GetNumberOfClusters()>maxn){ + besttrack = track; + maxn = track->GetNumberOfClusters(); + minchi2 = chi2; + delete backtrack; + continue; + } + if (chi2 < minchi2){ + besttrack = track; + minchi2 = chi2; + } + delete backtrack; + } + // + // + AliITStrackV2 * track2 = new AliITStrackV2(*original); + + Int_t current=0; + for (Int_t icluster=0;iclusterGetNumberOfClusters();icluster++){ + Int_t index = besttrack->GetClusterIndex(icluster); + Int_t ilayer = (index & 0xf0000000) >> 28; + AliITSclusterV2 *c = (AliITSclusterV2*)GetCluster(index); + if (!c) continue; + // + if (ilayer>1){ + track2->fIndex[current] = index; + track2->fN++; + } + for (Int_t icluster=0;icluster<100;icluster++){ + // sign non "doubt" clusters as used + if (clusterindex[ilayer][icluster]!=index) continue; + if (clusterweight[ilayer][icluster]>0.9){ + if (ilayer<=1){ + track2->fIndex[current] = index; + track2->fN++; + } + current++; + if (c->IsUsed()) continue; + c->Use(); + } + } + } + // besttrack = new AliITStrackV2(*original); + //RefitAt(3.7, besttrack, track2); + delete track2; + // + return besttrack; +} diff --git a/ITS/AliITStrackerV2.h b/ITS/AliITStrackerV2.h index da0ecaabbc5..d1858350e2c 100644 --- a/ITS/AliITStrackerV2.h +++ b/ITS/AliITStrackerV2.h @@ -66,7 +66,7 @@ public: void ResetRoad(); Double_t GetRoad() const {return fRoad;} Double_t GetR() const {return fR;} - AliITSclusterV2 *GetCluster(Int_t i) const {return fClusters[i];} + AliITSclusterV2 *GetCluster(Int_t i) const {return i