I am very new to statistical mechanics, so this question might seem easy for you. I am reading from Blundell and Blundell's Concepts in Thermal Physics, and my question is from chapter $4$ (Temperature and Boltzmann factor)
We introduce temperature via the $\frac{1}{k_BT} = \frac{d\Omega}{dE}$. In the derivations $\Omega$ is always a function of $E$, which sounds sensible, but the it has less trivial consequence $P(E) \propto e^{\frac{E}{k_BT}}$ , probability that in a canonical ensemble, system (i.e not the reservoir) has energy $E$. This still sounds reasonable, especially given some more examples.
What I don't get is one example author gives , where assuming isothermal atmosphere, find the distribution of density of molecules at height $z$: $\propto e^{-\frac{mgz}{k_BT}}$. While reading the derivation and definition of temperature, author uses systems that are in thermal contact, and looks for energy of individual systems that maximizes microstates. But I thought $E$ for the definition temperature of Boltzmann distribution is a sort of "thermal energy" in its nature (e.g internal energy of ideal gas). But how can we use $E=mgz$ , because it looks like being a bit above has nothing to do with "hotness" or "coldness" (and this is obviously reference frame dependent), or in general what is allowed $E$ for relating temperature to energy.