mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-04-29 18:00:02 +02:00
generalized FindCluster to read in general cluster sizes - assuming that finding cluster center is equal for all clusters
This commit is contained in:
parent
04728929cb
commit
240960d3e7
@ -67,7 +67,7 @@ Eta2 calculate_eta2(
|
|||||||
size_t index_bottom_left_max_2x2_subcluster =
|
size_t index_bottom_left_max_2x2_subcluster =
|
||||||
(int(c / (ClusterSizeX - 1))) * ClusterSizeX + c % (ClusterSizeX - 1);
|
(int(c / (ClusterSizeX - 1))) * ClusterSizeX + c % (ClusterSizeX - 1);
|
||||||
|
|
||||||
if ((cl.data[index_bottom_left_max_2x2_subcluster] +
|
if ((cl.data[index_bottom_left_max_2x2_subcluster] +s
|
||||||
cl.data[index_bottom_left_max_2x2_subcluster + 1]) != 0)
|
cl.data[index_bottom_left_max_2x2_subcluster + 1]) != 0)
|
||||||
eta.x = static_cast<double>(
|
eta.x = static_cast<double>(
|
||||||
cl.data[index_bottom_left_max_2x2_subcluster + 1]) /
|
cl.data[index_bottom_left_max_2x2_subcluster + 1]) /
|
||||||
|
@ -70,6 +70,12 @@ class ClusterFinder {
|
|||||||
// // 4,4 -> +/- 2
|
// // 4,4 -> +/- 2
|
||||||
int dy = ClusterSizeY / 2;
|
int dy = ClusterSizeY / 2;
|
||||||
int dx = ClusterSizeX / 2;
|
int dx = ClusterSizeX / 2;
|
||||||
|
int has_center_pixel_x =
|
||||||
|
ClusterSizeX %
|
||||||
|
2; // for even sized clusters there is no proper cluster center and
|
||||||
|
// even amount of pixels around the center
|
||||||
|
int has_center_pixel_y = ClusterSizeY % 2;
|
||||||
|
|
||||||
m_clusters.set_frame_number(frame_number);
|
m_clusters.set_frame_number(frame_number);
|
||||||
std::vector<CT> cluster_data(ClusterSizeX * ClusterSizeY);
|
std::vector<CT> cluster_data(ClusterSizeX * ClusterSizeY);
|
||||||
for (int iy = 0; iy < frame.shape(0); iy++) {
|
for (int iy = 0; iy < frame.shape(0); iy++) {
|
||||||
@ -86,8 +92,8 @@ class ClusterFinder {
|
|||||||
continue; // NEGATIVE_PEDESTAL go to next pixel
|
continue; // NEGATIVE_PEDESTAL go to next pixel
|
||||||
// TODO! No pedestal update???
|
// TODO! No pedestal update???
|
||||||
|
|
||||||
for (int ir = -dy; ir < dy + 1; ir++) {
|
for (int ir = -dy; ir < dy + has_center_pixel_y; ir++) {
|
||||||
for (int ic = -dx; ic < dx + 1; ic++) {
|
for (int ic = -dx; ic < dx + has_center_pixel_x; ic++) {
|
||||||
if (ix + ic >= 0 && ix + ic < frame.shape(1) &&
|
if (ix + ic >= 0 && ix + ic < frame.shape(1) &&
|
||||||
iy + ir >= 0 && iy + ir < frame.shape(0)) {
|
iy + ir >= 0 && iy + ir < frame.shape(0)) {
|
||||||
PEDESTAL_TYPE val =
|
PEDESTAL_TYPE val =
|
||||||
@ -125,8 +131,8 @@ class ClusterFinder {
|
|||||||
// It's worth redoing the look since most of the time we
|
// It's worth redoing the look since most of the time we
|
||||||
// don't have a photon
|
// don't have a photon
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (int ir = -dy; ir < dy + 1; ir++) {
|
for (int ir = -dy; ir < dy + has_center_pixel_y; ir++) {
|
||||||
for (int ic = -dx; ic < dx + 1; ic++) {
|
for (int ic = -dx; ic < dx + has_center_pixel_y; ic++) {
|
||||||
if (ix + ic >= 0 && ix + ic < frame.shape(1) &&
|
if (ix + ic >= 0 && ix + ic < frame.shape(1) &&
|
||||||
iy + ir >= 0 && iy + ir < frame.shape(0)) {
|
iy + ir >= 0 && iy + ir < frame.shape(0)) {
|
||||||
CT tmp =
|
CT tmp =
|
||||||
@ -140,11 +146,6 @@ class ClusterFinder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the cluster to the output ClusterVector
|
// Add the cluster to the output ClusterVector
|
||||||
/*
|
|
||||||
m_clusters.push_back(
|
|
||||||
ix, iy,
|
|
||||||
reinterpret_cast<std::byte *>(cluster_data.data()));
|
|
||||||
*/
|
|
||||||
m_clusters.push_back(
|
m_clusters.push_back(
|
||||||
Cluster<CT, ClusterSizeX, ClusterSizeY>{
|
Cluster<CT, ClusterSizeX, ClusterSizeY>{
|
||||||
ix, iy, cluster_data.data()});
|
ix, iy, cluster_data.data()});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user