A comparison between semi-analytical gas cooling models and cosmological hydrodynamical simulations