fixing merging problems
This commit is contained in:
parent
9bae601e95
commit
f2691e6f28
@ -17,7 +17,7 @@ emax=30
|
|||||||
ecutmin=8
|
ecutmin=8
|
||||||
ecutmax=12
|
ecutmax=12
|
||||||
etabins=251
|
etabins=251
|
||||||
csize=3
|
csize=2
|
||||||
gain=150
|
gain=150
|
||||||
nbins=100
|
nbins=100
|
||||||
indmin=1
|
indmin=1
|
||||||
|
@ -95,7 +95,6 @@ static PyObject *ClusterFileReader_read(ClusterFileReader *self,
|
|||||||
npy_intp dims[] = {size};
|
npy_intp dims[] = {size};
|
||||||
|
|
||||||
// If possible numpy will
|
// If possible numpy will
|
||||||
>>>>>>> e1f22fd014eb86d40e0ecb78bd65cb7a9bef71bc
|
|
||||||
// use the underlying buffer, otherwise it will create a copy, for example
|
// use the underlying buffer, otherwise it will create a copy, for example
|
||||||
// if data type is different or we pass in a list. The
|
// if data type is different or we pass in a list. The
|
||||||
// NPY_ARRAY_C_CONTIGUOUS flag ensures that we have contiguous memory.
|
// NPY_ARRAY_C_CONTIGUOUS flag ensures that we have contiguous memory.
|
||||||
|
@ -58,34 +58,6 @@ int read_clusters_with_cut(FILE *fp, int64_t n_clusters, Cluster *buf,
|
|||||||
double noise;
|
double noise;
|
||||||
// read photons left from previous frame
|
// read photons left from previous frame
|
||||||
if (nph) {
|
if (nph) {
|
||||||
<<<<<<< HEAD
|
|
||||||
for (int iph=0; iph<nph; iph++) {
|
|
||||||
// read photons 1 by 1
|
|
||||||
fread((void *)(ptr), sizeof(Cluster), 1, fp);
|
|
||||||
good=1;
|
|
||||||
if (noise_map) {
|
|
||||||
if (ptr->x>=0 && ptr->x<nx && ptr->y>=0 && ptr->y<ny) {
|
|
||||||
tot1=ptr->data[4];
|
|
||||||
analyze_cluster(*ptr, &t2max, &tot3, NULL, NULL, NULL, NULL, NULL);
|
|
||||||
noise=noise_map[ptr->y*nx+ptr->x];
|
|
||||||
if (tot1>noise && t2max>2*noise && tot3>3*noise) {
|
|
||||||
;
|
|
||||||
} else
|
|
||||||
good=0;
|
|
||||||
} else {
|
|
||||||
printf("Bad pixel number %d %d\n",ptr->x,ptr->y);
|
|
||||||
good=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (good) {
|
|
||||||
ptr++;
|
|
||||||
nph_read++;
|
|
||||||
(*n_left)--;
|
|
||||||
}
|
|
||||||
if (nph_read >= n_clusters)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
for (int iph = 0; iph < nph; iph++) {
|
for (int iph = 0; iph < nph; iph++) {
|
||||||
// read photons 1 by 1
|
// read photons 1 by 1
|
||||||
fread((void *)(ptr), sizeof(Cluster), 1, fp);
|
fread((void *)(ptr), sizeof(Cluster), 1, fp);
|
||||||
@ -94,7 +66,7 @@ int read_clusters_with_cut(FILE *fp, int64_t n_clusters, Cluster *buf,
|
|||||||
if (ptr->x >= 0 && ptr->x < nx && ptr->y >= 0 && ptr->y < ny) {
|
if (ptr->x >= 0 && ptr->x < nx && ptr->y >= 0 && ptr->y < ny) {
|
||||||
tot1 = ptr->data[4];
|
tot1 = ptr->data[4];
|
||||||
analyze_cluster(*ptr, &t2max, &tot3, NULL, NULL, NULL, NULL,
|
analyze_cluster(*ptr, &t2max, &tot3, NULL, NULL, NULL, NULL,
|
||||||
NULL, NULL, NULL, NULL, NULL);
|
NULL);
|
||||||
noise = noise_map[ptr->y * nx + ptr->x];
|
noise = noise_map[ptr->y * nx + ptr->x];
|
||||||
if (tot1 > noise && t2max > 2 * noise && tot3 > 3 * noise) {
|
if (tot1 > noise && t2max > 2 * noise && tot3 > 3 * noise) {
|
||||||
;
|
;
|
||||||
@ -113,13 +85,11 @@ int read_clusters_with_cut(FILE *fp, int64_t n_clusters, Cluster *buf,
|
|||||||
if (nph_read >= n_clusters)
|
if (nph_read >= n_clusters)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
>>>>>>> e1f22fd014eb86d40e0ecb78bd65cb7a9bef71bc
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nph_read < n_clusters) {
|
if (nph_read < n_clusters) {
|
||||||
// keep on reading frames and photons until reaching n_clusters
|
// keep on reading frames and photons until reaching n_clusters
|
||||||
while (fread(&iframe, sizeof(iframe), 1, fp)) {
|
while (fread(&iframe, sizeof(iframe), 1, fp)) {
|
||||||
<<<<<<< HEAD
|
|
||||||
//printf("%d\n",nph_read);
|
//printf("%d\n",nph_read);
|
||||||
|
|
||||||
if (fread(&nph, sizeof(nph), 1, fp)) {
|
if (fread(&nph, sizeof(nph), 1, fp)) {
|
||||||
@ -157,55 +127,12 @@ int read_clusters_with_cut(FILE *fp, int64_t n_clusters, Cluster *buf,
|
|||||||
if (nph_read >= n_clusters)
|
if (nph_read >= n_clusters)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
=======
|
|
||||||
// printf("%d\n",nph_read);
|
|
||||||
|
|
||||||
if (fread(&nph, sizeof(nph), 1, fp)) {
|
|
||||||
// printf("** %d\n",nph);
|
|
||||||
*n_left = nph;
|
|
||||||
for (int iph = 0; iph < nph; iph++) {
|
|
||||||
// read photons 1 by 1
|
|
||||||
fread((void *)(ptr), sizeof(Cluster), 1, fp);
|
|
||||||
good = 1;
|
|
||||||
if (noise_map) {
|
|
||||||
if (ptr->x >= 0 && ptr->x < nx && ptr->y >= 0 &&
|
|
||||||
ptr->y < ny) {
|
|
||||||
tot1 = ptr->data[4];
|
|
||||||
analyze_cluster(*ptr, &t2max, &tot3, NULL, NULL,
|
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
|
||||||
NULL);
|
|
||||||
noise = noise_map[ptr->y * nx + ptr->x];
|
|
||||||
if (tot1 > noise && t2max > 2 * noise &&
|
|
||||||
tot3 > 3 * noise) {
|
|
||||||
;
|
|
||||||
} else
|
|
||||||
good = 0;
|
|
||||||
} else {
|
|
||||||
printf("Bad pixel number %d %d\n", ptr->x, ptr->y);
|
|
||||||
good = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (good) {
|
|
||||||
ptr++;
|
|
||||||
nph_read++;
|
|
||||||
(*n_left)--;
|
|
||||||
}
|
|
||||||
if (nph_read >= n_clusters)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nph_read >= n_clusters)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
>>>>>>> e1f22fd014eb86d40e0ecb78bd65cb7a9bef71bc
|
|
||||||
}
|
}
|
||||||
// printf("%d\n",nph_read);
|
// printf("%d\n",nph_read);
|
||||||
assert(nph_read <= n_clusters); // sanity check in debug mode
|
assert(nph_read <= n_clusters); // sanity check in debug mode
|
||||||
return nph_read;
|
return nph_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -213,9 +140,6 @@ int read_clusters_with_cut(FILE *fp, int64_t n_clusters, Cluster *buf,
|
|||||||
|
|
||||||
|
|
||||||
int analyze_clusters(int64_t n_clusters, int32_t *cin, ClusterAnalysis *co, int csize) {
|
int analyze_clusters(int64_t n_clusters, int32_t *cin, ClusterAnalysis *co, int csize) {
|
||||||
=======
|
|
||||||
int analyze_clusters(int64_t n_clusters, Cluster *cin, ClusterAnalysis *cout) {
|
|
||||||
>>>>>>> e1f22fd014eb86d40e0ecb78bd65cb7a9bef71bc
|
|
||||||
|
|
||||||
int32_t tot2[4], t2max;
|
int32_t tot2[4], t2max;
|
||||||
char quad;
|
char quad;
|
||||||
@ -225,8 +149,6 @@ int analyze_clusters(int64_t n_clusters, Cluster *cin, ClusterAnalysis *cout) {
|
|||||||
//printf("csize is %d\n",csize);
|
//printf("csize is %d\n",csize);
|
||||||
int ret;
|
int ret;
|
||||||
for (int ic = 0; ic < n_clusters; ic++) {
|
for (int ic = 0; ic < n_clusters; ic++) {
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
switch (csize) {
|
switch (csize) {
|
||||||
case 2:
|
case 2:
|
||||||
ret=analyze_data((cin+9*ic), &tot, NULL, &quad, &etax,&etay, NULL, NULL);
|
ret=analyze_data((cin+9*ic), &tot, NULL, &quad, &etax,&etay, NULL, NULL);
|
||||||
@ -248,22 +170,11 @@ int analyze_clusters(int64_t n_clusters, Cluster *cin, ClusterAnalysis *cout) {
|
|||||||
/* if (tot<=0) */
|
/* if (tot<=0) */
|
||||||
/* printf("%d %d %d %d %d %d\n",ic,(cin+ic)->x, (cin+ic)->y, */
|
/* printf("%d %d %d %d %d %d\n",ic,(cin+ic)->x, (cin+ic)->y, */
|
||||||
/* (cout+ic)->c, (cout+ic)->tot2, (cout+ic)->tot3); */
|
/* (cout+ic)->c, (cout+ic)->tot2, (cout+ic)->tot3); */
|
||||||
=======
|
|
||||||
|
|
||||||
analyze_cluster(*(cin + ic), &t2max, &tot3, &quad, NULL, NULL, NULL,
|
|
||||||
NULL, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
(cout + ic)->c = quad;
|
|
||||||
(cout + ic)->tot2 = t2max;
|
|
||||||
(cout + ic)->tot3 = tot3;
|
|
||||||
// printf("%d %d %d %d %d %d\n",ic,(cin+ic)->x, (cin+ic)->y,
|
|
||||||
// (cout+ic)->c, (cout+ic)->tot2, (cout+ic)->tot3);
|
|
||||||
>>>>>>> e1f22fd014eb86d40e0ecb78bd65cb7a9bef71bc
|
|
||||||
}
|
}
|
||||||
return nc;
|
return nc;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
int analyze_cluster(Cluster cl, int32_t *t2, int32_t *t3, char *quad, double *eta2x, double *eta2y, double *eta3x, double *eta3y) {
|
int analyze_cluster(Cluster cl, int32_t *t2, int32_t *t3, char *quad, double *eta2x, double *eta2y, double *eta3x, double *eta3y) {
|
||||||
|
|
||||||
return analyze_data(cl.data, t2, t3, quad, eta2x, eta2y, eta3x, eta3y);
|
return analyze_data(cl.data, t2, t3, quad, eta2x, eta2y, eta3x, eta3y);
|
||||||
@ -274,14 +185,6 @@ int analyze_data(int32_t *data, int32_t *t2, int32_t *t3, char *quad, double *et
|
|||||||
|
|
||||||
|
|
||||||
int ok=1;
|
int ok=1;
|
||||||
=======
|
|
||||||
int analyze_cluster(Cluster cin, int32_t *t2, int32_t *t3, char *quad,
|
|
||||||
double *eta2x, double *eta2y, double *eta3x, double *eta3y,
|
|
||||||
double *eta2Lx, double *eta2Ly, double *eta3Xx,
|
|
||||||
double *eta3Xy) {
|
|
||||||
|
|
||||||
int ok = 1;
|
|
||||||
>>>>>>> e1f22fd014eb86d40e0ecb78bd65cb7a9bef71bc
|
|
||||||
|
|
||||||
int32_t tot2[4], t2max;
|
int32_t tot2[4], t2max;
|
||||||
char c;
|
char c;
|
||||||
@ -292,7 +195,7 @@ int analyze_cluster(Cluster cin, int32_t *t2, int32_t *t3, char *quad,
|
|||||||
tot2[i] = 0;
|
tot2[i] = 0;
|
||||||
// t2max=0;
|
// t2max=0;
|
||||||
for (int ix = 0; ix < 3; ix++) {
|
for (int ix = 0; ix < 3; ix++) {
|
||||||
<<<<<<< HEAD
|
|
||||||
for (int iy = 0; iy < 3; iy++) {
|
for (int iy = 0; iy < 3; iy++) {
|
||||||
val = data[iy * 3 + ix];
|
val = data[iy * 3 + ix];
|
||||||
// printf ("%d ",data[iy * 3 + ix]);
|
// printf ("%d ",data[iy * 3 + ix]);
|
||||||
@ -307,34 +210,12 @@ int analyze_cluster(Cluster cin, int32_t *t2, int32_t *t3, char *quad,
|
|||||||
tot2[cTopRight] += val;
|
tot2[cTopRight] += val;
|
||||||
}
|
}
|
||||||
// printf ("\n");
|
// printf ("\n");
|
||||||
=======
|
|
||||||
for (int iy = 0; iy < 3; iy++) {
|
|
||||||
val = cin.data[iy * 3 + ix];
|
|
||||||
tot3 += val;
|
|
||||||
if (ix <= 1 && iy <= 1)
|
|
||||||
tot2[0] += val;
|
|
||||||
if (ix >= 1 && iy <= 1)
|
|
||||||
tot2[1] += val;
|
|
||||||
if (ix <= 1 && iy >= 1)
|
|
||||||
tot2[2] += val;
|
|
||||||
if (ix >= 1 && iy >= 1)
|
|
||||||
tot2[3] += val;
|
|
||||||
}
|
|
||||||
>>>>>>> e1f22fd014eb86d40e0ecb78bd65cb7a9bef71bc
|
|
||||||
}
|
}
|
||||||
//printf ("\n");
|
//printf ("\n");
|
||||||
|
|
||||||
if (t2 || quad) {
|
if (t2 || quad) {
|
||||||
<<<<<<< HEAD
|
|
||||||
t2max = -1000;
|
|
||||||
c = 0;
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
if (tot2[i] > t2max) {
|
|
||||||
t2max = tot2[i];
|
|
||||||
c = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
t2max = tot2[0];
|
t2max = tot2[0];
|
||||||
c = cBottomLeft;
|
c = cBottomLeft;
|
||||||
for (int i = 1; i < 4; i++) {
|
for (int i = 1; i < 4; i++) {
|
||||||
@ -343,14 +224,13 @@ int analyze_cluster(Cluster cin, int32_t *t2, int32_t *t3, char *quad,
|
|||||||
c = i;
|
c = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>>>>>>> e1f22fd014eb86d40e0ecb78bd65cb7a9bef71bc
|
|
||||||
}
|
|
||||||
if (quad)
|
if (quad)
|
||||||
*quad = c;
|
*quad = c;
|
||||||
if (t2)
|
if (t2)
|
||||||
*t2 = t2max;
|
*t2 = t2max;
|
||||||
|
}
|
||||||
if (t3)
|
if (t3)
|
||||||
<<<<<<< HEAD
|
|
||||||
*t3 = tot3;
|
*t3 = tot3;
|
||||||
|
|
||||||
if (eta2x || eta2y) {
|
if (eta2x || eta2y) {
|
||||||
@ -395,22 +275,6 @@ int analyze_cluster(Cluster cin, int32_t *t2, int32_t *t3, char *quad,
|
|||||||
*eta3y=(double)(-data[1]+data[2*3+1])/(data[1]+data[4]+data[7]);
|
*eta3y=(double)(-data[1]+data[2*3+1])/(data[1]+data[4]+data[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (tot3<=0) { */
|
|
||||||
/* printf("*"); // t2max=0; */
|
|
||||||
/* for (int ix = 0; ix < 3; ix++) { */
|
|
||||||
/* for (int iy = 0; iy < 3; iy++) { */
|
|
||||||
/* printf ("%d ",data[iy * 3 + ix]); */
|
|
||||||
/* } */
|
|
||||||
/* printf ("\n"); */
|
|
||||||
/* } */
|
|
||||||
/* printf ("\n"); */
|
|
||||||
/* //return 0; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
|
|
||||||
=======
|
|
||||||
*t3 = tot3;
|
|
||||||
>>>>>>> e1f22fd014eb86d40e0ecb78bd65cb7a9bef71bc
|
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user