diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/ReconstructionEngine.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/ReconstructionEngine.java index dc6a0b8026..c89cb72e54 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/ReconstructionEngine.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/ReconstructionEngine.java @@ -53,7 +53,9 @@ public abstract class ReconstructionEngine implements Engine { volatile boolean dropOutputBanks = false; private final Set outputBanks = new HashSet<>(); - + + private boolean ignoreInvalidRunNumbers = true; + volatile long triggerMask = 0xFFFFFFFFFFFFFFFFL; String engineName = "UnknownEngine"; @@ -167,6 +169,10 @@ public EngineData configure(EngineData ed) { this.getEngineConfigString("dropBanks").equals("true")) { dropOutputBanks=true; } + if (this.getEngineConfigString("ignoreInvalidRunNumbers")!=null && + this.getEngineConfigString("ignoreInvalidRunNumbers").equals("false")) { + ignoreInvalidRunNumbers=false; + } if (this.getEngineConfigString("triggerMask")!=null) { this.setTriggerMask(this.getEngineConfigString("triggerMask")); } @@ -314,7 +320,15 @@ 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); + } + return run>0; + } @Override public EngineData execute(EngineData input) { @@ -357,8 +371,11 @@ public EngineData execute(EngineData input) { if (this.dropOutputBanks) { this.dropBanks(dataEventHipo); } - if(this.applyTriggerMask(dataEventHipo)) - this.processDataEvent(dataEventHipo); + if(this.applyTriggerMask(dataEventHipo)) { + if (this.checkRunNumber(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));