Iss 1297 by N-Plx · Pull Request #1304 · JeffersonLab/coatjava · GitHub
Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.jlab.rec.atof.hit;

import org.jlab.io.base.DataEvent;
import org.jlab.io.hipo.HipoDataSource;
import org.jlab.rec.atof.constants.Parameters;
import org.jlab.utils.groups.IndexedTable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ public void setWedgeHits(ArrayList<ATOFHit> wedge_hits) {
* @param event the {@link DataEvent} containing hits.
* @param atof the {@link Detector} representing the atof geometry to match
* the sector/layer/component to x/y/z.
* @param startTime the event start time
* @param atofTimeOffsetsTable the constant table with time offsets
* @param atofEffectiveVelocityTable the constant table with effective velocity
* @param Run the run number corresponding to the event for run-dependent slope correction
*/
public void findHits(DataEvent event, Detector atof, Float startTime,
IndexedTable atofTimeOffsetsTable,
IndexedTable atofEffectiveVelocityTable) {
IndexedTable atofEffectiveVelocityTable,
int Run) {
//For each event a list of bar hits and a list of wedge hits are filled
this.barHits.clear();
this.wedgeHits.clear();
Expand All @@ -92,7 +97,7 @@ public void findHits(DataEvent event, Detector atof, Float startTime,
int tot = bank.getInt("ToT", i);

//Building a Hit
ATOFHit hit = new ATOFHit(sector, layer, component, order, tdc, tot, startTime, atof, atofTimeOffsetsTable);
ATOFHit hit = new ATOFHit(sector, layer, component, order, tdc, tot, startTime, atof, atofTimeOffsetsTable, Run);
if (hit.getEnergy() < 0.01) {
continue; //energy threshold
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jlab.service.alert;

import ai.djl.repository.zoo.ZooModel;
import ai.djl.translate.TranslateException;
import java.io.File;
import java.util.ArrayList;
Expand Down Expand Up @@ -396,35 +395,33 @@ public boolean processDataEventUser(DataEvent event) {
continue;
}

ATOFHit hit_pred = new ATOFHit(sector_pred, layer_pred, wedge_pred, 0, 0, 0, 0f, ATOF, null);
ATOFHit hit_pred = new ATOFHit(sector_pred, layer_pred, wedge_pred, 0, 0, 0, 0f, ATOF, null, 0);
double pred_x = hit_pred.getX();
double pred_y = hit_pred.getY();
double pred_z = hit_pred.getZ();

double threshold = 20.0;
double minDistanceSquared = threshold * threshold;

ATOFHit matchAtofHit = null; // Could be used later
int matchHitId = -1;

for (int k = 0; k < bank_ATOFHits.rows(); k++) {
int component = bank_ATOFHits.getInt("component", k);
if (component == 10) continue;

int sector = bank_ATOFHits.getInt("sector", k);
int layer = bank_ATOFHits.getInt("layer", k);
double hitX = bank_ATOFHits.getFloat("x", k);
double hitY = bank_ATOFHits.getFloat("y", k);
double hitZ = bank_ATOFHits.getFloat("z", k);

ATOFHit hit = new ATOFHit(sector, layer, component, 0, 0, 0, 0f, ATOF, null);

double dx = pred_x - hit.getX();
double dy = pred_y - hit.getY();
double dz = pred_z - hit.getZ();
double dx = pred_x - hitX;
double dy = pred_y - hitY;
double dz = pred_z - hitZ;

double distanceSquared = dx * dx + dy * dy + dz * dz;

if (distanceSquared < minDistanceSquared) {
minDistanceSquared = distanceSquared;
matchAtofHit = hit;
//matchAtofHit = hit;
matchHitId = bank_ATOFHits.getInt("id", k);
}
}
Expand Down