program eventheader
use sep
implicit none
integer::n2,n1,i,j,n3,events
real::gx,gy,sx,sy
real,dimension(:,:),pointer::h1,h2
call sep_init()
call from_param('n',events,1)
call from_history('n2',n2)
call from_history('n3',n3)
call from_history('n1',n1)
call to_history('n1',n1+1)
call to_history('n2',n2*events)
call to_history('n3',1)

call sep_close()

allocate(h1(n1,n2),h2(n1+1,n2))
write(0,*) 'size(h1,1),size(h2,1)',size(h1,1),size(h2,1)
write(0,*) 'size(h1,2),size(h2,2)',size(h1,2),size(h2,2)
h1=0.;h2=0.
call sep_read(h1)
h2(1,:)=h1(1,:)
h2(2,:)=h1(2,:)

do i=1,events
   h2(3,:)=i
   call sep_write(h2)
end do
deallocate(h1,h2)
end program eventheader
