An optical Hamiltonian experiment and the beam dynamics