Beamtest03 Data File Format

Below we describe the way data is written to files on disk; "buf" is a pointer to an array of "count" bytes. The data from the DDU is written to this array with the first byte as the lowest byte. Data in the buf array is written to disk in either ASCII or binary form.

 

  • Data at the beamtest is read out from the DDU via gigabit Ethernet. Due to beam conditions, sometimes this readout is not fast enough to keep up and some events get corrupted in transfer, so the unpack routines must be able to handle this case; e.g. see the eop2 routine.
  • There are some unique identifiers (constants) set within the DDU Output Data Format. The best two are Beginning of Event (BOE) and End of Event (EOE). The BOE code is actually the 2nd DDU word in the event (also called "DDU Header 2"). The EOE code is the 3rd-to-last word of the event (called "DDU Trail-2" where the "-" is read as "minus"). It is best to use the EOE as the unique marker.
  •         DDU-bit-63....to.....DDU-bit-0
    BOE:       8000 0001 8000 800X     (as read in hex, X=unspecified)
    EOE:       8000 FFFF 8000 8000     (as read in hex)

     

    ASCII data files

    The buf array is written to disk in the following loop:

    for(i=0;i<count/8;i++)fprintf(fp_data,"%d   %04x %04x %04x %04x\n",i+1,buf[4*i+3]&0xffff,buf[4*i+2]&0xffff,buf[4*i+1]&0xffff,buf[4*i]&0xffff);

    In this case the first line for every new event should start with the string "1   50" but this is not guaranteed to be unique.

     

    Binary data files

    The buf array is written to disk as a block write using the following command:

     write(fb_data,buf,count);
     

     


    Revision Summary: