HOWTO generate mix-in random trigger files

From GlueXWiki
Jump to: navigation, search

As described in other HOWTOs, we simulate the effect of detector noise and EM backgrounds in simulation by "mixing-in" or overlaying events collected by a non-physics trigger, usually a 100Hz "random" pulser that runs parallel but orthogonal to the main physics trigger. Generally we are using the randomtrigger_skim plugin to generate these mix-in background files. This plugin selects events collected by the random trigger described above, applies a fiducial cut on the electron beam to exclude triggers collected when the beam is off (which would not correctly represent the background), and writes the hit-level data for these events out in HDDM format.

The electron beam fiducial cut is determined by analyzing the output of the PS_flux plugin, which provides a measure of the PS coincidence rate over the run. This data and the corresponding fiducial thresholds are stored in the CCDB tables ELECTRON_BEAM/ps_counts and ELECTRON_BEAM/ps_counts_threshold.


Before 2021

Until then the trip map was read from the CCDB in the item /ELECTRON_BEAM/current_map_epics. This is a string that holds a table of times in seconds since the start of the run and the measured beam current. Up until now, this has been filled using values obtained from EPICS by scripts running in the counting house. To identify the time of any particular event from the ”start of the run” we use a timestamp from a 250 MHz clock that is recorded in each event. This clock is reset somewhere close in time to what RCDB thinks is the start of the run, but not exactly. There is a lag that includes the time between a human pressing “Prestart” and “Go” on the DAQ. To convert this 250MHz clock time into seconds, we use another CCDB item /ELECTRON_BEAM/timestamp_to_unix. This includes an offset and slope. The slope should always be the same since the 250 MHz clock is quite stable. The offset is trickier and the system for extracting it failed. Therefore, we want to use a different method from now on.

After 2021

The rate on the pair spectrometer is expected to give a good indication if the beam is on or off. Simply filling a histogram with PS coincidences whose x-axis is defined such that each bin corresponds to 1 second will generate the map we need. Such a histogram was defined in plugins/monitoring/PS_flux in halld recon and is called beamCurrentTime. The entries for each bin (corresponding to the rate of coincidences per second) are then converted to a string in the same format as before and stored in /ELECTRON_BEAM/ps_counts. It can then be used directly by DBeamCurrent_factory to check if the beam is on or not in pretty much the same way as before. The only thing that is left to determine is a threshold over which the beam is considered on. This should be done by examining the beamCurrentTime histograms. The recommended threshold is stored in the ccdb in /ELECTRON_BEAM/ps_counts_threshold and can be set via command line option BEAM_ON_MIN_PSCOUNTS.

Generation of flux histograms

It is best to start clean by setting both rcdb_250MHz_offset_tics and rcdb_start_time in /ELECTRON_BEAM/timestamp_to_unix in the ccdb to zero. Then run the PS flux plugin with the option USE_EPICS_FOR_BEAM_ON=1 and make sure that there is something stored in /ELECTRON_BEAM/current_map_epics in the ccdb. If there is nothing in the ccdb for this then just add ”0 200”. This makes sure a valid beam map is created and is necessary to generate the histograms needed to extract the PS based beam map. Starting from 2020 the rocID used to get the timestamp was changed to rocID = 34 (rocBCAL4). For the other beam times rocID = 0 should be used (EB). This can be done with the command line option SYNCSKIM:ROCID=0.


Generally the PS_flux analysis is run over skims of the PS trigger events, and the randomtrigger_skim is run over skims of the random trigger events, both of which are generated as part of the standard skimming processes. In the case that some skim files are missing or damaged, the raw data can be processed as well.

To disable the beam fiducial cut, use the command-line option RANDSKIM:USEBEAM=0.

Detailed scripts and instructions on how to run this process in detail will be provided at a later date.