From c6770470bea6a1fac8dc4626cd63388ec061cb82 Mon Sep 17 00:00:00 2001 From: N-Plx Date: Tue, 18 Feb 2025 16:19:52 -0600 Subject: [PATCH] feat: adding index of cluster match to hit bank --- etc/bankdefs/hipo4/alert.json | 4 ++++ .../java/org/jlab/rec/atof/banks/RecoBankWriter.java | 1 + .../org/jlab/rec/atof/cluster/ClusterFinder.java | 12 ++++++++++-- .../src/main/java/org/jlab/rec/atof/hit/ATOFHit.java | 9 +++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/etc/bankdefs/hipo4/alert.json b/etc/bankdefs/hipo4/alert.json index 5701d1ac6..4f3d8b9f1 100644 --- a/etc/bankdefs/hipo4/alert.json +++ b/etc/bankdefs/hipo4/alert.json @@ -89,6 +89,10 @@ "name": "energy", "type": "F", "info": "deposited energy in MeV" + },{ + "name": "clusterid", + "type": "I", + "info": "id of cluster to which the hit was associated" } ] },{ diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/atof/banks/RecoBankWriter.java b/reconstruction/alert/src/main/java/org/jlab/rec/atof/banks/RecoBankWriter.java index b619956f7..6ffd59309 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/atof/banks/RecoBankWriter.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/atof/banks/RecoBankWriter.java @@ -43,6 +43,7 @@ public static DataBank fillATOFHitBank(DataEvent event, ArrayList wedge for (int i = 0; i < hitList.size(); i++) { bank.setShort("id", i, (short) (i + 1)); + bank.setInt("clusterid", i, (int) hitList.get(i).getAssociatedClusterIndex()); bank.setInt("sector", i, (int) hitList.get(i).getSector()); bank.setInt("layer", i, (int) hitList.get(i).getLayer()); bank.setInt("component", i, (int) hitList.get(i).getComponent()); diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/atof/cluster/ClusterFinder.java b/reconstruction/alert/src/main/java/org/jlab/rec/atof/cluster/ClusterFinder.java index 19cabb1f3..2444afec8 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/atof/cluster/ClusterFinder.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/atof/cluster/ClusterFinder.java @@ -57,11 +57,12 @@ public void makeClusters(DataEvent event, HitFinder hitfinder) { //A list of clusters is built for each event clusters.clear(); - + int cluster_id = 1; + //Getting the list of hits, they must have been ordered by energy already ArrayList wedge_hits = hitfinder.getWedgeHits(); ArrayList bar_hits = hitfinder.getBarHits(); - + //Looping through wedge hits first for (int i_wedge = 0; i_wedge < wedge_hits.size(); i_wedge++) { ATOFHit this_wedge_hit = wedge_hits.get(i_wedge); @@ -76,6 +77,7 @@ public void makeClusters(DataEvent event, HitFinder hitfinder) { //Indicate that this hit now is in a cluster this_wedge_hit.setIsInACluster(true); + this_wedge_hit.setAssociatedClusterIndex(cluster_id); //And store it this_cluster_wedge_hits.add(this_wedge_hit); @@ -105,6 +107,7 @@ public void makeClusters(DataEvent event, HitFinder hitfinder) { { if (delta_T < Parameters.SIGMA_T_CLUSTERING) { other_wedge_hit.setIsInACluster(true); + other_wedge_hit.setAssociatedClusterIndex(cluster_id); this_cluster_wedge_hits.add(other_wedge_hit); } } @@ -133,6 +136,7 @@ public void makeClusters(DataEvent event, HitFinder hitfinder) { if (delta_Z < Parameters.SIGMA_Z_CLUSTERING) { if (delta_T < Parameters.SIGMA_T_CLUSTERING) { other_bar_hit.setIsInACluster(true); + other_bar_hit.setAssociatedClusterIndex(cluster_id); this_cluster_bar_hits.add(other_bar_hit); } } @@ -143,6 +147,7 @@ public void makeClusters(DataEvent event, HitFinder hitfinder) { ATOFCluster cluster = new ATOFCluster(this_cluster_bar_hits, this_cluster_wedge_hits, event); //And add it to the list of clusters clusters.add(cluster); + cluster_id++; }//End loop on all wedge hits //Now make clusters from bar hits that are not associated with wedge hits //Loop through all bar hits @@ -156,6 +161,7 @@ public void makeClusters(DataEvent event, HitFinder hitfinder) { ArrayList this_cluster_wedge_hits = new ArrayList<>(); ArrayList this_cluster_bar_hits = new ArrayList<>(); this_bar_hit.setIsInACluster(true); + this_bar_hit.setAssociatedClusterIndex(cluster_id); this_cluster_bar_hits.add(this_bar_hit); //Loop through less energetic clusters @@ -182,6 +188,7 @@ public void makeClusters(DataEvent event, HitFinder hitfinder) { if (delta_Z < Parameters.SIGMA_Z_CLUSTERING) { if (delta_T < Parameters.SIGMA_T_CLUSTERING) { other_bar_hit.setIsInACluster(true); + other_bar_hit.setAssociatedClusterIndex(cluster_id); this_cluster_bar_hits.add(other_bar_hit); } } @@ -189,6 +196,7 @@ public void makeClusters(DataEvent event, HitFinder hitfinder) { } ATOFCluster cluster = new ATOFCluster(this_cluster_bar_hits, this_cluster_wedge_hits, event); clusters.add(cluster); + cluster_id++; } } diff --git a/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/ATOFHit.java b/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/ATOFHit.java index c0ffadd35..06e530d1d 100644 --- a/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/ATOFHit.java +++ b/reconstruction/alert/src/main/java/org/jlab/rec/atof/hit/ATOFHit.java @@ -20,6 +20,7 @@ public class ATOFHit { private double time, energy, x, y, z; private String type; private boolean isInACluster; + private int associatedClusterIndex; public int getSector() { return sector; @@ -124,6 +125,14 @@ public boolean getIsInACluster() { public void setIsInACluster(boolean is_in_a_cluster) { this.isInACluster = is_in_a_cluster; } + + public int getAssociatedClusterIndex() { + return associatedClusterIndex; + } + + public void setAssociatedClusterIndex(int index) { + this.associatedClusterIndex = index; + } /** * Computes the module index for the hit.