+ } //det
+ }//event loop
+
+ // Mean and Sigma Calculations
+ for(Int_t idet=0; idet < kDet; idet++){
+ for(Int_t ismn = 0; ismn < kMaxSMN; ismn++){
+ for(Int_t irow = 0; irow < kMaxRow; irow++){
+ for(Int_t icol = 0; icol < kMaxCol; icol++){
+ if(nhitcell[idet][ismn][irow][icol]>0){
+ count[idet][ismn] += 1;
+ tempnhit1[idet][ismn] += nhitcell[idet][ismn][irow][icol];
+ tempnhit2[idet][ismn] += nhitcell[idet][ismn][irow][icol]
+ *nhitcell[idet][ismn][irow][icol];
+ }
+ }
+ }
+ }
+ }//det loop
+
+ //cout<<"nhit cell = "<<idet<<" "<<ismn<<" "
+ // <<irow<<" "<<icol<<" "<<nhitcell[idet][ismn][irow][icol]<<endl;
+ //count[idet][ismn] += 1;
+
+ for(Int_t i=0; i < kDet; i++)
+ {
+ for(Int_t j=0; j < kMaxSMN; j++)
+ {
+ if(count[i][j] > 0.)
+ {
+ meannhit[i][j] = tempnhit1[i][j]/count[i][j];
+ meanSqnhit[i][j] = tempnhit2[i][j]/count[i][j];
+ sigmanhit[i][j] = sqrt(meanSqnhit[i][j]-
+ (meannhit[i][j]*meannhit[i][j]));
+ nhitcut[i][j] = 3*sigmanhit[i][j] + meannhit[i][j];
+ }
+ }