Is there a relationship between the energy of a photon and the energy of an electromagnetic wave? If the energy of a photon
$E_{p}=hv$
And the energy of an electromagnetic wave is
$E_{w}\propto \hat{\mathbf B}^2$
What is the relationship between $E_{w}$ and $E_{p}$?
 A: An experimentalists answer:
If you divide the energy of the electromagnetic wave by hv you will have the number of photons that are building up the electromagnetic wave.
A: You only need to rewrite $\mathbf B$ and $\mathbf E$ in terms of field $A_{\mu}$ (here $\hbar = c = 1$),
$$
\tag 1 \hat{\mathbf B} = [\nabla \times \hat{\mathbf A}], \quad \hat{\mathbf E} = -\frac{\partial \hat{\mathbf A}}{\partial t} - \nabla \hat{A}_{0}, 
$$ 
which is written as infinite "sum" of photons:
$$
\tag 2 A_{\mu} = \sum_{\lambda} \int \frac{d^{3}\mathbf p}{\sqrt{(2 \pi )^{3}2E_{\mathbf p}}}e_{\mu}^{\lambda}(\mathbf p )\left( \hat{a}_{\lambda}(\mathbf p )e^{-ipx} + \hat{a}_{\lambda}^{\dagger}(\mathbf p ) e^{ipx}\right).
$$ 
After that you can easily obtain the relation between energies of sets of photons and "real" EM field:
$$
\tag 3 \hat{H} = \int \hat{T}_{00}d^{3}\mathbf r = \int \frac{1}{2}\left( \hat{\mathbf B}^{2} + \hat{\mathbf E}^{2}\right)d^{3}\mathbf r.
$$ 
If you need I'll derive it.
Tedious derivation
For simplicity you need Coulomb gauge $A_{0} = 0, (\nabla \cdot \mathbf A) = 0$ (eq. $(3)$ already implies that), polarization sum rule and orthogonality relations for polarization vectors, 
$$
\sum_{\lambda}e_{i}^{\lambda}(\mathbf p)e_{j}^{\lambda}(\mathbf p) = \delta_{ij}, \quad (\mathbf e_{\lambda}(\mathbf p) \cdot \mathbf e_{\lambda'}(\mathbf p)) = \delta_{\lambda\lambda'}.
$$ 
and commutation relations 
$$
[\hat{a}_{\lambda}(\mathbf p), \hat{a}^{\dagger}_{\lambda {'}}(\mathbf k)] = \delta_{\lambda \lambda {'}}\delta (\mathbf p - \mathbf k), \quad [\hat{a}_{\lambda}(\mathbf p ), \hat{a}_{\lambda{'}}(\mathbf k)] = 0.
$$
First let's calculate $(1)$ by using $(2)$ ($E_{\mathbf p} = p_{0}$):
$$
\hat{\mathbf E}(x) = -\partial_{0}\hat{\mathbf A}(x) = i\sum_{\lambda}\int \frac{d^{3}\mathbf p}{\sqrt{2 (2 \pi )^{3}}}\mathbf e_{\lambda}(\mathbf p) \sqrt{E}_{\mathbf p}\left( \hat{a}_{\lambda}(\mathbf p )e^{-ipx} - \hat{a}^{\dagger}_{\lambda}(\mathbf p )e^{ipx}\right),
$$
$$
\hat{\mathbf B}(x) = [\nabla \times \hat{\mathbf A}] = i\sum_{\lambda}\int \frac{d^{3}\mathbf p}{\sqrt{(2 \pi )^{3}2E_{\mathbf p}}}[\mathbf p \times \mathbf e_{\lambda}(\mathbf p)]\left( \hat{a}_{\lambda}(\mathbf p )e^{-ipx} - \hat{a}^{\dagger}_{\lambda}(\mathbf p )e^{ipx}\right).
$$
Then 
$$
\int d^{3}\mathbf r \hat{\mathbf E}^{2} = -\sum_{\lambda , \lambda '}\int \frac{d^{3}\mathbf r d^{3}\mathbf p d^{3}\mathbf k}{(2 \pi )^{3}2}\sqrt{E_{\mathbf p}E_{\mathbf k}}(\mathbf {e}_{\lambda }(\mathbf p ) \cdot \mathbf {e}_{\lambda {'}}(\mathbf k )) \times 
$$
$$
\times \left( \hat{a}_{\lambda}(\mathbf p )e^{-ipx} - \hat{a}^{\dagger}_{\lambda}(\mathbf p )e^{ipx}\right) \left( \hat{a}_{\lambda {'}}(\mathbf k )e^{-ikx} - \hat{a}^{\dagger}_{\lambda {'}}(\mathbf k )e^{ikx}\right) = \left| \frac{1}{(2\pi )^{3}}\int d^{inx}d^{3}\mathbf r = \delta (\mathbf n) e^{in_{0}x_{0}}\right| = 
$$
$$
= -\sum_{\lambda , \lambda {'}}\frac{1}{2}\int d^{3}\mathbf p d^{3}\mathbf k \sqrt{E_{\mathbf p}E_{\mathbf k}}(\mathbf {e}_{\lambda }(\mathbf p ) \cdot \mathbf {e}_{\lambda {'}}(\mathbf k )) \times
$$
$$ \times \delta (\mathbf p + \mathbf k)\left( e^{ix_{0}(k_{0} + p_{0})}\hat{a}_{\lambda}(\mathbf p) \hat{a}_{\lambda {'}}(\mathbf k) + e^{-ix_{0}(k_{0} + p_{0})}\hat{a}^{\dagger}_{\lambda}(\mathbf p) \hat{a}^{\dagger}_{\lambda {'}}(\mathbf k) \right) +
$$
$$
+\sum_{\lambda , \lambda {'}}\frac{1}{2}\int d^{3}\mathbf p d^{3}\mathbf k \sqrt{E_{\mathbf p}E_{\mathbf k}}(\mathbf {e}_{\lambda }(\mathbf p ) \cdot \mathbf {e}_{\lambda {'}}(\mathbf k )) \times
$$
$$
\times \delta (\mathbf p - \mathbf k) \left( e^{ix_{0}(k_{0} - p_{0})}\hat{a}_{\lambda}(\mathbf p) \hat{a}^{\dagger}_{\lambda {'}}(\mathbf k) + e^{-ix_{0}(k_{0} - p_{0})}\hat{a}^{\dagger}_{\lambda}(\mathbf p) \hat{a}_{\lambda {'}}(\mathbf k)\right) = 
$$
$$
= -\frac{1}{2}\sum_{\lambda , \lambda {'}}\int d^{3}\mathbf p E_{\mathbf p}(\mathbf {e}_{\lambda }(\mathbf p ) \cdot \mathbf {e}_{\lambda {'}}(-\mathbf p )) \left( e^{2ip_{0}x_{0}}\hat{a}_{\lambda}(\mathbf p) \hat{a}_{\lambda {'}}(-\mathbf p) + e^{-2ix_{0}p_{0}}\hat{a}^{\dagger}_{\lambda}(\mathbf p) \hat{a}^{\dagger}_{\lambda {'}}(-\mathbf p) \right) +
$$
$$
\tag 4 + \frac{1}{2}\sum_{\lambda , \lambda {'}}\int d^{3}\mathbf p E_{\mathbf p}(\mathbf {e}_{\lambda }(\mathbf p ) \cdot \mathbf {e}_{\lambda {'}}(\mathbf p )) \left( \hat{a}_{\lambda}(\mathbf p) \hat{a}^{\dagger}_{\lambda {'}}(\mathbf p) + \hat{a}^{\dagger}_{\lambda}(\mathbf p) \hat{a}_{\lambda {'}}(\mathbf p) \right). 
$$
The same thing with $\int d^{3}\mathbf r\hat{\mathbf B}^{2}$ by using relation 
$$
([\mathbf p \times \mathbf e_{\lambda}(\mathbf p)] \cdot [\mathbf k \times \mathbf e_{\lambda {'}}(\mathbf k)]) = (\mathbf p \cdot \mathbf k)(\mathbf e_{\lambda}(\mathbf p) \cdot \mathbf e_{\lambda {'}}(\mathbf k)) - (\mathbf p \cdot \mathbf e_{\lambda}(\mathbf p)) (\mathbf k \cdot \mathbf e_{\lambda {'}}(\mathbf k)) = 
$$
$$
= (\mathbf p \cdot \mathbf k)(\mathbf e_{\lambda}(\mathbf p) \cdot \mathbf e_{\lambda {'}}(\mathbf k))
$$ 
can give
$$
\int d^{3}\mathbf r \hat{\mathbf B}^{2} = 
$$
$$
= \frac{1}{2}\sum_{\lambda , \lambda {'}}\int d^{3}\mathbf p E_{p}(\mathbf {e}_{\lambda }(\mathbf p ) \cdot \mathbf {e}_{\lambda {'}}(-\mathbf p )) \left( e^{2ip_{0}x_{0}}\hat{a}_{\lambda}(\mathbf p) \hat{a}^{\dagger}_{\lambda {'}}(-\mathbf p) + e^{-2ix_{0}p_{0}}\hat{a}^{\dagger}_{\lambda}(\mathbf p) \hat{a}_{\lambda {'}}(-\mathbf p) \right)
$$
$$
\tag 5 + \frac{1}{2}\sum_{\lambda , \lambda {'}}\int d^{3}\mathbf p E_{p}(\mathbf {e}_{\lambda }(\mathbf p ) \cdot \mathbf {e}_{\lambda {'}}(\mathbf p )) \left( \hat{a}_{\lambda}(\mathbf p) \hat{a}^{\dagger}_{\lambda {'}}(\mathbf p) + \hat{a}^{\dagger}_{\lambda}(\mathbf p) \hat{a}_{\lambda {'}}(\mathbf p) \right). 
$$
So after summation of $(4), (5)$ you will get that
$$
\hat{H} = \frac{1}{2}\sum_{\lambda , \lambda {'}}\int d^{3}\mathbf p (\mathbf {e}_{\lambda }(\mathbf p ) \cdot \mathbf {e}_{\lambda {'}}(\mathbf p )) E_{\mathbf p} \left(\hat{a}_{\lambda}(\mathbf p) \hat{a}^{\dagger}_{\lambda {'}}(\mathbf p) + \hat{a}^{\dagger}_{\lambda}(\mathbf p) \hat{a}_{\lambda {'}}(\mathbf p) \right) = 
$$
$$
\tag 6 \frac{1}{2}\sum_{\lambda}\int d^{3}\mathbf p E_{\mathbf p}\left(\hat{a}_{\lambda}(\mathbf p) \hat{a}^{\dagger}_{\lambda}(\mathbf p) + \hat{a}^{\dagger}_{\lambda}(\mathbf p) \hat{a}_{\lambda}(\mathbf p) \right) = \sum_{\lambda}\int d^{3}\mathbf p E_{\mathbf p}\left( \hat{a}_{\lambda}^{\dagger}(\mathbf p)\hat{a}_{\lambda}(\mathbf p) + \delta (0)\right).
$$
Eq. 6 implies "representation" of the energy of EM field as sum of energies of photons ($E_{\mathbf p} = \omega_{\mathbf p}$), because $\int d^{3}\mathbf p \hat{a}_{\lambda}^{\dagger}(\mathbf p)\hat{a}_{\lambda}(\mathbf p)$ refers to the particles number operator. 
