Class DaqScalers

java.lang.Object
org.jlab.detector.scalers.DaqScalers

public class DaqScalers extends Object
Helper methods to read the RAW::scaler bank, and create RUN::scaler and HEL::scaler from Dsc2Scaler and StruckScaler objects. We have at least two relevant scaler hardware boards, STRUCK and DSC2, both readout on helicity flips and with DAQ-busy gating, both decoded into RAW::scaler. This class reads RAW::scaler and converts to more user-friendly information. STRUCK. Latching on helicity states, zeroed upon readout, with both helicity settle (normally 500 us) and non-settle counts, useful for "instantaneous" livetime, beam charge asymmetry, beam trip studies, ... DSC2. Integrating since beginning of run, useful for beam charge normalization.
Author:
baltzell
See Also:
  • logbook entry and common-tools/clas-detector/doc The EPICS equation for converting Faraday Cup raw scaler S to beam current I: I [nA] = (S [Hz] - offset ) / slope * attenuation; offset/slope/attenuation are read from CCDB Accounting for the offset in accumulated beam charge requires knowledge of time duration. In some run periods the DSC2 clock is zeroed at run start but at 1 Mhz rolls over every 35 seconds, and the (48 bit) 250 MHz TI timestamp can also rollover within a run since only zeroed upon reboot. Instead we allow run duration to be passed in, e.g. using run start time from RCDB and event unix time from RUN::config. FIXME: Use CCDB for GATEINVERTED and CRATE/SLOT/CHAN
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
     
     
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
     
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    static DaqScalers
    create(ConstantsManager conman, org.jlab.jnp.hipo4.data.Bank runConfig, org.jlab.jnp.hipo4.data.Bank rawScaler)
     
    static DaqScalers
    create(org.jlab.jnp.hipo4.data.Bank runScalerBank)
     
    static DaqScalers
    create(org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, double seconds)
     
    static DaqScalers
    create(org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, Date rst, Date uet)
     
    static DaqScalers
    create(org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, org.jlab.utils.groups.IndexedTable dscTable)
    Same as create(Bank,IndexedTable,double), except relies on DSC2's clock.
    static List<org.jlab.jnp.hipo4.data.Bank>
    createBanks(int runnumber, org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Event event, ConstantsManager conman)
     
    static List<org.jlab.jnp.hipo4.data.Bank>
    createBanks(org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, double seconds)
    Use user-defined seconds for run duration Faraday cup offset correction.
    static List<org.jlab.jnp.hipo4.data.Bank>
    createBanks(org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, Date rst, Date uet)
    Use run start time and end times for run duration Faraday cup offset correction.
    static List<org.jlab.jnp.hipo4.data.Bank>
    createBanks(org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, org.jlab.utils.groups.IndexedTable dscTable)
    Use scaler clock for run duration for Faraday cup offset correction.
    org.jlab.jnp.hipo4.data.Bank
    createHelicityBank(org.jlab.jnp.hipo4.data.SchemaFactory schema)
     
    org.jlab.jnp.hipo4.data.Bank
    createRunBank(org.jlab.jnp.hipo4.data.SchemaFactory schema)
     
    static double
    getSeconds(Date rst, Date uet)
    Get seconds between two dates assuming the differ by not more than 24 hours.
    long
     
    setTimestamp(long timestamp)
     

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details Link icon

  • Constructor Details Link icon

    • DaqScalers Link icon

      public DaqScalers()
  • Method Details Link icon

    • setTimestamp Link icon

      public DaqScalers setTimestamp(long timestamp)
    • getTimestamp Link icon

      public long getTimestamp()
    • getSeconds Link icon

      public static double getSeconds(Date rst, Date uet)
      Get seconds between two dates assuming the differ by not more than 24 hours. The 24 hour requirement is because the java RCDB library currently provides times as java.sql.Time, which only supports HH:MM:SS and not full date. Necessitated because run-integrating DSC2's clock frequency in some run periods was too large and rolls over during run. And that was the only clock that is reset at beginning of the run. Since DAQ runs are never 24 hours, this works.
      Parameters:
      rst - run start time
      uet - unix event time
      Returns:
    • create Link icon

      public static DaqScalers create(org.jlab.jnp.hipo4.data.Bank runScalerBank)
      Parameters:
      runScalerBank - HIPO RUN::scaler bank
      Returns:
    • create Link icon

      public static DaqScalers create(org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, double seconds)
      Parameters:
      rawScalerBank - HIPO RAW::scaler bank
      fcupTable - /runcontrol/fcup from CCDB
      slmTable - /runcontrol/slm from CCDB
      helTable -
      seconds - duration between run start and current event
      Returns:
    • create Link icon

      public static DaqScalers create(org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, Date rst, Date uet)
      Parameters:
      rawScalerBank - HIPO RAW::scaler bank
      fcupTable - /runcontrol/fcup from CCDB
      slmTable - /runcontrol/slm from CCDB
      helTable - /runcontrol/helicity from CCDB
      rst - run start time
      uet - unix event time
      Returns:
    • create Link icon

      public static DaqScalers create(org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, org.jlab.utils.groups.IndexedTable dscTable)
      Same as create(Bank,IndexedTable,double), except relies on DSC2's clock.
      Parameters:
      rawScalerBank - HIPO RAW::scaler bank
      fcupTable - /runcontrol/fcup from CCDB
      slmTable - /runcontrol/slm from CCDB
      helTable - /runcontrol/helicity from CCDB
      dscTable -
      Returns:
    • create Link icon

      public static DaqScalers create(ConstantsManager conman, org.jlab.jnp.hipo4.data.Bank runConfig, org.jlab.jnp.hipo4.data.Bank rawScaler)
      Parameters:
      conman -
      runConfig -
      rawScaler -
      Returns:
    • createRunBank Link icon

      public org.jlab.jnp.hipo4.data.Bank createRunBank(org.jlab.jnp.hipo4.data.SchemaFactory schema)
      Parameters:
      schema - bank schema
      Returns:
      RUN::scaler banks
    • createHelicityBank Link icon

      public org.jlab.jnp.hipo4.data.Bank createHelicityBank(org.jlab.jnp.hipo4.data.SchemaFactory schema)
      Parameters:
      schema - bank schema
      Returns:
      HEL::scaler banks
    • createBanks Link icon

      public static List<org.jlab.jnp.hipo4.data.Bank> createBanks(org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, org.jlab.utils.groups.IndexedTable dscTable)
      Use scaler clock for run duration for Faraday cup offset correction.
      Parameters:
      schema - bank schema
      rawScalerBank - RAW::scaler bank
      fcupTable - /runcontrol/fcup CCDB table
      slmTable - /runcontrol/slm CCDB table
      helTable - /runcontrol/helicity CCDB table
      Returns:
      [RUN::scaler,HEL::scaler] banks
    • createBanks Link icon

      public static List<org.jlab.jnp.hipo4.data.Bank> createBanks(org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, double seconds)
      Use user-defined seconds for run duration Faraday cup offset correction.
      Parameters:
      schema - bank schema
      rawScalerBank - RAW::scaler bank
      fcupTable - /runcontrol/fcup CCDB table
      slmTable - /runcontrol/slm CCDB table
      helTable - /runcontrol/helicity CCDB table
      seconds - duration between run start and current event
      Returns:
      [RUN::scaler,HEL::scaler] banks
    • createBanks Link icon

      public static List<org.jlab.jnp.hipo4.data.Bank> createBanks(org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Bank rawScalerBank, org.jlab.utils.groups.IndexedTable fcupTable, org.jlab.utils.groups.IndexedTable slmTable, org.jlab.utils.groups.IndexedTable helTable, Date rst, Date uet)
      Use run start time and end times for run duration Faraday cup offset correction.
      Parameters:
      schema - bank schema
      rawScalerBank - RAW::scaler bank
      fcupTable - /runcontrol/fcup CCDB table
      slmTable - /runcontrol/slm CCDB table
      helTable - /runcontrol/helicity CCDB table
      rst - run start time
      uet - event time
      Returns:
      [RUN::scaler,HEL::scaler] banks
    • createBanks Link icon

      public static List<org.jlab.jnp.hipo4.data.Bank> createBanks(int runnumber, org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Event event, ConstantsManager conman)
      Parameters:
      runnumber -
      schema -
      event -
      conman -
      Returns:
      [RUN::scaler,HEL::scaler] banks