Based on the given buffer name provided at the startup time through the -b buffer_name argument, the mevb task will scan all the equipments and handle the building of an event based on the identical buffer name found in the equipment list if the frontend equipment type includes the EQ_EB flag .
Frontend code: /* The frontend name (client name) as seen by other MIDAS clients */ char *frontend_name = "ebfe"; ... EQUIPMENT equipment[] = { {"Trigger", /* equipment name */ 1, TRIGGER_ALL, /* event ID, trigger mask */ "BUF", /* event buffer */ EQ_POLLED | EQ_EB, /* equipment type + EQ_EB flag <<<<<< */ LAM_SOURCE(0, 0xFFFFFF), /* event source crate 0, all stations */ "MIDAS", /* format */
Once the frontend is started with -i 1 , the Midas client name, equipment name and buffer name will be modified.
> ebfe -i 1 -D ... odbedit [local:midas:S]/Equipment>ls Trigger01 [local:midas:S]Trigger01>ls -lr Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- Trigger01 DIR Common DIR Event ID WORD 1 2 18h 0 RWD 1 Trigger mask WORD 1 2 18h 0 RWD 65535 Buffer STRING 1 32 18h 0 RWD BUF01 Type INT 1 4 18h 0 RWD 66 Source INT 1 4 18h 0 RWD 16777215 Format STRING 1 8 18h 0 RWD MIDAS Enabled BOOL 1 4 18h 0 RWD y Read on INT 1 4 18h 0 RWD 257 Period INT 1 4 18h 0 RWD 500 Event limit DOUBLE 1 8 18h 0 RWD 0 Num subevents DWORD 1 4 18h 0 RWD 0 Log history INT 1 4 18h 0 RWD 0 Frontend host STRING 1 32 18h 0 RWD hostname Frontend name STRING 1 32 18h 0 RWD ebfe01 Frontend file name STRING 1 256 18h 0 RWD .../eventbuilder/ebfe.c ...
Independently of the event ID, each fragment frontend will send its data to the composed event buffer (BUFxx). The event builder task will make up a list of all the equipment belonging to the same event buffer name (BUFxx). If multiple equipments exists in the same frontend, the equipment type (EQ_EB) and the event buffer name will distinguish them.
The Event Builder flowchart below shows a general picture of the event process cycle of the task. The Event Builder runs in polling mode over all the source buffers collected at the begin of run procedure. Once a fragment has been received from all enabled source ("../Settings/Fragment Required y"), an internal event serial number check is performed prior passing all the fragment to the user code. Content of each fragment can be done within the user code for further consistency check.
[local:midas:S]EB>ls -lr Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- EB DIR Common DIR Event ID WORD 1 2 5m 0 RWD 1 Trigger mask WORD 1 2 5m 0 RWD 0 Buffer STRING 1 32 5m 0 RWD SYSTEM Type INT 1 4 5m 0 RWD 0 Source INT 1 4 5m 0 RWD 0 Format STRING 1 8 5m 0 RWD MIDAS Enabled BOOL 1 4 5m 0 RWD y Read on INT 1 4 5m 0 RWD 0 Period INT 1 4 5m 0 RWD 0 Event limit DOUBLE 1 8 5m 0 RWD 0 Num subevents DWORD 1 4 5m 0 RWD 0 Log history INT 1 4 5m 0 RWD 0 Frontend host STRING 1 32 5m 0 RWD hostname Frontend name STRING 1 32 5m 0 RWD Ebuilder Frontend file name STRING 1 256 5m 0 RWD c:\...\ebuser.c Variables DIR Statistics DIR Events sent DOUBLE 1 8 3s 0 RWDE 944 Events per sec. DOUBLE 1 8 3s 0 RWDE 0 kBytes per sec. DOUBLE 1 8 3s 0 RWDE 0 Settings DIR Number of Fragment INT 1 4 9s 0 RWD 2 User build BOOL 1 4 9s 0 RWD n User Field STRING 1 64 9s 0 RWD 100 Fragment Required BOOL 2 4 9s 0 RWD [0] y [1] y
eb> setenv MIDASSYS /home/midas/midas-1.9.5 eb> make cc -g -I/usr/local/include -I../../drivers -DOS_LINUX -Dextname -c ebuser.c cc -g -I/usr/local/include -I../../drivers -DOS_LINUX -Dextname -o mevb mevb.c \ ebuser.o /usr/local/lib/libmidas.a -lm -lz -lutil -lnsl cc -g -I/usr/local/include -I../../drivers -DOS_LINUX -Dextname \ -c ../../drivers/bus/camacnul.c cc -g -I/usr/local/include -I../../drivers -DOS_LINUX -Dextname -o ebfe \ ebfe.c camacnul.o /usr/local/lib/mfe.o /usr/local/lib/libmidas.a \ -lm -lz -lutil -lnsl eb>
xterm1: eb> ebfe -i 1 xterm2: eb> ebfe -i 2 xterm3: eb> mevb -b BUF xterm4: eb> odbedit [local:Default:S]/>ls System Programs Experiment Logger Runinfo Alarms Equipment [local:Default:S]/>scl N[local:midas:S]EB>scl Name Host ebfe01 hostname ebfe02 hostname ODBEdit hostname Ebuilder hostname [local:Default:S]/> [local:Default:S]/>start now Starting run #2