From 9d01cff0638344b53784b9831e68da3526bdbd0c Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Fri, 22 May 2026 22:46:33 -0400 Subject: [PATCH 1/3] make local variable final for clarity --- .../rec/dc/cluster/ClusterCleanerUtilities.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java index b93809da55..8bfbd8542d 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java @@ -74,18 +74,18 @@ public List ClusterSplitter(FittedCluster clus, int nextClsStartI /// determined. /// This is a preliminary pattern recognition method used to identify /// reconstructed hits belonging to the same track-segment. - int N_t = 180; + final int N_t = 180; // From this calculate the bin size in the theta accumulator array - double ThetaMin = 0.; - double ThetaMax = 2. * Math.PI; - double SizeThetaBin = (ThetaMax - ThetaMin) / ((double) N_t); + final double ThetaMin = 0.; + final double ThetaMax = 2. * Math.PI; + final double SizeThetaBin = (ThetaMax - ThetaMin) / ((double) N_t); // Define the dimension of the r accumulator array - int N_r = 130; + final int N_r = 130; // From this calculate the bin size in the theta accumulator array - double RMin = -130; - double RMax = 130; + final double RMin = -130; + final double RMax = 130; int[][] R_Phi_Accumul; R_Phi_Accumul = new int[N_r][N_t]; From ec2c9366cd5c71a33a559d9dba027b989206ff67 Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Fri, 22 May 2026 22:48:38 -0400 Subject: [PATCH 2/3] cleanup initialization --- .../rec/dc/cluster/ClusterCleanerUtilities.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java index 8bfbd8542d..45950cd4ec 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java @@ -87,21 +87,15 @@ public List ClusterSplitter(FittedCluster clus, int nextClsStartI final double RMin = -130; final double RMax = 130; - int[][] R_Phi_Accumul; - R_Phi_Accumul = new int[N_r][N_t]; + int[][] R_Phi_Accumul = new int[N_r][N_t]; // cache the cos and sin theta values [for performance improvement] - double[] cosTheta_RPhi_array; - double[] sinTheta_RPhi_array; + double[] cosTheta_RPhi_array = new double[N_t]; + double[] sinTheta_RPhi_array = new double[N_t]; // the values corresponding to the peaks in the array - double[] binrMaxR_Phi; - double[] bintMaxR_Phi; - binrMaxR_Phi = new double[N_r * N_t]; - bintMaxR_Phi = new double[N_r * N_t]; - - cosTheta_RPhi_array = new double[N_t]; - sinTheta_RPhi_array = new double[N_t]; + double[] binrMaxR_Phi = new double[N_r * N_t]; + double[] bintMaxR_Phi = new double[N_r * N_t]; for (int j_t = 0; j_t < N_t; j_t++) { // theta_j in the middle of the bin : From e0bdeb028f639f78a6c47a525e9961448c0145ba Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Fri, 22 May 2026 22:50:35 -0400 Subject: [PATCH 3/3] reduce calculations --- .../org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java b/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java index 45950cd4ec..e82f9a1414 100644 --- a/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java +++ b/reconstruction/dc/src/main/java/org/jlab/rec/dc/cluster/ClusterCleanerUtilities.java @@ -86,6 +86,7 @@ public List ClusterSplitter(FittedCluster clus, int nextClsStartI // From this calculate the bin size in the theta accumulator array final double RMin = -130; final double RMax = 130; + final double dR = RMax - RMin; int[][] R_Phi_Accumul = new int[N_r][N_t]; @@ -117,7 +118,7 @@ public List ClusterSplitter(FittedCluster clus, int nextClsStartI // r_j corresponding to that theta_j: double r_j = rho * cosTheta_RPhi_array[j_t] + phi * sinTheta_RPhi_array[j_t]; // this value of r_j falls into the following bin in the r array: - int j_r = (int) Math.floor(N_r * (r_j - RMin) / (float) (RMax - RMin)); + int j_r = (int) Math.floor(N_r * (r_j - RMin) / dR); // increase this accumulator cell: R_Phi_Accumul[j_r][j_t]++; @@ -171,7 +172,7 @@ public List ClusterSplitter(FittedCluster clus, int nextClsStartI // r_j corresponding to that theta_j: double r_j = rho * cosTheta_RPhi_array[j_t] + phi * sinTheta_RPhi_array[j_t]; // this value of r_j falls into the following bin in the r array: - int j_r = (int) Math.floor(N_r * (r_j - RMin) / (float) (RMax - RMin)); + int j_r = (int) Math.floor(N_r * (r_j - RMin) / dR); // match bins: if (j_r == binrMaxR_Phi[p] && j_t == bintMaxR_Phi[p]) {