Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding index of cluster match to hit bank #478

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions etc/bankdefs/hipo4/alert.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
},{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static DataBank fillATOFHitBank(DataEvent event, ArrayList<ATOFHit> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ATOFHit> wedge_hits = hitfinder.getWedgeHits();
ArrayList<BarHit> 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);
Expand All @@ -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);

Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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
Expand All @@ -156,6 +161,7 @@ public void makeClusters(DataEvent event, HitFinder hitfinder) {
ArrayList<ATOFHit> this_cluster_wedge_hits = new ArrayList<>();
ArrayList<BarHit> 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
Expand All @@ -182,13 +188,15 @@ 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);
}
}
}
}
ATOFCluster cluster = new ATOFCluster(this_cluster_bar_hits, this_cluster_wedge_hits, event);
clusters.add(cluster);
cluster_id++;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down