was_injection()

was_injection( counter_id, timer_id, sample_time, counts_min, wait_time), wi()
This function is intended to be used at automatic beamshutter beamlines. It detects an injection and waits for the beam.

The timer timer_id is opened for sample_time. The function returns 0, if the beam was not lost in the meantime.

Counter counter_id (gated by timer timer_id) is used to monitor the beam. It is read after time intervals of 1 second, until sample_time is reached. The counter is never resetted by this function as long as the beam stays. If the count rate falls below counts_min, ONLINE waits for the beam (rate > counts_min). After a sufficient intensity was found, ONLINE waits again for wait_time seconds before control is returned. This allows the optical components to heat up.

The function returns 1, if there was an injection.

The user may interrupt the wait states by pressing the space bar. In this case ONLINE sets INTERRUPT_SCAN to 1 and sets the abort flag causing command files to be exited.

If ONLINE detects that the contents of counter_id is 0 when WI() is called, it resets all counters after the beam is back and repeats WI().

Note that there is a qualifier /AUTO_BEAM for fast scans which invokes a similar procedure.

e.g.:
* = wi(c1, t1, 15., 2500, 30)