Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
5fa1c5e
remove unused stuff
Aug 22, 2023
ab067f9
add detectorChanged method (and remove unused imports)
Aug 22, 2023
566665e
fix formatting
Aug 22, 2023
b36622a
implement all detectorChanged hooks (and cleanup/formatting)
Aug 22, 2023
d2647f4
synchronize and count changes
Aug 22, 2023
aeab9cd
allow nulls
Aug 22, 2023
9ae67ee
add empty list check
Aug 22, 2023
10bb09b
cleanup/formatting
Aug 22, 2023
ac5b334
use the same wrapper used in clara/recon-util
Aug 22, 2023
68b49cd
hardcode it to 11 for now
Aug 22, 2023
9f246b0
implement detectorChanged for cvt
Aug 22, 2023
9c7e31e
implement detector changed for dc
Aug 22, 2023
b1d3a9f
use the same wrapper used in clara/recon-util
Aug 22, 2023
2cb682c
fix logic oops
Aug 22, 2023
0be53c2
rename processDataEvent/processEvent
Aug 28, 2023
8ec33db
make MLTDEngine respect run number like everyone else, unless overrid…
Sep 19, 2023
86cb6e5
add newly-required methods
Sep 19, 2023
112c2f0
restore initialization
Sep 19, 2023
99a1cb2
allow run number override from YAML
Oct 17, 2023
4314754
add missing overrides
baltzell Oct 18, 2024
212d1e1
remove mc/data check
baltzell Oct 18, 2024
8efff6b
processDataEvent should be final
baltzell Jan 3, 2025
f31874c
cleanup script
baltzell Jan 3, 2025
fb34728
remove unused/unnecessary script
baltzell Jan 3, 2025
0cc57d7
add neutron test
baltzell Jan 3, 2025
a5abcbd
abort on error
baltzell Jan 9, 2025
2880071
fix rebase mistake
baltzell May 22, 2025
6a65e90
add missing overrides
baltzell May 22, 2025
e40bf23
add missing overrides
baltzell May 22, 2025
9a0f0cb
add missing overrides
baltzell May 22, 2025
3961bc8
accounting for tstart, tflight and tprop in MC tracks reconstruction
raffaelladevita Jan 3, 2025
82eceac
removed check on run number when setting the DC hit uncertainty
raffaelladevita Jan 15, 2025
c855e5c
removed hardcoded change to default variation in BAND engine
raffaelladevita Jan 24, 2025
ea03176
apply TDC jitter correction only if TI timestamp is >0, excluding MC …
raffaelladevita Jan 28, 2025
344fcc9
moved RF offsets to time written to RUN::rf bank
raffaelladevita Jan 29, 2025
3a9ccd7
fixed bug in REC::Event.RFTime introduced with last commit
raffaelladevita Jan 29, 2025
03bf727
restored TDC jitter correction for timestamp=0
raffaelladevita Jan 31, 2025
99325ee
switch to load geometry for real run number
raffaelladevita Feb 20, 2025
e57bcff
fix env
baltzell Jul 15, 2025
90e1102
add missing override
baltzell Aug 4, 2025
211cfa5
remove unused imports
baltzell Aug 4, 2025
ebc88c8
add missing overrides
baltzell Oct 2, 2025
b59552e
add missing overrides
baltzell Oct 23, 2025
2e02679
propagate detectorChanged and method renaming to new UberEngine
raffaelladevita Nov 7, 2025
598fff0
changed EC to load the geometry with the real run number
raffaelladevita Jan 5, 2026
907fe1f
fix merge mistake
baltzell Jan 12, 2026
3c9fa31
undoing RF offset changes
raffaelladevita Jan 15, 2026
83f0d24
add missing overrides
baltzell Jan 16, 2026
2b23a13
updated use of geometry factory in URWT engine
raffaelladevita Mar 18, 2026
76f1e40
cleanup
baltzell Mar 26, 2026
c999dcf
add detector changed hooks
baltzell Apr 7, 2026
671b9b2
switch eb tests to gemc/6.0
baltzell May 11, 2026
e07e6c4
bugfix
baltzell May 11, 2026
0d4352a
updated yamls for MC
raffaelladevita May 15, 2026
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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,16 @@ jobs:
id:
- kpp
- eb-ep
- eb-en
- eb-eg
- eb-epc
- eb-enc
- eb-eftpi
include:
# run all tests on ubuntu
# run selected tests on ubuntu
- { id: kpp, cmd: ./run-advanced-tests.sh }
- { id: eb-ep, cmd: ./run-eb-tests.sh -100 electronproton }
- { id: eb-en, cmd: ./run-eb-tests.sh -100 electronneutron }
- { id: eb-eg, cmd: ./run-eb-tests.sh -100 electrongamma }
- { id: eb-epc, cmd: ./run-eb-tests.sh -100 electronprotonC }
- { id: eb-enc, cmd: ./run-eb-tests.sh -100 electronneutronC }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void setFieldsConfig(String fieldsConfig) {


@Override
public boolean processDataEvent(DataEvent event) {
public boolean processDataEventUser(DataEvent event) {
Reader reader ;
this.FieldsConfig = this.getFieldsConfig();
if (event.hasBank("RUN::config") == false) {
Expand Down Expand Up @@ -250,5 +250,7 @@ public double[] getBeamSpot(DataEvent event, IndexedTable beamPos) {
}
return xybeam;
}

public void detectorChanged(int run) {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ public static JsonObject Map2Json(Map<String,Object> map) {
ret.add(topKey,Map2Json((Map)entry.getValue()));
}
else {
if(entry.getValue() != null) {
ret.add(topKey, entry.getValue().toString());
}
ret.add(topKey, entry.getValue() == null ? null : entry.getValue().toString());
}
}
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public void init(){
public void processEvent(DataEvent event){
for(Map.Entry<String,ReconstructionEngine> engine : this.processorEngines.entrySet()){
try {
engine.getValue().filterEvent(event);
engine.getValue().processDataEvent(event);
} catch (Exception e){
LOGGER.log(Level.SEVERE, "[Exception] >>>>> engine : {0}\n\n", engine.getKey());
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -60,14 +61,22 @@ public abstract class ReconstructionEngine implements Engine {
volatile boolean dropOutputBanks = false;
private final Set<String> outputBanks = new HashSet<>();

private volatile List<Integer> runNumbers = new ArrayList<>();

private boolean ignoreInvalidRunNumbers = true;

private int runNumberOverride = -1;

volatile long triggerMask = 0xFFFFFFFFFFFFFFFFL;

String engineName = "UnknownEngine";
String engineAuthor = "N.T.";
String engineVersion = "0.0";
String engineDescription = "CLARA Engine";
String engineName = "UnknownEngine";
String engineAuthor = "N.T.";
String engineVersion = "0.0";
String engineDescription = "CLARA Engine";

abstract public boolean processDataEventUser(DataEvent event);
abstract public boolean init();
abstract public void detectorChanged(int runNumber);

public ReconstructionEngine(String name, String author, String version){
engineName = name;
Expand Down Expand Up @@ -108,9 +117,6 @@ protected RawBank getRawBankReader(String bankName, OrderType... order) {
return new RawDataBank(bankName, order);
}

abstract public boolean processDataEvent(DataEvent event);
abstract public boolean init();

/**
* Use a map just to avoid name clash in ConstantsManager.
* @param tables map of table names to #indices
Expand Down Expand Up @@ -187,6 +193,9 @@ public EngineData configure(EngineData ed) {
engineDictionary = new SchemaFactory();
LOGGER.log(Level.FINEST,"--- engine configuration is called " + this.getDescription());
try {
if (this.getEngineConfigString("runNumberOverride")!=null) {
this.runNumberOverride = Integer.valueOf(this.getEngineConfigString("runNumberOverride"));
}
if (this.getEngineConfigString("rawBankGroup")!=null) {
this.rawBankOrders = RawBank.getFilterGroup(this.getEngineConfigString("rawBankGroup"));
}
Expand Down Expand Up @@ -227,8 +236,7 @@ public EngineData configure(EngineData ed) {
}

protected String getStringConfigParameter(String jsonString,
String key) throws Exception {
Object js;
String key) throws Exception {
String variation = "";
try {
JSONObject base = new JSONObject(jsonString);
Expand All @@ -238,13 +246,6 @@ protected String getStringConfigParameter(String jsonString,
} else {
LOGGER.log(Level.FINE,"[JSON]" + this.getName() + " **** warning **** does not contain key = " + key);
}
/*
js = base.get(key);
if (js instanceof String) {
return (String) js;
} else {
throw new Exception("JSONObject[" + "] not a string.");
}*/
} catch (JSONException e) {
throw new Exception(e.getMessage());
}
Expand Down Expand Up @@ -345,17 +346,22 @@ public void dropBanks(DataEvent event) {
}
}
}

public boolean checkRunNumber(DataEvent event) {
if (!this.ignoreInvalidRunNumbers) return true;
int run = 0;
if (event.hasBank("RUN::config")) {
run = event.getBank("RUN::config").getInt("run",0);

public synchronized boolean checkRunNumber(DataEvent event) {
int r = runNumberOverride;
if (r <= 0 && event.hasBank("RUN::config")) {
r = event.getBank("RUN::config").getInt("run",0);
}
return run>0;
if (r > 0) {
if (this.runNumbers.isEmpty() || r != this.runNumbers.get(this.runNumbers.size()-1)) {
this.runNumbers.add(r);
this.detectorChanged(r);
}
}
return !this.ignoreInvalidRunNumbers || r>0;
}

public void filterEvent(DataEvent dataEvent) {
public void processDataEvent(DataEvent dataEvent) {
if (!this.wroteConfig) {
this.wroteConfig = true;
JsonUtils.extend(dataEvent, CONFIG_BANK_NAME, "json", this.generateConfig());
Expand All @@ -365,7 +371,7 @@ public void filterEvent(DataEvent dataEvent) {
}
if(this.applyTriggerMask(dataEvent)) {
if (this.checkRunNumber(dataEvent)) {
this.processDataEvent(dataEvent);
this.processDataEventUser(dataEvent);
}
}
}
Expand Down Expand Up @@ -404,7 +410,7 @@ public EngineData execute(EngineData input) {
}

try {
this.filterEvent(dataEventHipo);
this.processDataEvent(dataEventHipo);
output.setData(mt, dataEventHipo.getHipoEvent());
} catch (Exception e) {
String msg = String.format("Error processing input event%n%n%s", ClaraUtil.reportException(e));
Expand Down Expand Up @@ -519,16 +525,21 @@ public Reco(){
super("a","b","c");
}
@Override
public boolean processDataEvent(DataEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
public boolean processDataEventUser(DataEvent event) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean init() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}

}

@Override
public void detectorChanged(int runNumber) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

public static void main(String[] args){
System.setProperty("CLAS12DIR", "/Users/gavalian/Work/Software/project-3a.0.0/Distribution/clas12-offline-software/coatjava");
try {
Expand All @@ -549,7 +560,6 @@ public static void main(String[] args){
"\"timestamp\":333\n" +
"}";
System.out.println(json);
//json = "{ \"ccdb\":{\"run\":10,\"variation\":\"default\"}, \"variation\":\"cosmic\"}";
Reco reco = new Reco();
String variation = reco.getStringConfigParameter(json, "variation");
System.out.println(" Variation : " + variation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected void add(ReconstructionEngine... e) {
}

@Override
public boolean processDataEvent(DataEvent event) {
public boolean processDataEventUser(DataEvent event) {
throw new RuntimeException("UberEngine does not implement processDataEvent.");
}

Expand All @@ -39,9 +39,9 @@ public boolean processDataEvent(DataEvent event) {
* @param event
*/
@Override
public final void filterEvent(DataEvent event) {
public final void processDataEvent(DataEvent event) {
for (ReconstructionEngine e : engines)
e.filterEvent(event);
e.processDataEvent(event);
}

/**
Expand All @@ -55,6 +55,16 @@ public final boolean init() {
if (!e.init()) ret = false;
return ret;
}

/**
* Run all engines' dettectorChanged methods.
* @param runNumber
*/
@Override
public final void detectorChanged(int runNumber) {
for (ReconstructionEngine e : engines)
e.detectorChanged(runNumber);
}

/**
* Run all engines' configure methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private void loadTables() {
}

@Override
public boolean processDataEvent(DataEvent event) {
public boolean processDataEventUser(DataEvent event) {
DataBank bank = event.getBank("RUN::config");
// Load the constants
// -------------------
Expand Down Expand Up @@ -195,4 +195,6 @@ public boolean init() {
return true;
}

@Override
public void detectorChanged(int runNumber) {}
}
26 changes: 11 additions & 15 deletions etc/services/mc-ai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ services:
name: FTEB
- class: org.jlab.service.raster.RasterEngine
name: RASTER
# DC clustering: nominal algoritm, filled the cluster bank for ai and conventional tracking
- class: org.jlab.service.ai.DCDenoiseEngine
name: DCDN
- class: org.jlab.service.dc.DCHBClustering
name: DCCR
# This is where the AI plugin would go. THe AI code reads the HB clusters.
- class: org.jlab.service.mltn.MLTDEngine
name: MLTD
# DC using clustering on AI hits: NN assisted HB tracking
- class: org.jlab.service.dc.DCHBPostClusterAI
name: DCHAI
- class: org.jlab.service.ai.DCClsComboEngine
name: DCCC
- class: org.jlab.service.dc.DCHBTrackingAI
name: DCHTAI
- class: org.jlab.service.ftof.FTOFHBEngine
name: FTOFHB
- class: org.jlab.service.ec.ECEngine
Expand Down Expand Up @@ -64,11 +63,10 @@ services:
- class: org.jlab.calibration.service.CalibBanksEngine
name: CALIB
configuration:
# global:
# variation: rga_fall2018_mc
# timestamp: 12/31/2020-00:00:00
# dcMinistagger: "NOTONREFWIRE"
# dcFeedthroughs: "OFF"
global:
variation: mc2026
dcMinistagger: "NOTONREFWIRE"
dcFeedthroughs: "OFF"
io-services:
writer:
schema_dir: dst
Expand All @@ -77,9 +75,7 @@ configuration:
MAGFIELDS:
magfieldSolenoidMap: Symm_solenoid_r601_phi1_z1201_13June2018.dat
magfieldTorusMap: Symm_torus_r2501_phi16_z251_24Apr2018.dat
MLTD:
run: "6302"
DCHAI:
DCHTAI:
outputBankPrefix: "HB"
RTPC:
rtpcSimulation: "true"
Expand Down
22 changes: 10 additions & 12 deletions etc/services/mc-aicv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ services:
name: FTEB
- class: org.jlab.service.raster.RasterEngine
name: RASTER
# DC clustering: nominal algoritm, filled the cluster bank for ai and conventional tracking
# - class: org.jlab.service.ai.DCDenoiseEngine
# name: DCDN
- class: org.jlab.service.dc.DCHBClustering
name: DCCR
# This is where the AI plugin would go. THe AI code reads the HB clusters.
- class: org.jlab.service.mltn.MLTDEngine
name: MLTD
# DC using clustering: regular HB tracking
- class: org.jlab.service.ai.DCClsComboEngine
name: DCCC
- class: org.jlab.service.dc.DCHBPostClusterConv
name: DCHB
# DC using clustering on AI hits: NN assisted HB tracking
- class: org.jlab.service.dc.DCHBPostClusterAI
name: DCHAI
- class: org.jlab.service.dc.DCHBTrackingAI
name: DCHTAI
- class: org.jlab.service.ftof.FTOFHBEngine
name: FTOFHB
- class: org.jlab.service.ec.ECEngine
Expand Down Expand Up @@ -75,10 +73,10 @@ services:
- class: org.jlab.calibration.service.CalibBanksEngine
name: CALIB
configuration:
# global:
# variation: rga_fall2018_mc
# dcMinistagger: "NOTONREFWIRE"
# dcFeedthroughs: "OFF"
global:
variation: mc2026
dcMinistagger: "NOTONREFWIRE"
dcFeedthroughs: "OFF"
io-services:
writer:
schema_dir: mc-aicv
Expand Down
8 changes: 4 additions & 4 deletions etc/services/mc-cv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ services:
- class: org.jlab.calibration.service.CalibBanksEngine
name: CALIB
configuration:
# global:
# variation: rga_fall2018_mc
# dcMinistagger: "NOTONREFWIRE"
# dcFeedthroughs: "OFF"
global:
variation: mc2026
dcMinistagger: "NOTONREFWIRE"
dcFeedthroughs: "OFF"
io-services:
writer:
schema_dir: dst
Expand Down
Loading