Class QadbBin<T>

All Implemented Interfaces:
Comparator<DaqScalers>

public class QadbBin<T> extends DaqScalersSequence
A single bin for the Quality Assurance Database (QADB). It may hold arbitrary data, such as a class instance, accessible by public member data; its type is set by a generic type parameter.

A bin contains a (sub)sequence of scaler readouts, and therefore extends DaqScalersSequence.

Author:
dilks
See Also:
  • Field Details

    • data

      public T data
      arbitrary data that may be held by this bin; it is just public so the user can do anything with it
  • Constructor Details

    • QadbBin

      public QadbBin(int binNum, QadbBin.BinType binType, List<DaqScalers> inputScalers, T initData)
      construct a single bin
      Parameters:
      binNum - the bin number, in the QadbBinSequence which contains this bin
      binType - the bin type (see QadbBin.BinType)
      inputScalers - the scaler sequence for this bin
      initData - the initial data for this bin (sets public member data)
  • Method Details

    • getBinNum

      public int getBinNum()
      Returns:
      the bin number for this bin
    • getTimestampMin

      public long getTimestampMin()
      Returns:
      minimum timestamp for this bin
    • getTimestampMax

      public long getTimestampMax()
      Returns:
      maximum timestamp for this bin
    • getEventNumMin

      public long getEventNumMin()
      Returns:
      minimum event number for this bin
    • getEventNumMax

      public long getEventNumMax()
      Returns:
      maximum event number for this bin
    • getBeamCharge

      public double getBeamCharge()
      Returns:
      the beam charge, not gated by DAQ, for this bin
    • getBeamChargeGated

      public double getBeamChargeGated()
      Returns:
      the beam charge, gated by DAQ, for this bin
    • getBeamCharge

      public double getBeamCharge(QadbBin.ChargeType chargeType)
      Parameters:
      chargeType - the type of charge
      Returns:
      the beam charge, gated or ungated
    • getMeanLivetime

      public double getMeanLivetime()
      Returns:
      the mean livetime for this bin
    • getDuration

      public double getDuration()
      Returns:
      the duration of the bin, in seconds
    • correctCharge

      public void correctCharge(QadbBin.ChargeCorrectionMethod method)
      correct the beam charge for this bin, using a correction method
      Parameters:
      method - the correction method to use
      See Also:
    • correctCharge

      public void correctCharge(double charge, double chargeGated)
      correct the beam charge for this bin, using specific values from the caller
      Parameters:
      charge - the charge, not gated by the DAQ
      chargeGated - the DAQ-gated charge
    • 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 number
      timestampMin - 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 number
      timestampMax - the correct maximum timestamp
    • getChargeExtremum

      public double getChargeExtremum(QadbBin.ExtremumType extremumType, QadbBin.ChargeType chargeType)
      Get the min/max or initial/final charge.

      WARNING: this is likely NOT corrected by correctCharge(org.jlab.detector.qadb.QadbBin.ChargeCorrectionMethod)

      Parameters:
      extremumType - the type of extremum
      chargeType - the type of charge
      Returns:
      the charge for the given extremum
    • print

      public void print()
      print a QA bin, and some basic information
    • print

      public void print(QadbBin.DataPrinter<T> dataPrinter)
      print a QA bin's stored data
      Parameters:
      dataPrinter - a lambda which resolves data as a String
    • print

      public void print(QadbBin.DataPrinter<T> dataPrinter, boolean verbose)
      print a QA bin's stored data, and optionally the bin's basic information
      Parameters:
      dataPrinter - a lambda which resolves data as a String
      verbose - if true, print more