The $q$-analog of Kostant's partition function and the highest root of the classical Lie algebras