65.7. Using SBSReadout with the state manager

The SBS Readout program can be used with the state manager, and boot manager. This allows you to use the experiment configuration tool to define the elements of an experiment and to have the boot manager automatically create and destroy those elements as needed. When hooked to the state manager, the SBSReadout program will also start a run when the state manager indicates the state is Active, stop any active run when the state becomes Ready and exit if the state becomes NotReady.

The SBSReadout state manager interface is accomplished via the ReadoutStateHook Tcl package. This package starts up the Tcl state monitor API and registers interest in the Active Ready and NotReady states taking appropriate action when those states are entered. The interface also creates a onTriggerFail proc that gets control if the readout fails when the run is active.

The key to using this package is the --init-script command line option. When you describe the Readout program to the experiment configuration editor be sure to include an --init-script command line parameter that runs an initialization script that includes the ReadoutStateHook package.

If the DAQROOT environment variable is defined (by sourcing the daqsetup.bash), and if Readout is run under the boot manager, the example below will connect your readout program to the state manager:

Example 65-4. Script to attach SBSReadout to the state manager


set pkgDirs [file join $env(DAQROOT) TclLibs]
lappend auto_path $pkgDirs

package require ReadoutStateHook