+//______________________________________________________________________
+void AliITSClusterFinder::
+FindCluster(Int_t k,Int_t maxz,AliBin *bins,Int_t &n,Int_t *idx) {
+ //------------------------------------------------------------
+ // returns an array of indices of digits belonging to the cluster
+ // (needed when the segmentation is not regular)
+ //------------------------------------------------------------
+ if (n<200) idx[n++]=bins[k].GetIndex();
+ bins[k].Use();
+
+ if (bins[k-maxz].IsNotUsed()) FindCluster(k-maxz,maxz,bins,n,idx);
+ if (bins[k-1 ].IsNotUsed()) FindCluster(k-1 ,maxz,bins,n,idx);
+ if (bins[k+maxz].IsNotUsed()) FindCluster(k+maxz,maxz,bins,n,idx);
+ if (bins[k+1 ].IsNotUsed()) FindCluster(k+1 ,maxz,bins,n,idx);
+ /*
+ if (bins[k-maxz-1].IsNotUsed()) FindCluster(k-maxz-1,maxz,bins,n,idx);
+ if (bins[k-maxz+1].IsNotUsed()) FindCluster(k-maxz+1,maxz,bins,n,idx);
+ if (bins[k+maxz-1].IsNotUsed()) FindCluster(k+maxz-1,maxz,bins,n,idx);
+ if (bins[k+maxz+1].IsNotUsed()) FindCluster(k+maxz+1,maxz,bins,n,idx);
+ */
+}
+
+//______________________________________________________________________
+Bool_t AliITSClusterFinder::IsMaximum(Int_t k,Int_t max,const AliBin *bins) {
+ //------------------------------------------------------------
+ //is this a local maximum ?
+ //------------------------------------------------------------
+ UShort_t q=bins[k].GetQ();
+ if (q==1023) return kFALSE;
+ if (bins[k-max].GetQ() > q) return kFALSE;
+ if (bins[k-1 ].GetQ() > q) return kFALSE;
+ if (bins[k+max].GetQ() > q) return kFALSE;
+ if (bins[k+1 ].GetQ() > q) return kFALSE;
+ if (bins[k-max-1].GetQ() > q) return kFALSE;
+ if (bins[k+max-1].GetQ() > q) return kFALSE;
+ if (bins[k+max+1].GetQ() > q) return kFALSE;
+ if (bins[k-max+1].GetQ() > q) return kFALSE;
+ return kTRUE;
+}