Is the "number of photons" of a system a Lorentz invariant? I'm wondering whether the number of photons of a system is a Lorentz invariant. Google returns a paper that seems to indicate that yes it's invariant at least when the system is a superconducting walls rectangular cavity.
However I was told in the hbar chatroom that it's not an invariant and it's proportional to the 1st term of the 4-momentum which is related to the Hamiltonian of the "free field theory".
Today I've talked to a friend who studies some GR (no QFT yet) and he couldn't believe that this number isn't Lorentz invariant.
So all in all I'm left confused. Is it a Lorentz invariant for some systems and not others? If so, what are the conditions that a system has to fulfil in order for the number of photons to be invariant?
 A: Alice prepares an electromagnetic field in a state with a sharp number of photons $\hat{N}|n\rangle=n|n\rangle$ where $\hat{N}$ is the number operator. Alice is boosted with respect to Bob. In Bob's reference frame the field is in state $\hat{U}(\Lambda)|n\rangle$. The question asks if a measurement of the number of photons for Bob's state gives the sharp answer $n$. In other words, is it true that $\hat{N}\hat{U}(\Lambda)|n\rangle=n\hat{U}(\Lambda)|n\rangle$? Bob will get the sharp result $n$ if the boost operator commutes with the number operator. We just need to show that the commutator $[\hat{U}(\Lambda),\hat{N}]_{-}=0$.
The number operator for photons of helicity $\lambda$ is,
\begin{equation}
\hat{N_{\lambda}}=\int \frac{d^{3}p}{2\omega}\hat{\eta}_{p\lambda}\hat{\eta}^{\dagger}_{p\lambda}
\end{equation}
where $\hat{\eta}_{p\lambda},\hat{\eta}^{\dagger}_{p\lambda}$ are emission and absorption operators respectively for a photon of momentum $p$ and helicity $\lambda$ (the notation for emission and absorption operators is from Dirac's monograph "Lectures on Quantum Field Theory"). We also have $\omega = p^{0}$ in the Lorentz invariant measure. 
Single photon states transform as,
\begin{equation}
\hat{U}(\Lambda)|p,\lambda\rangle=e^{-i\theta(p,\Lambda)}|\Lambda p,\lambda\rangle
\end{equation}
where $\theta(p,\Lambda)$ is the Wigner angle. Creating a single particle state from the vacuum $|S\rangle$ by $|p,\lambda\rangle=\hat{\eta}_{p\lambda}|S\rangle$ implies that the emission operators transform like states,
\begin{equation}
\hat{U}(\Lambda)\hat{\eta}_{p\lambda}=e^{-i\theta(p,\Lambda)}\hat{\eta}_{\Lambda p\lambda} \ .
\end{equation}
Taking the Hermitian conjugate, using unitarity, and replacing $\Lambda$ by $\Lambda^{-1}$,
\begin{eqnarray}
\hat{\eta}^{\dagger}_{p\lambda}\hat{U}^{\dagger}(\Lambda)&=&
e^{i\theta(p,\Lambda)}\hat{\eta}^{\dagger}_{\Lambda p\lambda}\\
\hat{\eta}^{\dagger}_{p\lambda}\hat{U}(\Lambda^{-1})&=&
e^{i\theta(p,\Lambda)}\hat{\eta}^{\dagger}_{\Lambda p\lambda}\\
\hat{\eta}^{\dagger}_{p\lambda}\hat{U}(\Lambda)&=&
e^{i\theta(p,\Lambda^{-1})}\hat{\eta}^{\dagger}_{\Lambda^{-1} p\lambda} \ .
\end{eqnarray}
Now evaluate the commutator,
\begin{eqnarray}
[\hat{U}(\Lambda),\hat{N}_{\lambda}]_{-}&=&
\int \frac{d^{3}p}{2\omega}\hat{U}(\Lambda)\hat{\eta}_{p\lambda}\hat{\eta}^{\dagger}_{p\lambda}-
\int \frac{d^{3}p}{2\omega}\hat{\eta}_{p\lambda}\hat{\eta}^{\dagger}_{p\lambda}\hat{U}(\Lambda)\\
&=&\int \frac{d^{3}p}{2\omega}e^{-i\theta(p,\Lambda)}\hat{\eta}_{\Lambda p\lambda}\hat{\eta}^{\dagger}_{p\lambda}-
\int \frac{d^{3}p}{2\omega}\hat{\eta}_{p\lambda}e^{i\theta(p,\Lambda^{-1})}\hat{\eta}^{\dagger}_{\Lambda^{-1} p\lambda} \ .
\end{eqnarray}
Make a change of variable in the second integral, $p'=\Lambda^{-1}p$.
\begin{equation}
[\hat{U}(\Lambda),\hat{N}_{\lambda}]_{-}=
\int \frac{d^{3}p}{2\omega}e^{-i\theta(p,\Lambda)}\hat{\eta}_{\Lambda p\lambda}\hat{\eta}^{\dagger}_{p\lambda}-
\int \frac{d^{3}p'}{2\omega'}\hat{\eta}_{\Lambda p'\lambda}e^{i\theta(\Lambda p',\Lambda^{-1})}\hat{\eta}^{\dagger}_{p'\lambda}
\end{equation}
The Wigner angle $\theta(p,\Lambda)$ corresponds to a rotation matrix $R(p,\Lambda)=H^{-1}_{\Lambda p}\Lambda H_{p}$ where $H_{p}$ is the standard boost. Now,
\begin{equation}
R(\Lambda p,\Lambda^{-1})=H^{-1}_{\Lambda^{-1}\Lambda p}\Lambda^{-1}H_{\Lambda p}=H^{-1}_{p}\Lambda^{-1}H_{\Lambda p}=
(H^{-1}_{\Lambda p}\Lambda H_{p})^{-1}=(R(p,\Lambda))^{-1}
\end{equation}
so that the Wigner angle $\theta(\Lambda p,\Lambda^{-1})$ is $-\theta(p,\Lambda)$. Upon putting this result into the last integral the commutator vanishes $[\hat{U}(\Lambda),\hat{N}_{\lambda}]_{-}=0$ and so Bob's electromagnetic field also has the same sharp number $n$ of photons as Alice's field.
Edit: Explanation of why the invariant measure appears in the number operator
The method of induced representations, which is used to get the response of the single particle states to a Lorentz boost (second equation in main text), is simplest if one chooses a Lorentz invariant measure so that the resolution of unity for the single particle states is,
\begin{equation}
\sum_{\lambda=\pm 1}\int \frac{d^{3}p}{2\omega}|p,\lambda\rangle\langle p,\lambda|=1 \ .
\end{equation}
This choice implies that the commutator for the emission and absorption operators is,
\begin{equation}
[\hat{\eta}^{\dagger}_{p\lambda},\hat{\eta}_{p'\lambda'}]_{-}=
\langle p,\lambda|p',\lambda'\rangle=
2\omega\delta_{\lambda,\lambda'}\delta^{3}(p-p') \ .
\end{equation}
In turn, this implies that the normal-ordered Hamiltonian for the free electromagnetic field is,
\begin{equation}
\hat{H}=\frac{1}{2}\int d^{3}p(\hat{\eta}_{p\lambda=-1}\hat{\eta}^{\dagger}_{p\lambda=-1}+\hat{\eta}_{-p\lambda=+1}\hat{\eta}^{\dagger}_{-p\lambda=+1}) \ .
\end{equation}
Now create $n$ photons from the vacuum with a state,
\begin{equation}
|\Psi\rangle=(\hat{\eta}_{p\lambda})^{n}|S\rangle
\end{equation} 
and demand that the number operator $\hat{N}_{\lambda}$ measures the sharp result $n$ on this state. This implies that the Lorentz invariant measure must be used in the definition of the number operator (first equation in main text). So, one sees that there are no assumptions here, just a choice of the invariant measure (instead of a quasi-invariant measure) to make the method of induced representations used to get the irreps of the Poincare group for massless particles as simple as possible. 
A: An experimentalist's answer.
There are innumerable experiments measuring two gamma events. Lorentz invariance is a basic assumption for all measured interactions. Each interaction is in a different Lorenz frame depending on the energies and momenta involved. When we make the distributions of crossections and angles, we depend on this invariance of the number of particles in the interaction under observation. As the standard model manages to fit all these to a very good approximation this assumption holds.
Now each individual photon is coming from a Lorenz invariant interaction by construction of electromagnetic interactions, even though nothing is recording it, so the numbers should stay constant.
For the numbers to change if the Lorenz frame changes for an ensemble of already created photons,  it means that the imposed Lorenz frame interacts somehow with the photons under observation. If energy is exchanged, more photons may appear which will look like non conservation of numbers, but should not be considered so.
A: I am not sure who is deleting my comments, arguments and critics challenging Mr. Blake's derivation. Just because we don't have enough reasoning to argue against an idea should never mean to erase that voice. As far as I know, science is not meant to be monopolized as the same is true with wealth.
In counting the number of photons in a system, we are limited by detection which in turn it is limited by Heisenberg Uncertainty Principle something that can never be overcome in Nature. Theoretically, a photon can have any non-zero energy over an infinitely wide spectrum. So, there is a non-zero probability of some photon having any particular energy. Let's not forget that photons are only one ingredient of the fundamental particles in Nature. This means that they can interact with at least every other charged fundamental particle of Standard Model including their self-interactions. (The interaction channels would exponentially increase as we go beyond Standard Model theories such as Extra Dimensions and Supersymmetry). All this being said, it is perfectly fine that photons get lost and/or created (through their interactions) and never be compensated in any given finite volume of our Universe (to be called system) during any finite period of time (within the finite age of Universe).Hence, being only one subset of all fundamental particles and having an infinitely long lifetime during which they have many interaction channels, their number will never be conserved in any finite volume of our Universe. However, it would be more challenging to generalize the question into, "whether the total number of all fundamental particles inside Visible Universe is conserved." To answer this one though, we need to know the Theory of Everything in which ALL fundamental particles are known including their lifetimes and masses and interaction channels along with the knowledge of Dark Matter and Dark Energy (accounting for 96% of Universe budget of matter and energy which are invisible as of today). So, I am certain that the answer to your question is, "No. Photons number in a finite volume known as system will never be conserved." And I would like to leave the more challenging one to future generations of physicists. 
