Package org.jlab.detector.scalers
Class DaqScalers
java.lang.Object
org.jlab.detector.scalers.DaqScalers
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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)
-
Field Details
-
dsc2
-
struck
-
-
Constructor Details
-
DaqScalers
public DaqScalers()
-
-
Method Details
-
setTimestamp
-
getTimestamp
public long getTimestamp() -
getSeconds
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 timeuet
- unix event time- Returns:
-
create
- Parameters:
runScalerBank
- HIPO RUN::scaler bank- Returns:
-
create
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 bankfcupTable
- /runcontrol/fcup from CCDBslmTable
- /runcontrol/slm from CCDBhelTable
-seconds
- duration between run start and current event- Returns:
-
create
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 bankfcupTable
- /runcontrol/fcup from CCDBslmTable
- /runcontrol/slm from CCDBhelTable
- /runcontrol/helicity from CCDBrst
- run start timeuet
- unix event time- Returns:
-
create
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 bankfcupTable
- /runcontrol/fcup from CCDBslmTable
- /runcontrol/slm from CCDBhelTable
- /runcontrol/helicity from CCDBdscTable
-- Returns:
-
create
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
public org.jlab.jnp.hipo4.data.Bank createRunBank(org.jlab.jnp.hipo4.data.SchemaFactory schema) - Parameters:
schema
- bank schema- Returns:
- RUN::scaler banks
-
createHelicityBank
public org.jlab.jnp.hipo4.data.Bank createHelicityBank(org.jlab.jnp.hipo4.data.SchemaFactory schema) - Parameters:
schema
- bank schema- Returns:
- HEL::scaler banks
-
createBanks
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:
rawScalerBank
- RAW::scaler bankschema
- bank schemafcupTable
- /runcontrol/fcup CCDB tableslmTable
- /runcontrol/slm CCDB tablehelTable
- /runcontrol/helicity CCDB table- Returns:
- [RUN::scaler,HEL::scaler] banks
-
createBanks
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:
rawScalerBank
- RAW::scaler bankschema
- bank schemafcupTable
- /runcontrol/fcup CCDB tableslmTable
- /runcontrol/slm CCDB tablehelTable
- /runcontrol/helicity CCDB tableseconds
- duration between run start and current event- Returns:
- [RUN::scaler,HEL::scaler] banks
-
createBanks
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:
rawScalerBank
- RAW::scaler bankschema
- bank schemafcupTable
- /runcontrol/fcup CCDB tableslmTable
- /runcontrol/slm CCDB tablehelTable
- /runcontrol/helicity CCDB tablerst
- run start timeuet
- event time- Returns:
- [RUN::scaler,HEL::scaler] banks
-
createBanks
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
-