The cocenter of an affine Hecke algebra plays an important role in the study of representations of the affine Hecke algebra and the geometry of affine DeligneLusztig varieties (see for example, He and Nie in Compos Math 150(11):19031927, 2014; He in Ann Math 179:367404, 2014; Ciubotaru and He in Cocenter and representations of affine Hecke algebras, 2014). In this paper, we give a BernsteinLusztig type presentation of the cocenter. We also obtain a comparison theorem between the class polynomials of the affine Hecke algebra and those of its parabolic subalgebras, which is an algebraic analog of the HodgeNewton decomposition theorem for affine DeligneLusztig varieties. As a consequence, we present a new proof of the emptiness pattern of affine DeligneLusztig varieties (Grtz et al. in Compos Math 146(5):13391382, 2010; Grtz et al. in Ann Sci cole Norm Sup, 2012).