Updated trigger-filter with functionality to use beam current from RAW::epics or a detector raw multiplicity to select events with beam when scalers are unavailable
Created by: raffaelladevita
Addresses RG-M issue of missing scalers in the first part of the run.
The modifications include:
- trigger bit selection is now based on trigger masks, both to choose the bits that should be active and to veto bits that shouldn't be active;
- the source of the beam current information can be chosen between the DSC2 scaler readouts from RUN::scaler (default) or a current readout from RAW::epics (selected via the
-s pv-name
command line option); - in addition, a threshold on the minimum number of entries in a bank can be applied.
A few notes:
- Epics information is collected from tag-1 events, very similarly to the way scaler information is collected: here the code could be probably unified, creating a generic sequence class but it has not been attempted yet;
- The Epics information is ordered based on Unix time from RUN::config because in some data sets (including RG-M) the RUN::config.timestamp for events with the Epics bank is always equal to -1.
- Comparison of beam current from scalers and Epics suggests that the Epics readout available at a given time applies to an earlier time, with a delay of 1-2 s. For this reason, when choosing to use Epics information, the current threshold is not applied to a single readout but on the minimum within a window of -2 s : +4 s around the closest readout in time.