In particle physics, it is common to define the invariant mass $M$ of a system of $n$ particles with four-momenta $$p_i =(E_i, \vec{p}_i), \quad (i=1, \ldots n, \; p_i^2=E_i^2-\vec{p}_i^2=m_i^2),$$ by the Lorentz invariant quantity $$M^2:= \left(p_1+\ldots +p_n\right)^2=(E_1+\ldots +E_n)^2-(\vec{p}_1+\ldots+\vec{p}_n)^2.$$ In the case of two photons (where $E_1= |\vec{p}_1|$, $E_2=|\vec{p}_2|$), the invariant mass of this two-particle system is given by $$M^2=(p_1+p_2)^2=(|\vec{p}_1|+|\vec{p}_2|)^2-(\vec{p}_1+\vec{p}_2)^2.$$ In the reference frame where $\vec{p}_1 + \vec{p}_2=\vec{0}$ (the so-called center-of-mass frame), the invariant mass (squared) of the two-photon system becomes $$ M^2=4E_{\rm CM}^2$$ with $E_{\rm CM}:= |\vec{p}_1|=|\vec{p}_2|$.