A description of the pseudorapidity distributions in heavy ion collisions at RHIC and LHC energies