Format of the data in the circular buffer between the builder and the recorder


The data in the circular buffer is made of a contigous list of YBOS data. In this page, the format of the list is specified. For the YBOS data, have a look to the YBOS banks inside farm package page.


A list is structured as a header of type farmbuffer_header, where:

events_in_buffer
Number of events in the list
data
The list of events
Each event is structured as the farmbuffer_event type, where:

length
Length of the event (in bytes, the length field excluded)
data
YBOS data (length bytes)

Each element starts imediately after the preceeding, i.e. you must jump length+sizeof(int) bytes


Follows an example on how to analyse the data comming from the circular buffer:

#include <rockmfarm.h>
#include <farmbuffer.h>
#include <farmyboslocate.h>
...
{
  int n;
  int events_in_buffer;
  char *this_evt;

  events_in_buffer = ((farmbuffer_header *)evt_buf)->events_in_buffer;
  this_evt = ((farmbuffer_header *)evt_buf)->data;

  for (n=0; n<events_in_buffer; n++)
    {
      int len = ((farmbuffer_event *) this_evt)->length;

      {
        int banklen,i;
        int *bankptr;

        yboslocateinit_((int *) ((farmbuffer_event *) this_evt)->data);
        yboslocate_((int *) ((farmbuffer_event *) this_evt)->data,"LRID",
                    &banklen,&bankptr);
        printf("Nrrun: %i Rectype: %i Banklen: %i\n",
               ((Lrid *) bankptr)->nrun,
               ((Lrid *) bankptr)->rectype,
               banklen);

        yboslocate_((int *) ((farmbuffer_event *) this_evt)->data,"EVCL",
                    &banklen,&bankptr);
        printf("Trignum: %i Banklen: %i\n",
               ((Evcl *) bankptr)->trignum,
               banklen);

        yboslocate_((int *) ((farmbuffer_event *) this_evt)->data,"CALR",
                    &banklen,&bankptr);
        printf("Banklen: %i\n",banklen);

        for (i=0; i<banklen; i++)
          {
           rockm_farm frame;
           unsigned int raw;


           raw = (unsigned int) (bankptr[i]);
           rockm_farm_raw2farm(raw,frame);

           printf("Chain: %i Crate: %i Slot: %i Chan: %i Data: %i %i\n",
                  frame.chain,frame.crate,frame.slot,frame.chan,
                  frame.res,frame.data);
          }

        yboslocatedone_((int *) ((farmbuffer_event *) this_evt)->data);
      }

      this_evt += len+sizeof(int);
    }
}
...

Top of the page. Farm documentation.
Send comments to: Stefano Miscetti or Igor Sfiligoi

Created:22.9.1997
Last modified:22.9.1997