In the context of statistical mechanics, the partition function ( Z ) is crucial because it:
A. Provides a measure of the system's total energy.
B. Helps to calculate the probability of different microstates.
C. Determines the entropy of the system.
D. Describes the wave function of a quantum system.