Skip to content

Commit

Permalink
feat: ignoring double barhits
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Plx committed Feb 25, 2025
1 parent cd9acdc commit dc3ed34
Showing 1 changed file with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

/**
* The {@code HitFinder} class finds hits in the atof.
*
*
* <p>
* Uses atof tdc bank information
*
* Creates a {@link ArrayList} of {@link BarHit} for bar hits read.
* Creates a {@link ArrayList} of {@link ATOFHit} for wedge hits read.
*
* Uses atof tdc bank information
*
* Creates a {@link ArrayList} of {@link BarHit} for bar hits read. Creates a
* {@link ArrayList} of {@link ATOFHit} for wedge hits read.
*
* </p>
*
* @author pilleux
Expand All @@ -31,8 +31,7 @@ public class HitFinder {
private ArrayList<ATOFHit> wedgeHits;

/**
* Default constructor that initializes the list of hits as new empty
* lists.
* Default constructor that initializes the list of hits as new empty lists.
*/
public HitFinder() {
this.barHits = new ArrayList<>();
Expand All @@ -57,8 +56,8 @@ public void setWedgeHits(ArrayList<ATOFHit> wedge_hits) {
}

/**
* Find hits in the event, matches them to tracks found in the ahdc
* and build their properties.
* Find hits in the event, matches them to tracks found in the ahdc and
* build their properties.
*
* @param event the {@link DataEvent} containing hits.
* @param atof the {@link Detector} representing the atof geometry to match
Expand All @@ -74,6 +73,7 @@ public void findHits(DataEvent event, Detector atof) {
//Hits in the bar downstream and upstream will be matched
ArrayList<ATOFHit> hit_up = new ArrayList<>();
ArrayList<ATOFHit> hit_down = new ArrayList<>();

//Looping through all hits
for (int i = 0; i < nt; i++) {
//Getting their properties
Expand All @@ -83,11 +83,13 @@ public void findHits(DataEvent event, Detector atof) {
int order = bank.getInt("order", i);
int tdc = bank.getInt("TDC", i);
int tot = bank.getInt("ToT", i);

//Building a Hit
ATOFHit hit = new ATOFHit(sector, layer, component, order, tdc, tot, atof);
if (hit.getEnergy() < 0.01) {
continue; //energy threshold
}

//Sorting the hits into wedge, upstream and downstream bar hits
//Lists are built for up/down bar to match them after
//Wedge hits are mayched to ahdc tracks and listed
Expand All @@ -111,14 +113,21 @@ public void findHits(DataEvent event, Detector atof) {
//Starting loop through up hits in the bar
for (int i_up = 0; i_up < hit_up.size(); i_up++) {
ATOFHit this_hit_up = hit_up.get(i_up);
int countMatches = 0;
//Starting loop through down hits in the bar
for (int i_down = 0; i_down < hit_down.size(); i_down++) {
ATOFHit this_hit_down = hit_down.get(i_down);
//Matching the hits: if same module and different order, they make up a bar hit
if (this_hit_up.matchBar(this_hit_down)) {
//Bar hits are matched to ahdc tracks and listed
BarHit this_bar_hit = new BarHit(this_hit_up, this_hit_down);
if (countMatches > 0) {
//If the up hit was already involved in a match, do not make an additionnal match
//Chosing to ignore double matches for now because it happened for <1% of events in cosmic runs
continue;
}
BarHit this_bar_hit = new BarHit(this_hit_down, this_hit_up);
this.barHits.add(this_bar_hit);
countMatches++;
}
}
}
Expand Down

0 comments on commit dc3ed34

Please sign in to comment.