The HEZ coordinate system is defined as follows:
The direction of the H component points to the magnetic north at setting time of the magnetometer.
The direction of the Z component vertically points to the downward.
The direction of the E component is perpendicular to H and Z and points to the eastward.