From 15d9d19ed265c604a9d6d1696a9dcbd29208817a Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Fri, 25 Aug 2023 21:43:45 +0200 Subject: [PATCH] Renamed new classes removing Daq --- .../jlab/analysis/eventmerger/FilterFcup.java | 8 +-- .../eventmerger/RandomTriggerFilter.java | 4 +- .../epics/{DaqEpics.java => Epics.java} | 2 +- ...qEpicsSequence.java => EpicsSequence.java} | 52 +++++++++---------- 4 files changed, 33 insertions(+), 33 deletions(-) rename common-tools/clas-detector/src/main/java/org/jlab/detector/epics/{DaqEpics.java => Epics.java} (97%) rename common-tools/clas-detector/src/main/java/org/jlab/detector/epics/{DaqEpicsSequence.java => EpicsSequence.java} (87%) 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 18c63dbc7..8b8b91258 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 @@ -1,8 +1,8 @@ package org.jlab.analysis.eventmerger; import java.util.LinkedHashMap; import java.util.Map; -import org.jlab.detector.epics.DaqEpics; -import org.jlab.detector.epics.DaqEpicsSequence; +import org.jlab.detector.epics.Epics; +import org.jlab.detector.epics.EpicsSequence; import org.jlab.detector.scalers.DaqScalersSequence; import org.jlab.jnp.hipo4.data.*; import org.jlab.jnp.hipo4.io.HipoReader; @@ -22,7 +22,7 @@ public class FilterFcup implements Worker { public final static String FCUP_SCALER = "DSC2"; private Bank runConfigBank = null; private DaqScalersSequence scalerSeq = null; - private DaqEpicsSequence epicsSeq = null; + private EpicsSequence epicsSeq = null; private double charge = -1; private double current = -1; private String source = null; @@ -64,7 +64,7 @@ public void setScalerSequence(DaqScalersSequence sequence) { * * @param sequence */ - public void setEpicsSequence(DaqEpicsSequence sequence) { + public void setEpicsSequence(EpicsSequence sequence) { this.epicsSeq=sequence; } 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 bdb5c58a8..e91ec3f27 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 @@ -1,6 +1,6 @@ package org.jlab.analysis.eventmerger; import java.util.List; -import org.jlab.detector.epics.DaqEpicsSequence; +import org.jlab.detector.epics.EpicsSequence; import org.jlab.detector.scalers.DaqScalersSequence; import org.jlab.jnp.hipo4.data.*; import org.jlab.jnp.hipo4.io.HipoReader; @@ -184,7 +184,7 @@ public static void main(String[] args){ int filtered = 0; DaqScalersSequence chargeSeq = DaqScalersSequence.readSequence(inputList); - DaqEpicsSequence epicsSeq = DaqEpicsSequence.readSequence(inputList); + EpicsSequence epicsSeq = EpicsSequence.readSequence(inputList); //Writer HipoWriterSorted writer = new HipoWriterSorted(); diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/epics/DaqEpics.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/epics/Epics.java similarity index 97% rename from common-tools/clas-detector/src/main/java/org/jlab/detector/epics/DaqEpics.java rename to common-tools/clas-detector/src/main/java/org/jlab/detector/epics/Epics.java index 5362b214a..0ef2c7b75 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/epics/DaqEpics.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/epics/Epics.java @@ -6,7 +6,7 @@ * Stores Epics data in Json format and the associated Unix time * @author devita */ -public class DaqEpics { +public class Epics { private JsonObject epicsReadout = null; diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/epics/DaqEpicsSequence.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/epics/EpicsSequence.java similarity index 87% rename from common-tools/clas-detector/src/main/java/org/jlab/detector/epics/DaqEpicsSequence.java rename to common-tools/clas-detector/src/main/java/org/jlab/detector/epics/EpicsSequence.java index f53e83f01..72ec70dc0 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/epics/DaqEpicsSequence.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/epics/EpicsSequence.java @@ -20,18 +20,18 @@ * * @author baltzell, devita */ -public class DaqEpicsSequence implements Comparator{ +public class EpicsSequence implements Comparator{ private final static String EPICS_DEFAULT_PV = "scaler_calc1b"; private final static int EPICS_READOUT_PERIOD = 2; // (units are seconds) - protected final List epics=new ArrayList<>(); + protected final List epics=new ArrayList<>(); private Bank rcfgBank=null; @Override - public int compare(DaqEpics o1, DaqEpics o2) { + public int compare(Epics o1, Epics o2) { if (o1.getUnixTime()o2.getUnixTime()) return 1; return 0; @@ -42,20 +42,20 @@ protected int findIndex(int unixTime) { if (unixTime < this.epics.get(0).getUnixTime()) return -1; if (unixTime > this.epics.get(this.epics.size()-1).getUnixTime()) return -1; // make a fake state for timestamp search: - DaqEpics de = new DaqEpics(); + Epics de = new Epics(); de.setUnixTime(unixTime); - final int index=Collections.binarySearch(this.epics,de,new DaqEpicsSequence()); + final int index=Collections.binarySearch(this.epics,de,new EpicsSequence()); final int n = index<0 ? -index-2 : index; return n; } - protected boolean add(DaqEpics de) { + protected boolean add(Epics de) { if (this.epics.isEmpty()) { this.epics.add(de); return true; } else { - final int index=Collections.binarySearch(this.epics,de,new DaqEpicsSequence()); + final int index=Collections.binarySearch(this.epics,de,new EpicsSequence()); if (index==this.epics.size()) { // its timestamp is later than the existing sequence: this.epics.add(de); @@ -75,18 +75,18 @@ else if (index<0) { /** * @param index - * @return the DaqEpics for the given index + * @return the Epics for the given index */ - public DaqEpics getElement(int index) { + public Epics getElement(int index) { if (index>=0 && index=0) return this.epics.get(n); return null; @@ -94,9 +94,9 @@ public DaqEpics get(int unixTime) { /** * @param event - * @return the most recent DaqEpics for the given event + * @return the most recent Epics for the given event */ - public DaqEpics get(Event event) { + public Epics get(Event event) { event.read(this.rcfgBank); return this.get(this.rcfgBank.getInt("unixTime", 0)); } @@ -106,7 +106,7 @@ public DaqEpics get(Event event) { * @param t2 upper limit of a Unix time interval * @return subset of sequence entries in the interval */ - public List getSubList(int t1, int t2) { + public List getSubList(int t1, int t2) { int idx1 = this.findIndex(t1); int idx2 = this.findIndex(t2); if(idx1 > idx2) @@ -125,14 +125,14 @@ else if(idx1>=0 && idx2<=this.epics.size()-1) * @return integral of the chosen variable in the time interval */ public double getIntegral(String name, double defaultvalue, int t1, int t2) { - List sublist = this.getSubList(t1, t2); + List sublist = this.getSubList(t1, t2); double integral=0; if(sublist!=null && sublist.size()>1) { for(int i=1; i0) integral += de1.getDouble(name, defaultvalue)*(de1.getUnixTime()-de0.getUnixTime()); } @@ -160,12 +160,12 @@ public double getIntegral(String name, double defaultvalue) { * @return minimum of the chosen variable in the time interval */ public double getMinimum(String name, double defaultvalue, int t1, int t2) { - List sublist = this.getSubList(t1, t2); + List sublist = this.getSubList(t1, t2); if(sublist!=null && sublist.size()>1) { double minimum=Double.MAX_VALUE; for(int i=1; i