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 interface
lambda type to initialize each bin's generic dataNested classes/interfaces inherited from class org.jlab.detector.scalers.DaqScalersSequence
DaqScalersSequence.Interval
-
Field Summary
Fields inherited from class org.jlab.detector.scalers.DaqScalersSequence
logger, scalers, TI_CLOCK_FREQ
-
Constructor Summary
ConstructorsConstructorDescriptionQadbBinSequence
(List<String> filenames, int binWidth) alternative constructor, with noQadbBin.data
initialization 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 TypeMethodDescriptionvoid
correctLowerBound
(int evnumMin, long timestampMin) correct the first bin's lower bound, if you know it from tag-0 eventsvoid
correctUpperBound
(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 void
Demonstrate how to use this classint
size()
Methods inherited from class org.jlab.detector.scalers.DaqScalersSequence
add, add, clear, clear, compare, findIndex, fixClockRollover, get, get, getInterval, getInterval, getInterval, getInterval, getInterval, readFiles, readSequence, rebuildSequence, validateOrdering
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface java.lang.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
binWidth
consecutive scaler readouts (excluding the first); the last bin may contain less -
QadbBin
objects are defined for each pair of consecutive bin boundaries - an initial (final)
QadbBin
object is also defined, for events which occur before (after) the first (last) scaler readout - the
private
list 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.data
initialization parameterQadbBin.data
will 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:
size
in 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
-