Event Builder Functions

Midas supports event building operation through a dedicated mevb task application. Similar to the Midas Frontend application, the mevb task application requires the definition of an equipment structure which describes its mode of operation. The set of parameter for this equipment is limited to:

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 .

Principle of the Event Builder and related frontend fragment

Possibly in case of multiple frontend, the same "fragment" code may run in the different hardware frontend. In order to prevent to build nFragment different frontend task, the -i index provided at the start of the frontend will replicate the same application image with the necessary dynamic modification required for the proper Event Building operation. The "-i index" argument will provide the index to be appended to the minimal set of parameter to distinguish the different frontends. These parameters are:

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.

Event Builder Flowchart.
eventbuilder.jpg

Event builder Tree

The Event builder tree will be created under the Equipment list and will appear as a standard equipment. The sub tree /Common will contains the specific setting of the equipment while the /Variables will remain empty. /Settings will have particular parameter for the Event Builder itself. The User Field is an ASCII string passed from the ODB to the eb_begin_of_run() which can be used for steering the event builder.

[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 Operation

Using the "eb>" as the cwd for the example, the test procedure is the following: cwd : midas/examples/eventbuilder -> refered as eb>


Midas DOC Version 1.9.5 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk