How do we determine the energy density of a given system? I have seen that the density operator
$$\rho~=~\frac{\exp(-\beta \hat{H})}{\text{tr}(\exp(-\beta \hat{H}))}.$$
What does this mean exactly and how does it relate to the pure and unpolarized states of a system? For example, given a system of relativistic spin-1/2 particles, the completely unpolarized beam density is $\sigma~=~\frac{1}{2} \left| \uparrow\right>\left<\uparrow \right|+\frac{1}{2} \left| \downarrow\right>\left<\downarrow \right|$ or
$$\sigma~=~\left( \begin{array}{cc} \frac{1}{2} & 0 \\ 0 & \frac{1}{2} \end{array} \right)$$
Are the diagonal elements the probabilities that within the ensemble a particular particle will be found to be in that spin state? If so, how does this affect the energy density of the system? I am not entirely sure what the Hamiltonian would be in this case. But I think that spin-up and spin-down are eigenstates with eigenvalues $ \lambda_{\pm}=\pm \frac{\hbar}{2}$, so as a guess, since we are talking about spin-projections, that the energy eigenvalues are going to be proportional to $\lambda_{\pm}$
$$\displaystyle \rho~=~\frac{1}{\text{e}^{-\frac{\beta\hbar}{2}} + \text{e}^{\frac{\beta\hbar}{2}}} \left( \begin{array}{cc} \text{e}^{\frac{\beta\hbar}{2}} & 0 \\ 0 & \text{e}^{-\frac{\beta\hbar}{2}} \end{array} \right) $$
where $\beta$ is the inverse of temperature given by $\beta=\frac{1}{kT}$, however I am not sure what the constant of proportionality will be since I am assuming that the Hamiltonian will be proportional to $\sigma_z$ and not equal to it.
Would it be possible to see an example or have an explanation of what is happening? I am referring to Sakurai's Modern Quantum Mechanics and Quantum Mechanics by Bransden and Joachain.