Skip to content

Commit 3f33269

Browse files
feat: load ahdcAdcGains table in ALERTEngine
Register /calibration/alert/ahdc/gains in ALERTEngine's init() and refresh the IndexedTable reference on run change, so it is available for downstream use. Requested by @ftouchte for an upcoming pull request.
1 parent c1eacc4 commit 3f33269

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

reconstruction/alert/src/main/java/org/jlab/service/alert/ALERTEngine.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
import java.util.ArrayList;
77
import java.util.concurrent.atomic.AtomicInteger;
88

9+
import java.util.HashMap;
10+
import java.util.Map;
11+
912
import org.jlab.clas.reco.ReconstructionEngine;
1013
import org.jlab.clas.swimtools.Swim;
1114
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
15+
import org.jlab.utils.groups.IndexedTable;
1216
import org.jlab.geom.base.Detector;
1317
import org.jlab.geom.detector.alert.ATOF.AlertTOFFactory;
1418
import org.jlab.io.base.DataBank;
@@ -71,6 +75,9 @@ public class ALERTEngine extends ReconstructionEngine {
7175
private ModelTrackMatching modelTrackMatching;
7276
private ModelPrePID modelPrePID;
7377

78+
// AHDC calibration table (refreshed on run change)
79+
private IndexedTable ahdcAdcGains;
80+
7481
public void setB(double B) {
7582
this.b = B;
7683
}
@@ -103,6 +110,11 @@ public boolean init() {
103110
ATOF = factory.createDetectorCLAS(cp);
104111
AHDC = (new AlertDCFactory()).createDetectorCLAS(new DatabaseConstantProvider());
105112

113+
Map<String, Integer> tableMap = new HashMap<>();
114+
tableMap.put("/calibration/alert/ahdc/gains", 3);
115+
requireConstants(tableMap);
116+
this.getConstantsManager().setVariation("default");
117+
106118
if(this.getEngineConfigString("Mode")!=null) {
107119
//if (Objects.equals(this.getEngineConfigString("Mode"), Mode.AI_Track_Finding.name()))
108120
// mode = Mode.AI_Track_Finding;
@@ -140,6 +152,7 @@ public boolean processDataEvent(DataEvent event) {
140152

141153
if (run.get() == 0 || (run.get() != 0 && run.get() != newRun)) {
142154
run.set(newRun);
155+
ahdcAdcGains = this.getConstantsManager().getConstants(newRun, "/calibration/alert/ahdc/gains");
143156
}
144157

145158
//Do we need to read the event vx,vy,vz?

0 commit comments

Comments
 (0)