+void AliITSClusterFinderSPD::TracksInCluster()
+{
+
+ // Find tracks creating one cluster
+
+ // get number of clusters for this module
+ Int_t nofClusters = fClusters->GetEntriesFast();
+ nofClusters -= fNclusters;
+
+ Int_t i, ix, iz, jx, jz, xstart, xstop, zstart, zstop, nclx, nclz;
+ // Int_t signal, track0, track1, track2;
+ Int_t trmax = 100;
+ Int_t cltracks[trmax], itr, tracki, ii, is, js, ie, ntr, tr0, tr1, tr2;
+
+ for(i=0; i<nofClusters; i++) {
+ ii = 0;
+ memset(cltracks,-1,sizeof(int)*trmax);
+ tr0=tr1=tr2=-1;
+
+ AliITSRawClusterSPD *clusterI = (AliITSRawClusterSPD*) fClusters->At(i);
+
+ nclx = clusterI->NclX();
+ nclz = clusterI->NclZ();
+ xstart = clusterI->XStartf();
+ xstop = clusterI->XStopf();
+ zstart = clusterI->Zend()-nclz+1;
+ zstop = clusterI->Zend();
+
+ Int_t ind;
+
+ for(iz=0; iz<nclz; iz++) {
+ jz = zstart + iz;
+ for(ix=0; ix<nclx; ix++) {
+ jx = xstart + ix;
+ ind = fMap->GetHitIndex(jz,jx);
+ if(ind == 0 && iz >= 0 && ix > 0) {
+ continue;
+ }
+ if(ind == 0 && iz > 0 && ix >= 0) {
+ continue;
+ }
+ if(ind == 0 && iz == 0 && ix == 0 && i > 0) {
+ continue;
+ }
+
+ AliITSdigitSPD *dig = (AliITSdigitSPD*)fMap->GetHit(jz,jx);
+ /*
+ signal=dig->fSignal;
+ track0=dig->fTracks[0];
+ track1=dig->fTracks[1];
+ track2=dig->fTracks[2];
+ */
+ for(itr=0; itr<3; itr++) {
+ tracki = dig->fTracks[itr];
+ if(tracki >= 0) {
+ ii += 1;
+ cltracks[ii-1] = tracki;
+ }
+ }
+ } // ix pixel
+ } // iz pixel
+
+ for(is=0; is<trmax; is++) {
+ if(cltracks[is]<0) continue;
+ for(js=is+1; js<trmax; js++) {
+ if(cltracks[js]<0) continue;
+ if(cltracks[js]==cltracks[is]) cltracks[js]=-5;
+ }
+ }
+
+ ntr = 0;
+ for(ie=0; ie<trmax; ie++) {
+ if(cltracks[ie] >= 0) {
+ ntr=ntr+1;
+ if(ntr==1) tr0=cltracks[ie];
+ if(ntr==2) tr1=cltracks[ie];
+ if(ntr==3) tr2=cltracks[ie];
+ }
+ }
+ // if delta ray only
+ if(ntr == 0) ntr = 1;
+
+ clusterI->SetNTracks(ntr);
+ clusterI->SetTracks(tr0,tr1,tr2);
+
+ } // I cluster
+
+}
+//_____________________________________________________________________________
+