Hamiltonian analysis of beams in an optical slab guide