|
3 | 3 | import ai.djl.translate.TranslateException; |
4 | 4 | import java.io.File; |
5 | 5 | import java.util.ArrayList; |
| 6 | +import java.util.Arrays; |
6 | 7 | import java.util.Collections; |
7 | 8 | import java.util.Iterator; |
8 | 9 | import java.util.concurrent.atomic.AtomicInteger; |
|
33 | 34 | import org.jlab.clas.pdg.PDGDatabase; |
34 | 35 | import org.jlab.clas.pdg.PDGParticle; |
35 | 36 | import java.util.logging.Logger; |
| 37 | +import org.jlab.rec.alert.constants.CalibrationConstantsLoader; |
36 | 38 |
|
37 | 39 |
|
38 | 40 |
|
@@ -112,6 +114,20 @@ public boolean init() { |
112 | 114 | //if (Objects.equals(this.getEngineConfigString("Mode"), Mode.AI_Track_Finding.name())) |
113 | 115 | // mode = Mode.AI_Track_Finding; |
114 | 116 | } |
| 117 | + |
| 118 | + // Requires calibration constants |
| 119 | + String[] alertTables = new String[] { |
| 120 | + "/calibration/alert/ahdc/time_offsets", |
| 121 | + "/calibration/alert/ahdc/time_to_distance", |
| 122 | + "/calibration/alert/ahdc/raw_hit_cuts", |
| 123 | + "/calibration/alert/atof/effective_velocity", |
| 124 | + "/calibration/alert/atof/time_walk", |
| 125 | + "/calibration/alert/atof/attenuation", |
| 126 | + "/calibration/alert/atof/time_offsets", |
| 127 | + "/calibration/alert/ahdc/gains", |
| 128 | + "/calibration/alert/ahdc/time_over_threshold" |
| 129 | + }; |
| 130 | + requireConstants(Arrays.asList(alertTables)); |
115 | 131 | return true; |
116 | 132 | } |
117 | 133 |
|
@@ -378,7 +394,13 @@ public boolean processDataEvent(DataEvent event) { |
378 | 394 | double time = hitBank.getDouble("time", hit_row); |
379 | 395 | double tot = hitBank.getDouble("timeOverThreshold", hit_row); |
380 | 396 | // warning : adc is the calibrated one, we need the adc for the Kalman filter ! |
381 | | - Hit hit = new Hit(id, superlayer, layer, wire, doca, adc, time); |
| 397 | + int sector = 1; // constant value |
| 398 | + int key_value = sector*10000 + (superlayer*10 + layer)*100 + wire; |
| 399 | + double raw_adc = adc; |
| 400 | + double[] adc_gain = CalibrationConstantsLoader.AHDC_ADC_GAINS.get(key_value); |
| 401 | + if (adc_gain != null) raw_adc = adc/adc_gain[0]; |
| 402 | + //System.out.println("adc : " + adc + " raw_adc : " + raw_adc); |
| 403 | + Hit hit = new Hit(id, superlayer, layer, wire, doca, raw_adc, time); |
382 | 404 | hit.setWirePosition(AHDC); |
383 | 405 | hit.setTrackId(trackid); |
384 | 406 | hit.setADC(adc); |
|
0 commit comments