Class DaqScalersSequence
java.lang.Object
org.jlab.detector.scalers.DaqScalersSequence
- All Implemented Interfaces:
Comparator<DaqScalers>
- Direct Known Subclasses:
QadbBin
,QadbBinSequence
For easy access to most recent scaler readout for any given event.
See the main() method for example use case, where only the 2 lines
marked with "!!!" are specific to accessing scalers.
- Author:
- baltzell
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Logger
protected final List
<DaqScalers> static final double
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DaqScalersSequence
(List<DaqScalers> inputScalers) DaqScalersSequence
(org.jlab.jnp.hipo4.data.SchemaFactory schema) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
add
(DaqScalers ds) boolean
add
(org.jlab.jnp.hipo4.data.Event event) void
clear()
remove all readouts from the sequencevoid
clear
(int keep) remove all but the latest readouts from the sequenceint
compare
(DaqScalers o1, DaqScalers o2) protected int
findIndex
(long timestamp) void
Try to fix clock rollover on the run-integrating DSC2 scaler. 1.get
(long timestamp) get
(org.jlab.jnp.hipo4.data.Event event) getInterval
(long timestamp) getInterval
(long t1, long t2) getInterval
(org.jlab.jnp.hipo4.data.Event event) getInterval
(org.jlab.jnp.hipo4.data.Event event1, org.jlab.jnp.hipo4.data.Event event2) static void
protected void
static DaqScalersSequence
readSequence
(List<String> filenames) This reads tag=1 events for RUN::scaler banks, and initializes and returns aDaqScalersSequence
that can be used to access the most recent scaler readout for any given event.static DaqScalersSequence
rebuildSequence
(int tags, ConstantsManager conman, List<String> filenames) Reads the RAW::scaler bank and rebuilds the RUN::scaler and HEL::scaler banksint
size()
boolean
Checks if the scalers list is sorted such that the scalers' timestamp and event number orderings are consistent and monotonically increasing.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
-
Field Details
-
TI_CLOCK_FREQ
public static final double TI_CLOCK_FREQ- See Also:
-
scalers
-
logger
-
-
Constructor Details
-
DaqScalersSequence
protected DaqScalersSequence() -
DaqScalersSequence
public DaqScalersSequence(org.jlab.jnp.hipo4.data.SchemaFactory schema) -
DaqScalersSequence
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<DaqScalers>
-
size
public int size()- Returns:
- the number of scalers in this sequence
-
findIndex
protected int findIndex(long timestamp) -
clear
public void clear()remove all readouts from the sequence -
clear
public void clear(int keep) remove all but the latest readouts from the sequence- Parameters:
keep
- the number of readouts to keep
-
add
-
add
public boolean add(org.jlab.jnp.hipo4.data.Event event) -
get
- Parameters:
timestamp
- TI timestamp (i.e. RUN::config.timestamp)- Returns:
- the most recent DaqScalers for the given timestamp
-
get
- Parameters:
event
-- Returns:
- the most recent DaqScalers for the given event
-
getInterval
- Returns:
- largest available interval of scaler readings
-
getInterval
- Parameters:
timestamp
- TI timestamp (i.e. RUN::config.timestamp)- Returns:
- smallest interval of scaler readings around that timestamp
-
getInterval
- Parameters:
event
-- Returns:
- smallest interval of scaler readings around that event
-
getInterval
- Parameters:
t1
- first TI timestamp (i.e. RUN::config.timestamp)t2
- second TI timestamp- Returns:
- smallest interval of scaler readings around those timestamps
-
getInterval
public DaqScalersSequence.Interval getInterval(org.jlab.jnp.hipo4.data.Event event1, org.jlab.jnp.hipo4.data.Event event2) - Parameters:
event1
- first eventevent2
- second event- Returns:
- smallest interval of scaler readings around those events
-
readSequence
This reads tag=1 events for RUN::scaler banks, and initializes and returns aDaqScalersSequence
that can be used to access the most recent scaler readout for any given event.- Parameters:
filenames
- list of names of HIPO files to read- Returns:
- sequence
-
readFiles
-
rebuildSequence
public static DaqScalersSequence rebuildSequence(int tags, ConstantsManager conman, List<String> filenames) Reads the RAW::scaler bank and rebuilds the RUN::scaler and HEL::scaler banks- Parameters:
tags
-conman
-filenames
-- Returns:
-
validateOrdering
public boolean validateOrdering()Checks if the scalers list is sorted such that the scalers' timestamp and event number orderings are consistent and monotonically increasing.- Returns:
true
if timestamp and event number orderings are consistent
-
fixClockRollover
public void fixClockRollover()Try to fix clock rollover on the run-integrating DSC2 scaler. 1. Assume the first clock readout has no rollover. 2. Assume any subsequent clock decrease is a rollover. -
main
-