Skip to content

Commit bc3a41e

Browse files
committed
check CCDB tanslation tables for crate/slot/channel conflicts
1 parent 72c89f9 commit bc3a41e

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DetectorEventDecoder.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ public final void initDecoder(){
121121

122122
scalerManager.init(Arrays.asList(new String[]{"/runcontrol/fcup","/runcontrol/slm","/runcontrol/hwp",
123123
"/runcontrol/helicity","/daq/config/scalers/dsc1"}));
124+
125+
checkTables();
126+
}
127+
128+
public void checkTables() {
129+
for (int i=0; i<tablesTrans.size(); i++) {
130+
IndexedTable t = translationManager.getConstants(runNumber, tablesTrans.get(i));
131+
for (int j=0; j<i; j++)
132+
t.conflicts(translationManager.getConstants(runNumber, tablesTrans.get(j)));
133+
}
124134
}
125135

126136
/**

common-tools/clas-utils/src/main/java/org/jlab/utils/groups/IndexedTable.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class IndexedTable extends DefaultTableModel {
3232
private Map<Integer,List<RowConstraint>> constrains = new HashMap<>();
3333

3434
private int DEBUG_MODE = 0;
35-
35+
3636
public IndexedTable(int indexCount){
3737
entries = new IndexedList<>(indexCount);
3838
for(int i = 0; i < indexCount; i++){
@@ -418,4 +418,27 @@ public void setSize(int size){
418418
}
419419
}
420420

421+
/**
422+
* @param it table with which to compare
423+
* @return whether the tables have conflicting indices
424+
*/
425+
public boolean conflicts(IndexedTable it) {
426+
if (it.getList().getIndexSize() != this.getList().getIndexSize()) {
427+
System.err.println("[CCDB-TT] Conflict: Not even the same #inidices.");
428+
return false;
429+
}
430+
List<Object> conflicts = new ArrayList<>();
431+
for (Object key : it.getList().getMap().keySet()) {
432+
if (entries.hasItemByHash((long)key)){
433+
conflicts.add(key);
434+
int[] index = new int[it.getList().getIndexSize()];
435+
String s = "[CCDB-TT] Index Conflict: ";
436+
for (int i=0; i<index.length; i++)
437+
s += (i>0?"/":"")+IndexedTable.DEFAULT_GENERATOR.getIndex((long)key, i);
438+
System.err.println(s);
439+
}
440+
}
441+
return !conflicts.isEmpty();
442+
}
443+
421444
}

0 commit comments

Comments
 (0)