diff --git a/slsDetectorCalibration/singlePhotonDetector.h b/slsDetectorCalibration/singlePhotonDetector.h index 083e25f7b..96d239c97 100644 --- a/slsDetectorCalibration/singlePhotonDetector.h +++ b/slsDetectorCalibration/singlePhotonDetector.h @@ -429,23 +429,28 @@ class singlePhotonDetector : public analogDetector { for (ic = -(clusterSize / 2); ic < (clusterSize / 2) + 1; ic++) { - if ((iy + ir) >= iy && (iy + ir) < ny && - (ix + ic) >= ix && (ix + ic) < nx) { + if ((iy + ir) >= 0 && (iy + ir) < ny && + (ix + ic) >= 0 && (ix + ic) < nx) { + + + if ((iy + ir) >= iy && (ix + ic) >= ix ) { val[(iy + ir) * nx + ix + ic] = subtractPedestal(data, ix + ic, iy + ir, cm); - v = &(val[(iy + ir) * nx + ix + ic]); - tot += *v; - if (ir <= 0 && ic <= 0) - bl += *v; - if (ir <= 0 && ic >= 0) - br += *v; - if (ir >= 0 && ic <= 0) - tl += *v; - if (ir >= 0 && ic >= 0) - tr += *v; - if (*v > max) { - max = *v; - } + + } + v = &(val[(iy + ir) * nx + ix + ic]); + tot += *v; + if (ir <= 0 && ic <= 0) + bl += *v; + if (ir <= 0 && ic >= 0) + br += *v; + if (ir >= 0 && ic <= 0) + tl += *v; + if (ir >= 0 && ic >= 0) + tr += *v; + if (*v > max) //{ + max = *v; + //} } } } @@ -513,12 +518,19 @@ class singlePhotonDetector : public analogDetector { for (ic = -(clusterSize / 2); ic < (clusterSize / 2) + 1; ic++) { if ((iy + ir) >= 0 && (iy + ir) < ny && - (ix + ic) >= 0 && (ix + ic) < nx) - (clusters + nph) + (ix + ic) >= 0 && (ix + ic) < nx) { + (clusters + nph) ->set_data(val[(iy + ir) * nx + ix + ic], ic, ir); + if (val[(iy + ir) * nx + ix + ic]>max) + good=0; + } } } + if (good==0) { + (clusters + nph)->print(); + cout << max << " " << val[iy * nx + ix] << endl; + } good = 1; if (eMin > 0 && tot < eMin) good = 0; diff --git a/slsDetectorCalibration/single_photon_hit.h b/slsDetectorCalibration/single_photon_hit.h index 919f6af4b..0317e6e4d 100644 --- a/slsDetectorCalibration/single_photon_hit.h +++ b/slsDetectorCalibration/single_photon_hit.h @@ -216,14 +216,18 @@ class single_photon_hit { // int ix, iy; + printf("***************\n"); + printf("** %d %d **\n",x,y); for (int iy = 0; iy < dy; iy++) { for (int ix = 0; ix < dx; ix++) { printf("%d \t", data[ix + iy * dx]); } printf("\n"); } + printf("***************\n"); } + /** assign the value to the element of the cluster matrix, with relative coordinates where the center of the cluster is (0,0) \param v value to be