From 4bee328185dbeab403b55ea2ebd3bab0df2b0b92 Mon Sep 17 00:00:00 2001 From: tongtongcao Date: Thu, 16 Jul 2026 09:32:41 -0400 Subject: [PATCH] update DCClsComboEngine.java to set limit for cluster combos in case of memory explosion --- .../org/jlab/service/ai/DCClsComboEngine.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/reconstruction/ai/src/main/java/org/jlab/service/ai/DCClsComboEngine.java b/reconstruction/ai/src/main/java/org/jlab/service/ai/DCClsComboEngine.java index 847caa11ed..4aacfa77f2 100644 --- a/reconstruction/ai/src/main/java/org/jlab/service/ai/DCClsComboEngine.java +++ b/reconstruction/ai/src/main/java/org/jlab/service/ai/DCClsComboEngine.java @@ -36,6 +36,9 @@ public class DCClsComboEngine extends ReconstructionEngine { final static String CONF_THREADS = "threads"; + final static String LIMIT_CLSCOMBOS_PERSECTOR = "limitClsCombosPerSector"; + int limitClsCombosPerSector = (int)1e6; + final static String CONF_MODEL_FILE_6CLS = "modelFile6Cls"; final static String CONF_THRESHOLD_6CLS = "threshold6Cls"; String modelFile6Cls = "mlp_64h_4l_6cls.pt"; @@ -51,7 +54,7 @@ public class DCClsComboEngine extends ReconstructionEngine { Criteria criteria5Cls; ZooModel model5Cls; PredictorPool predictors5Cls; - + final static int SUPERLAYERS = 6; public DCClsComboEngine() { @@ -69,6 +72,9 @@ public boolean init() { int threads = Integer.parseInt(getEngineConfigString(CONF_THREADS,"64")); + if (getEngineConfigString(LIMIT_CLSCOMBOS_PERSECTOR) != null) + limitClsCombosPerSector = Integer.parseInt(getEngineConfigString(LIMIT_CLSCOMBOS_PERSECTOR)); + if (getEngineConfigString(CONF_THRESHOLD_6CLS) != null) threshold6Cls = Float.parseFloat(getEngineConfigString(CONF_THRESHOLD_6CLS)); if (getEngineConfigString(CONF_MODEL_FILE_6CLS) != null) @@ -340,6 +346,9 @@ public void writeBank(DataEvent event, List clsComboList){ */ public void generate6ClsCombos(Map> map, int sl, DCCluster[] current, List comboList) { + // Limit for combos + if (comboList.size() >= limitClsCombosPerSector) return; + // Base case: if all superlayers have been processed (sl > 6) // then we have a complete 6-cluster combination if (sl > SUPERLAYERS) { @@ -368,7 +377,7 @@ public void generate6ClsCombos(Map> map, int sl, DCClus */ public void generate5ClsCombos(Map> mapSL, List outputList) { - + // Iterate over all possible missing superlayers (1 to 6) for (int missingSL = 1; missingSL <= SUPERLAYERS; missingSL++) { @@ -404,6 +413,9 @@ private void generate5ClsRecursive(Map> mapSL, DCCluster[] current, int idx, List outputList) { + + // Limit for combos + if (outputList.size() >= limitClsCombosPerSector) return; // Base case: all superlayers processed if (sl > SUPERLAYERS) {