+
+//------------------------------------------------------------------------
+void AliITStrackerMI::FlagFakes(const TObjArray &itsTracks)
+{
+ //
+ // RS: flag those tracks which are suxpected to have fake clusters
+ //
+ const double kThreshPt = 0.5;
+ AliRefArray *refArr[6];
+ //
+ for (int i=0;i<6;i++) {
+ int ncl = fgLayers[i].GetNumberOfClusters();
+ refArr[i] = new AliRefArray(ncl,TMath::Min(ncl,1000));
+ }
+ Int_t nentries = itsTracks.GetEntriesFast();
+ //
+ // fill cluster->track associations
+ for (Int_t itr=0;itr<nentries;itr++){
+ AliITStrackMI* track = (AliITStrackMI*)itsTracks.UncheckedAt(itr);
+ if (!track) continue;
+ AliITStrackMI* trackITS = track->GetWinner();
+ if (!trackITS) continue;
+ for (int il=trackITS->GetNumberOfClusters();il--;) {
+ int idx = trackITS->GetClusterIndex(il);
+ Int_t l=(idx & 0xf0000000) >> 28, c=(idx & 0x0fffffff) >> 00;
+ // if (c>fgLayers[l].GetNumberOfClusters()) continue;
+ refArr[l]->AddReference(c, itr);
+ }
+ }
+ //
+ const UInt_t kMaxRef = 100;
+ UInt_t crefs[kMaxRef];
+ Int_t ncrefs=0;
+ // process tracks with shared clusters
+ for (int itr=0;itr<nentries;itr++){
+ AliITStrackMI* track0 = (AliITStrackMI*)itsTracks.UncheckedAt(itr);
+ AliITStrackMI* trackH0 = track0->GetWinner();
+ if (!trackH0) continue;
+ AliESDtrack* esd0 = track0->GetESDtrack();
+ //
+ for (int il=0;il<trackH0->GetNumberOfClusters();il++) {
+ int idx = trackH0->GetClusterIndex(il);
+ Int_t l=(idx & 0xf0000000) >> 28, c=(idx & 0x0fffffff) >> 00;
+ ncrefs = refArr[l]->GetReferences(c,crefs,kMaxRef);
+ if (ncrefs<2) continue; // there will be always self-reference, for sharing needs at least 2
+ esd0->SetITSSharedFlag(l);
+ for (int ir=ncrefs;ir--;) {
+ if (int(crefs[ir]) <= itr) continue; // ==:selfreference, <: the same pair will be checked with >
+ AliITStrackMI* track1 = (AliITStrackMI*)itsTracks.UncheckedAt(crefs[ir]);
+ AliITStrackMI* trackH1 = track1->GetWinner();
+ AliESDtrack* esd1 = track1->GetESDtrack();
+ esd1->SetITSSharedFlag(l);
+ //
+ double pt0 = trackH0->Pt(), pt1 = trackH1->Pt(), res = 0.;
+ if (pt0>kThreshPt && pt0-pt1>0.2+0.2*(pt0-kThreshPt) ) res = -100;
+ else if (pt1>kThreshPt && pt1-pt0>0.2+0.2*(pt1-kThreshPt) ) res = 100;
+
+ // select the one with smallest chi2's product
+ res += trackH0->GetChi2MIP(0)*trackH0->GetChi2MIP(3);
+ res -= trackH1->GetChi2MIP(0)*trackH1->GetChi2MIP(3);
+ //
+ if (res<0) esd1->SetITSFakeFlag(); // esd0 is winner
+ else esd0->SetITSFakeFlag(); // esd1 is winner
+ }
+ //
+ }
+ //
+ }
+ //
+ for (int i=6;i--;) delete refArr[i];
+}
+