62.3. EVBC state manager callback bundle.

This provides the simplest and preferred way to incorporate the event builder into your experiment. The callback bundle works with the ReadoutGUI's state machine and thus makes the most sense to use in the context of the ReadoutGUI. In this context, you should rely on the RingSourceMgr to manage your ringFragmentSources rather than explicitly calling procs like startRingSource. Together, the event builder and RingSourceMgr callback bundles provide robust error recovery in a way that requires no extra effort from the user. i

While the 3evb manpage provides reference information, a short example is provided below for using this mechanism with an event builder for which building is enabled, with a correlation window 10 clock ticks wide, and output ring named fox and Two ring data sources from rings fox1 and fox2.

Example 62-1. Using the EVBC state manager callback bundle


package require evbcallouts                   (1)

EVBC::useEventBuilder                    (2)

proc OnStart {} {                            (3)
    EVBC::configure -gui 1 -destring foxy -glombuild 1 -glomdt 10 (4)
}

EVBC::registerRingSource tcp://localhost/fox1 stampextractor.so 1 {Source 1} 0 1 (5)
EVBC::registerRingSource tcp://localhost/fox2 {} 2 {Source 2} 1 1 (6)
            
(1)
Incorporates the package code into your script. This makes all three APIs visible and accessible from your script.
(2)
Informs the state manager that you will be using the event builder. This call registers the event builder with the state manager which calls the event builder bundle's initializatiuon entry. It also registers the RingSourceMgr callback bundle.
(3)
The OnStart proc is called from the ReadoutGUI when it makes a transition to the Halted state from NotReady.
(4)
ys the event builder to enable its user interface, place the output of the last stage of the building pipeline in the local ring named foxy, enable event building by the glom stage of the pipeline with a correlation window of 10 clock ticks.
(5)
This line adds an event sources using the convenience function EVBC::registerRingSource to start a ring data source. This ring data source is provided a timestamp extractor library to deal with data that is not already labeled with timestamps. The fifth and sixth positional parameters dictate that data may arrive without timestamps and that the ring source should exit after it has observed a symmetric number of begin and end run items.
(6)
This line adds an event sources using the convenience function EVBC::registerRingSource. The ring data source is passed an empty string for the timestamp extractor argument because all of the ring items are expected to already be labeled with timestamps. The fifth and sixth positional parameters dictate that data must arrive with timestamps and that the ring source should exit after it has observed a symmetric number of begin and end run items.