From 934281aad3924c461abaf79a4a23e364464ff1ac Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Mon, 18 Sep 2023 15:27:14 +0200 Subject: [PATCH] setting default current maximum to infinity --- .../java/org/jlab/analysis/eventmerger/FilterFcup.java | 5 +++-- .../jlab/analysis/eventmerger/RandomTriggerFilter.java | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/FilterFcup.java b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/FilterFcup.java index a9ad543b4..16cd98ee1 100644 --- a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/FilterFcup.java +++ b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/FilterFcup.java @@ -31,7 +31,8 @@ public class FilterFcup implements Worker { public FilterFcup(double min, double max, String source){ this.currentMin=min; this.currentMax=max; - this.histoMax=(int) (2*max); + if(currentMax < Double.POSITIVE_INFINITY) + this.histoMax=(int) (2*max); this.source=source; System.out.print("\nInitializing Faraday Cup reduction: current range set to " + this.currentMin + " - " + this.currentMax); System.out.print("\n current source set to " + (this.source.equals(FCUP_SCALER) ? source : "RAW:epics."+source) + "\n"); @@ -125,7 +126,7 @@ public boolean processEvent(Event event) { public Map getCurrentMap(){ Map sizeMap = new LinkedHashMap<>(); int currentBins = histoBuffer.length-1; - double step = ((double) currentMax)/currentBins; + double step = ((double) histoMax)/currentBins; for(int i = 0; i < currentBins; i++){ String key = String.format("[%6.1f -%6.1f]", (i*step),(i+1)*step); sizeMap.put(key, (double) histoBuffer[i]); diff --git a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/RandomTriggerFilter.java b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/RandomTriggerFilter.java index 0fc27653f..c2b4073b1 100644 --- a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/RandomTriggerFilter.java +++ b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/RandomTriggerFilter.java @@ -105,7 +105,7 @@ public JsonObject settingsToJson(long selectedBits, long vetoedBits, double minC filterData.add("trigger-mask", Long.toHexString(selectedBits)); filterData.add("veto-mask", Long.toHexString(vetoedBits)); filterData.add("current-threshold", minCurrent); - filterData.add("current-maximum", maxCurrent); + filterData.add("current-maximum", Math.min(maxCurrent, Double.MAX_VALUE)); filterData.add("current-source", currentSource); filterData.add("bank-name", bankName); filterData.add("bank-size", nRows); @@ -149,7 +149,7 @@ public static void main(String[] args){ parser.setRequiresInputList(false); parser.addOption("-v" , "0x0", "vetoed trigger bit mask (e.g. 0xFFFFFF7FFFFFFFFF to veto all but the FC trigger"); parser.addOption("-c" , "-1", "minimum beam current"); - parser.addOption("-x" , "80", "maximum beam current"); + parser.addOption("-x" , "inf", "maximum beam current"); parser.addOption("-s" , "DSC2", "source of beam current information (DSC2 scaler or Epics PV name)"); parser.addOption("-e" , "", "name of required bank, e.g. DC::tdc"); parser.addOption("-r" , "-1", "minimum number of rows in required bank"); @@ -164,7 +164,9 @@ public static void main(String[] args){ long selectedBits = RandomTriggerFilter.readTriggerMask(parser.getOption("-b").stringValue()); long vetoedBits = RandomTriggerFilter.readTriggerMask(parser.getOption("-v").stringValue()); double minCurrent = parser.getOption("-c").doubleValue(); - double maxCurrent = parser.getOption("-x").doubleValue(); + double maxCurrent = Double.POSITIVE_INFINITY; + if(!parser.getOption("-x").stringValue().equals("inf")) + maxCurrent = parser.getOption("-x").doubleValue(); String currentSource = parser.getOption("-s").stringValue(); String bankName = parser.getOption("-e").stringValue(); int nRows = parser.getOption("-r").intValue();