You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: read_besa_besa_header.m
    path of file: ./repos/bspm/thirdparty/spm12/external/fieldtrip/fileio/private
    
    the code of the file until where you have to start completion: 
function [header] = read_besa_besa_header(fname)
%% Reads BESA .besa format header information and skips data
% See formatting document <a href="matlab:web(http://www.besa.de/downloads/file-formats/)">here</a>
% 
% [alldata,file_info,channel_info,tags,events] = readbesa(fname)
% 
% inputs:
%  fname [string] - path to .besa file
% 
% outputs:

    
function event_obj = read_event_tag_trig(fid,trig_offset,trig_length, event_obj)
% Read data in the TRIG event tag block
% Loop through all tags in data section
while ~feof(fid) && ftell(fid) < (trig_offset+trig_length)
  [current_tag,current_length] = read_tag_offset_pair(fid);
  switch current_tag
    case 'CODE'
      % Event reaction code
      event_obj.reaction_code = fread(fid,1,'*int32');
    case 'TIME'
      % Event reaction time in seconds
      event_obj.reaction_time = fread(fid,1,'*single');
    case 'COMM'
      event_obj = read_event_tag_comm(fid,ftell(fid),current_length,event_obj);
    otherwise
      % Unrecognzed tag. Try to skip forward by offset
      warning('ReadBesaMatlab:WarningUnexpectedTag','Read unexpected tag [%s] at offset %d',current_tag,ftell(fid));
      if(fseek(fid,current_length,'cof') == -1)
        fclose(fid);
        error('ReadBesaMatlab:ErrorFseek','fseek to %d failed (after unexpected tag in [BEVT:TRIG]))',current_length);
      end