+ else{
+ id++;
+ iord[0] = 0;
+ // super-cluster of more than two cells - broken up into smaller
+ // clusters gaussian centers computed. (peaks separated by > 1 cell)
+ // Begin from cell having largest energy deposited This is first
+ // cluster center
+ // *****************************************************************
+ // NOTE --- POSSIBLE MODIFICATION: ONE MAY NOT BREAKING SUPERCLUSTERS
+ // IF NO. OF CELLS IS NOT TOO LARGE ( SAY 5 OR 6 )
+ // SINCE WE EXPECT THE SUPERCLUSTER
+ // TO BE A SINGLE CLUSTER
+ //*******************************************************************
+
+ i1 = fInfcl[1][id];
+ i2 = fInfcl[2][id];
+ i12 = i1 + i2*kNDIMX;
+
+ x[0] = fCoord[0][i1][i2];
+ y[0] = fCoord[1][i1][i2];
+ z[0] = edepcell[i12];
+
+ iord[0] = 0;
+ for(j = 1; j <= ncl[i]; j++)
+ {
+
+ id++;
+ i1 = fInfcl[1][id];
+ i2 = fInfcl[2][id];
+ i12 = i1 + i2*kNDIMX;
+ iord[j] = j;
+ x[j] = fCoord[0][i1][i2];
+ y[j] = fCoord[1][i1][i2];
+ z[j] = edepcell[i12];
+ }
+
+ // arranging cells within supercluster in decreasing order
+ for(j = 1; j <= ncl[i];j++)
+ {
+ itest = 0;
+ ihld = iord[j];
+ for(i1 = 0; i1 < j; i1++)
+ {
+ if(itest == 0 && z[iord[i1]] < z[ihld])
+ {
+ itest = 1;
+ for(i2 = j-1;i2 >= i1;i2--)
+ {
+ iord[i2+1] = iord[i2];
+ }
+ iord[i1] = ihld;
+ }
+ }
+ }
+
+
+ // compute the number of clusters and their centers ( first
+ // guess )
+ // centers must be separated by cells having smaller ener. dep.
+ // neighbouring centers should be either strong or well-separated
+ ig = 0;
+ xc[ig] = x[iord[0]];
+ yc[ig] = y[iord[0]];
+ zc[ig] = z[iord[0]];
+ for(j = 1; j <= ncl[i]; j++)
+ {
+ itest = -1;
+ x1 = x[iord[j]];
+ y1 = y[iord[j]];
+ for(k = 0; k <= ig; k++)
+ {
+ x2 = xc[k];
+ y2 = yc[k];
+ rr = Distance(x1,y1,x2,y2);
+ //************************************************************
+ // finetuning cluster splitting
+ // the numbers zc/4 and zc/10 may need to be changed.
+ // Also one may need to add one more layer because our
+ // cells are smaller in absolute scale
+ //************************************************************
+
+
+ if( rr >= 1.1 && rr < 1.8 && z[iord[j]] > zc[k]/4.) itest++;
+ if( rr >= 1.8 && rr < 2.1 && z[iord[j]] > zc[k]/10.) itest++;
+ if( rr >= 2.1)itest++;
+ }
+
+ if(itest == ig)
+ {
+ ig++;
+ xc[ig] = x1;
+ yc[ig] = y1;
+ zc[ig] = z[iord[j]];
+ }
+ }
+ ClustDetails(ncl[i], ig, x, y ,z, xc, yc, zc, rcl, rcs, cells,
+ testncl, testindex);
+
+ Int_t pp = 0;
+ for(j = 0; j <= ig; j++)
+ {
+ clno++;
+ if (clno >= 5000)
+ {
+ AliWarning("RefClust: Too many clusters! more than 5000");
+ return;
+ }
+ clusdata[0] = xc[j];
+ clusdata[1] = yc[j];
+ clusdata[2] = zc[j];
+ clusdata[4] = rcl[j];
+ clusdata[5] = rcs[j];
+ if(ig == 0)
+ {
+ clusdata[3] = ncl[i] + 1;
+ }
+ else
+ {
+ clusdata[3] = cells[j];
+ }
+ // cell information
+ Int_t ncellcls = testncl[j];
+ if( ncellcls < kNmaxCell )
+ {
+ for(Int_t kk = 1; kk <= ncellcls; kk++)
+ {
+ Int_t ll = testindex[pp];
+ clY = (Int_t)((ktwobysqrt3*y[ll])*10);
+ clX = (Int_t)((x[ll] - clY/20.)*10);
+ clxy[kk-1] = clX*10000 + clY ;