EPICS IOC "LM20"
in the IR-2 mezzanine
This page describes operation of the PEP-II Bunch-by-Bunch Luminosity Monitor located in the IR-2 mezzanine (currently in a temporary rack), which operates by counting radiative Bhabhas at the BaBar IP. Counts are summed by a CAMAC scaler module, and transferred to a VME micro which runs an EPICS state program to process the raw data into a more useful form for display and further analysis.
More details here.
The BxB Luminosity Monitor VME & CAMAC hardware is driven by an EPICS State Notation Language (SNL) program, implemented as two interdependent state sets dubbed "lumi_scan" and "lumi_proc". The scan thread handles interactions with the CAMAC hardware via a Hytec VSD 2992 Serial Highway Link Driver, and the proc thread processes the resulting array of counts to produce EPICS process variables. Buffer hand-off between the two is mediated by a pair of internal event flags. See the source code here.
state set lumi_scan:
|state scan_init||one-time (startup) init|
|state scan_reset||soft reset processing|
|state scan_idle||idle wait (not running)|
|state scan_run_init||one-time run init|
|state scan_setup_loop||once per full-scan init|
|state scan_setup_pass||once per even/odd pass init|
|state scan_setup_scaler||once per scaler-read init|
|state scan_wait_rawbuf||wait for raw-data buffer free|
|state scan_wait_lam||wait for CAMAC LAM interrupt|
|state scan_read_scaler||read out scaler data,
insert into interleaved raw array
|state scan_dispatch||dispatch to appropriate next state|
|state scan_lam_timeout||LAM timeout error-handler|
state set lumi_proc:
|state proc_init||one-time (startup) init|
|state proc_reset||soft reset processing|
|state proc_idle||wait for raw buffer from scan thread;
check for beam on
|state proc_proc2||check HB60:FILL:GOAL|
|state proc_proc3||correlate data with fill goal to find offset|
|state proc_proc4||find data min/max & total count|
|state proc_proc5||make normalized & specific lum arrays
calc previous/next slope
|state proc_abort||abort-processing for previous states|
|state proc_done||cleanup; publish arrays|
|state proc_donedone||dispatch to appropriate next state|
The luminosity monitor EPICS database consists of three separate files; the 3rd one is loaded multiple times, once for each distinct plot type (norm, spec, raw, and p/n). Click on the following links to see graphic representations:
camacLumPlot.db: waveform/subarray records for plots
Also, bic.all_pv contains a list of BIC PVs, including LM20 PVs.
Here are the actual DB files.
Displays are implemented in DM2K.
Click on each of the following images to see the full-size version.
The initial display provides access to two commonly-used luminosity plots and a control panel:
Normalized Lum Plot produces a 6-row plot of the entire 3492-bucket normalized-luminosity array:
Similarly, Specific Lum Plot brings up the specific-luminosity array:
The Controls button opens a read-only control window, which displays operating parameters without allowing for modifications:
Clicking on the blue "-> expert" button takes you to the "expert" control panel, which supports modification of luminosity monitor operating parameters (see TBD):
In the top left corner are three buttons which control the operating mode of the monitor. Pushing the top one toggles between Running and Stopped; the two buttons below determine which mode the system will run in, and are only sampled at the time the top button is flipped from stopped to running:
|upper button||lower button||
|Scaler||Single||Read a single scaler's worth of lum, and stop|
|Scaler||Loop||Read a single scaler's worth of lum, repeat|
|Full||Single||Read all buckets, and stop|
|Full||Loop||Read all buckets, repeat|
The "Scaler" modes update the display that is reachable via the "Scaler (32)" button just below the mode buttons; the main displays will not update while running in this mode.
The yellow Reset button in the upper right corner will reset internal parameters to start-up values, and only functions when the monitor is stopped.
Along the left edge of the expert control panel are three light-green buttons that lead to yet more displays; Raw Data serves up the raw luminosity counts as they were read from the scaler, without any processing; note that, unlike the others, these are autoscaled plots and thus may not use the same scale from one row to the next:
The P/N Slope button provides a look at the internal "previous/next slope" array, a measure of how well luminosity sampling is centered on the RF buckets... ideally all values in this array would be zero or very close to it, but in the real world one is likely to see some divergence:
The Scaler button is only useful when the monitor is in scaler mode (see above); it displays counts being directly read out of the scaler, limited to 2Hz updates so as not to swamp the network. Note that these are raw counts, and also represent every other bucket (all even, or all odd) starting at the requested bucket number, as the hardware is not fast enough to capture successive buckets in real-time:
The Stats/Reboot button leads to a display of internal VxWorks status, specifically the %used File Descriptors, Memory, and CPU. Typical values are shown below. Pushing the red REBOOT IOC button will result in a hard reboot of the IOC (via LM20:REBOOT.PROC).
About three hours, showing previous & next bucket averages (dark & light blue) at the bottom, raw and smoothed prev/next slope (brown & green), and the fine-delay adjustment LM20:PNR:DLY34_ADJ (purple). Also visible at the bottom is the correlation between raw data and the fill goal (brown). Luminosity is displayed by PB60:LUM:MEDFVAL (black) and LM20:DATA:LUM:SUM (yellow).
About three days, showing typical 24-hour excursions of the fine-delay offset (purple) due to diurnal temperature-related variations in beam phase.
Here we see the effect of having a quantized (ie. integer) fine-delay... the wiggling of the raw & smoothed prev/next slope (brown/green) shows how the monitor will occasionally oscillate between two adjacent offsets (purple).