Mesoscopic description of dynamical systems: Hierarchy of recursive equations for the moments of the density distribution with an application to charged particle beam dynamics