Skip to content

Commit

Permalink
setting default current maximum to infinity
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaelladevita committed Sep 21, 2023
1 parent 2222637 commit 934281a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -125,7 +126,7 @@ public boolean processEvent(Event event) {
public Map<String,Double> getCurrentMap(){
Map<String,Double> 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]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand All @@ -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();
Expand Down

0 comments on commit 934281a

Please sign in to comment.