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 SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic DaqScalerscreate(ConstantsManager conman, org.jlab.jnp.hipo4.data.Bank runConfig, org.jlab.jnp.hipo4.data.Bank rawScaler) static DaqScalerscreate(org.jlab.jnp.hipo4.data.Bank runScalerBank) static DaqScalerscreate(org.jlab.jnp.hipo4.data.Bank rawScalerBank, IndexedTable fcupTable, IndexedTable slmTable, IndexedTable helTable, double seconds) static DaqScalerscreate(org.jlab.jnp.hipo4.data.Bank rawScalerBank, IndexedTable fcupTable, IndexedTable slmTable, IndexedTable helTable, Date rst, Date uet) static DaqScalerscreate(org.jlab.jnp.hipo4.data.Bank rawScalerBank, IndexedTable fcupTable, IndexedTable slmTable, IndexedTable helTable, 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, IndexedTable fcupTable, IndexedTable slmTable, 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, IndexedTable fcupTable, IndexedTable slmTable, 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, IndexedTable fcupTable, IndexedTable slmTable, IndexedTable helTable, IndexedTable dscTable) Use scaler clock for run duration for Faraday cup offset correction.org.jlab.jnp.hipo4.data.BankcreateHelicityBank(org.jlab.jnp.hipo4.data.SchemaFactory schema) org.jlab.jnp.hipo4.data.BankcreateRunBank(org.jlab.jnp.hipo4.data.SchemaFactory schema) static doublegetSeconds(Date rst, Date uet) Get seconds between two dates assuming the differ by not more than 24 hours.longsetTimestamp(long timestamp) 
- 
Field Details- 
dsc2
- 
struck
 
- 
- 
Constructor Details- 
DaqScalerspublic DaqScalers()
 
- 
- 
Method Details- 
setTimestamp
- 
getTimestamppublic long getTimestamp()
- 
getSecondsGet 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- Parameters:
- runScalerBank- HIPO RUN::scaler bank
- Returns:
 
- 
createpublic static DaqScalers create(org.jlab.jnp.hipo4.data.Bank rawScalerBank, IndexedTable fcupTable, IndexedTable slmTable, 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:
 
- 
createpublic static DaqScalers create(org.jlab.jnp.hipo4.data.Bank rawScalerBank, IndexedTable fcupTable, IndexedTable slmTable, 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:
 
- 
createpublic static DaqScalers create(org.jlab.jnp.hipo4.data.Bank rawScalerBank, IndexedTable fcupTable, IndexedTable slmTable, IndexedTable helTable, 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:
 
- 
createpublic static DaqScalers create(ConstantsManager conman, org.jlab.jnp.hipo4.data.Bank runConfig, org.jlab.jnp.hipo4.data.Bank rawScaler) - Parameters:
- conman-
- runConfig-
- rawScaler-
- Returns:
 
- 
createRunBankpublic org.jlab.jnp.hipo4.data.Bank createRunBank(org.jlab.jnp.hipo4.data.SchemaFactory schema) - Parameters:
- schema- bank schema
- Returns:
- RUN::scaler banks
 
- 
createHelicityBankpublic org.jlab.jnp.hipo4.data.Bank createHelicityBank(org.jlab.jnp.hipo4.data.SchemaFactory schema) - Parameters:
- schema- bank schema
- Returns:
- HEL::scaler banks
 
- 
createBankspublic static List<org.jlab.jnp.hipo4.data.Bank> createBanks(org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Bank rawScalerBank, IndexedTable fcupTable, IndexedTable slmTable, IndexedTable helTable, IndexedTable dscTable) Use scaler clock for run duration for Faraday cup offset correction.- Parameters:
- rawScalerBank- RAW::scaler bank
- schema- bank schema
- fcupTable- /runcontrol/fcup CCDB table
- slmTable- /runcontrol/slm CCDB table
- helTable- /runcontrol/helicity CCDB table
- Returns:
- [RUN::scaler,HEL::scaler] banks
 
- 
createBankspublic static List<org.jlab.jnp.hipo4.data.Bank> createBanks(org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Bank rawScalerBank, IndexedTable fcupTable, IndexedTable slmTable, IndexedTable helTable, double seconds) Use user-defined seconds for run duration Faraday cup offset correction.- Parameters:
- rawScalerBank- RAW::scaler bank
- schema- bank schema
- 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
 
- 
createBankspublic static List<org.jlab.jnp.hipo4.data.Bank> createBanks(org.jlab.jnp.hipo4.data.SchemaFactory schema, org.jlab.jnp.hipo4.data.Bank rawScalerBank, IndexedTable fcupTable, IndexedTable slmTable, IndexedTable helTable, Date rst, Date uet) Use run start time and end times for run duration Faraday cup offset correction.- Parameters:
- rawScalerBank- RAW::scaler bank
- schema- bank schema
- 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
 
- 
createBankspublic 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
 
 
-