  We study Hilbert schemes of points on a smooth projective Calabi-Yau 4-fold
$X$. We define $\mathrm{DT}_4$ invariants by integrating the Euler class of a
tautological vector bundle $L^{[n]}$ against the virtual class. We conjecture a
formula for their generating series, which we prove in certain cases when $L$
corresponds to a smooth divisor on $X$. A parallel equivariant conjecture for
toric Calabi-Yau 4-folds is proposed. This conjecture is proved for smooth
toric divisors and verified for more general toric divisors in many examples.
  Combining the equivariant conjecture with a vertex calculation, we find
explicit positive rational weights, which can be assigned to solid partitions.
The weighted generating function of solid partitions is given by
$\exp(M(q)-1)$, where $M(q)$ denotes the MacMahon function.
