Class QadbBinSequence<T>
java.lang.Object
org.jlab.detector.scalers.DaqScalersSequence
org.jlab.detector.qadb.QadbBinSequence<T>
- All Implemented Interfaces:
Iterable<QadbBin<T>>, Comparator<DaqScalers>
A sequence of bins for the Quality Assurance Database (QADB).
The bins may hold generic data, such as a class instance, accessible by QadbBin.data; the data
type is set by a generic type parameter, and all bins will hold the same type of data.
- Author:
- dilks
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacelambda type to initialize each bin's generic dataNested classes/interfaces inherited from class DaqScalersSequence
DaqScalersSequence.Interval -
Field Summary
Fields inherited from class DaqScalersSequence
logger, scalers, TI_CLOCK_FREQ -
Constructor Summary
ConstructorsConstructorDescriptionQadbBinSequence(List<String> filenames, int binWidth) alternative constructor, with noQadbBin.datainitialization parameterQadbBinSequence(List<String> filenames, int binWidth, QadbBinSequence.DataInitializer<T> initDataFunction) read a list of HIPO files for a run and generate a sequence of QADB bins. -
Method Summary
Modifier and TypeMethodDescriptionvoidcorrectLowerBound(int evnumMin, long timestampMin) correct the first bin's lower bound, if you know it from tag-0 eventsvoidcorrectUpperBound(int evnumMax, long timestampMax) correct the last bin's upper bound, if you know it from tag-0 eventsfindBin(long timestamp) getBin(int idx) iterator()iterable interface implementationstatic voidDemonstrate how to use this classintsize()Methods inherited from class DaqScalersSequence
add, add, clear, clear, compare, findIndex, fixClockRollover, get, get, getInterval, getInterval, getInterval, getInterval, getInterval, readFiles, readSequence, rebuildSequence, validateOrderingMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
QadbBinSequence
public QadbBinSequence(List<String> filenames, int binWidth, QadbBinSequence.DataInitializer<T> initDataFunction) read a list of HIPO files for a run and generate a sequence of QADB bins. The original sequence of scalers (DaqScalersSequence) is sampled:- bin boundaries are set such that each bin contains
binWidthconsecutive scaler readouts (excluding the first); the last bin may contain less -
QadbBinobjects are defined for each pair of consecutive bin boundaries - an initial (final)
QadbBinobject is also defined, for events which occur before (after) the first (last) scaler readout - the
privatelist of scalers becomes filled with ONLY the scaler readouts at the bin boundaries - each bin's scaler subsequence is stored within its
QadbBin
- Parameters:
filenames- list of HIPO files to readbinWidth- the number of consecutive scaler-readout intervals in each bininitDataFunction- a lambda to create the initial data for each bin; must be of the form(binNumber) -> { return initData object }
- bin boundaries are set such that each bin contains
-
QadbBinSequence
alternative constructor, with noQadbBin.datainitialization parameterQadbBin.datawill be initialized tonull- Parameters:
filenames- list of HIPO files to readbinWidth- the number of consecutive scaler-readout intervals in each bin
-
-
Method Details
-
iterator
-
size
public int size()- Overrides:
sizein classDaqScalersSequence- Returns:
- the number of bins in this sequence
-
getBin
-
findBin
-
correctLowerBound
public void correctLowerBound(int evnumMin, long timestampMin) correct the first bin's lower bound, if you know it from tag-0 events- Parameters:
evnumMin- the correct minimum event numbertimestampMin- the correct minimum timestamp
-
correctUpperBound
public void correctUpperBound(int evnumMax, long timestampMax) correct the last bin's upper bound, if you know it from tag-0 events- Parameters:
evnumMax- the correct maximum event numbertimestampMax- the correct maximum timestamp
-
main
Demonstrate how to use this class- Parameters:
args- command-line arguments
-