ebuser.c File Reference

Go to the source code of this file.

Functions

INT eb_begin_of_run (INT, char *, char *)
INT eb_end_of_run (INT, char *)
INT eb_user (INT nfrag, EBUILDER_CHANNEL *ebch, EVENT_HEADER *pheader, void *pevent, INT *dest_size)


Function Documentation

INT eb_begin_of_run INT  ,
char *  ,
char * 
 

The Event builder user file.

file ebuser.c

Referenced by tr_prestart().

INT eb_end_of_run INT  rn,
char *  error
 

Hook to the event builder task at completion of event collection after receiving the Stop transition.

Parameters:
rn run number
error error string to be passed back to the system.
Returns:
EB_SUCCESS

Referenced by main().

INT eb_user INT  nfrag,
EBUILDER_CHANNEL *  ebch,
EVENT_HEADER pheader,
void *  pevent,
INT *  dest_size
 

Hook to the event builder task after the reception of all fragments of the same serial number. The destination event has already the final EVENT_HEADER setup with the data size set to 0. It is than possible to add private data at this point using the proper bank calls.

The ebch[] array structure points to nfragment channel structure with the following content:

typedef struct {
    char  name[32];         // Fragment name (Buffer name).
    DWORD serial;           // Serial fragment number.
    char *pfragment;        // Pointer to fragment (EVENT_HEADER *)
    ...
} EBUILDER_CHANNEL;

The correct code for including your own MIDAS bank is shown below where TID_xxx is one of the valid Bank type starting with TID_ for midas format or xxx_BKTYPE for Ybos data format. bank_name is a 4 character descriptor. pdata has to be declared accordingly with the bank type. Refers to the ebuser.c source code for further description.

It is not possible to mix within the same destination event different event format!

  // Event is empty, fill it with BANK_HEADER
  // If you need to add your own bank at this stage 
  
  bk_init(pevent);
  bk_create(pevent, bank_name, TID_xxxx, &pdata);
  *pdata++ = ...;
  *dest_size = bk_close(pevent, pdata);
  pheader->data_size = *dest_size + sizeof(EVENT_HEADER);

For YBOS format, use the following example.

  ybk_init(pevent);
  ybk_create(pevent, "EBBK", I4_BKTYPE, &pdata);
  *pdata++ = 0x12345678;
  *pdata++ = 0x87654321;
  *dest_size = ybk_close(pevent, pdata);
  *dest_size *= 4;
  pheader->data_size = *dest_size + sizeof(YBOS_BANK_HEADER);

Parameters:
nfrag Number of fragment.
ebch Structure to all the fragments.
pheader Destination pointer to the header.
pevent Destination pointer to the bank header.
dest_size Destination event size in bytes.
Returns:
EB_SUCCESS

Definition at line 137 of file ebuser.c.

Referenced by source_scan().

INT ebuser INT  ,
EBUILDER_CHANNEL *  ,
EVENT_HEADER ,
void *  ,
INT * 
 


Variable Documentation

INT lModulo = 100
 

Global var for testing.

Definition at line 45 of file ebuser.c.

Referenced by eb_begin_of_run(), and eb_user().


Midas DOC Version 1.9.3 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Suzannah Daviel - Doxygen - Peter Green - Greg Hackman - Gertjan Hofman - Paul Knowles - Rudi Meier - Glenn Moloney - Dave Morris - Konstantin Olchanski - Renee Poutissou - Andreas Suter - Piotr Adam Zolnierczuk