I'm studying how to calculate the density of states in the final configuration in order to apply Fermi golden rule. For free emEM field the following expression is the starting point: $$d^3n=\frac V {(2\pi\hbar)^3}d^3P$$ while for non zero-zero mass particle this expression is the starting point: $$d^3n=\frac V {(2\pi\hbar)^3}d^3P(2S+1)$$ where $S$ is the spin number and $2S+1$ are the different spin states. Can you explain me in which cases and why it is necessary to write the $2S+1$ factor in the formula? To me it looks strange that in one case we don't write it. Thank you