+ }
+ }
+
+ icl=icl+ig+1;
+
+ // We use simple Gaussian weighting. (Tapan Jan 2005)
+ // compute the number of cells belonging to each cluster.
+ // cell can be shared between several clusters
+ // in the ratio of cluster energy deposition
+ // To calculate:
+ // (1) number of cells belonging to a cluster (ig) and
+ // (2) total ADC of the cluster (ig)
+ // (3) x and y positions of the cluster
+
+
+ Int_t *cellCount;
+ Int_t **cellXY;
+
+ Int_t *status;
+ Double_t *totaladc, *totaladc2, *ncell,*weight;
+ Double_t *xclust, *yclust, *sigxclust, *sigyclust;
+ Double_t *ax, *ay, *ax2, *ay2;
+
+
+ status = new Int_t [ncl[i]+1];
+ cellXY = new Int_t *[ncl[i]+1];
+
+ cellCount = new Int_t [ig+1];
+ totaladc = new Double_t [ig+1];
+ totaladc2 = new Double_t [ig+1];
+ ncell = new Double_t [ig+1];
+ weight = new Double_t [ig+1];
+ xclust = new Double_t [ig+1];
+ yclust = new Double_t [ig+1];
+ sigxclust = new Double_t [ig+1];
+ sigyclust = new Double_t [ig+1];
+ ax = new Double_t [ig+1];
+ ay = new Double_t [ig+1];
+ ax2 = new Double_t [ig+1];
+ ay2 = new Double_t [ig+1];
+
+ for(j = 0; j < ncl[i]+1; j++)
+ {
+ status[j] = 0;
+ cellXY[j] = new Int_t[ig+1];
+ }
+ //initialization
+ for(Int_t kcl = 0; kcl < ig+1; kcl++)
+ {
+ cellCount[kcl] = 0;
+ totaladc[kcl] = 0.;
+ totaladc2[kcl] = 0.;
+ ncell[kcl] = 0.;
+ weight[kcl] = 0.;
+ xclust[kcl] = 0.;
+ yclust[kcl] = 0.;
+ sigxclust[kcl] = 0.;
+ sigyclust[kcl] = 0.;
+ ax[kcl] = 0.;
+ ay[kcl] = 0.;
+ ax2[kcl] = 0.;
+ ay2[kcl] = 0.;
+ for(j = 0; j < ncl[i]+1; j++)
+ {
+ cellXY[j][kcl] = 0;