In my introduction to nucleons and particles (basic) course, we were given the following formula to compute the mass of mesons and baryons : \begin{eqnarray} M(\text{meson}) & = & m_1 + m_2 + A \frac{\vec{S}_1 \vec{S}_2}{m_1 m_2} \\ m(\text{baryon}) & = & m_1 + m_2 + m_3 + A \left( \frac{\vec{S}_1 \vec{S}_2}{m_1 m_2} + \frac{\vec{S}_1 \vec{S}_3}{m_1 m_3} \frac{\vec{S}_3 \vec{S}_2}{m_3 m_2}\right) \end{eqnarray}
$\vec{S}_1 \vec{S}_2 = \frac{1}{2} ( \vec{S}^2 - \vec{S}^2_1 - \vec{S}^2_2)$
$\vec{S}_1 \vec{S}_2 = \frac{1}{4} \hbar ^2$ for vector mesons $(s=1)$
$\vec{S}_1 \vec{S}_2 = - \frac{3}{4} \hbar ^2$ for pseudo-scalar mesons $(s=0)$
$A=160 \left( \frac{2 m_u}{\hbar} \right) Mev/c^2$.
I guess the small m's stand for the masses of the composing quarks.
Now what we got for an explanation isn't very clear to me. I understood that quarks are only like, $0.1 \%$ of the mass, and that the rest comes from the kinetic energy of the quarks and their confinement inside the nucleon.
What I don't get is:
1) how do we compute this ? (i.e., how do we know the spin of a meson ? And why are the values of $\vec{S}_1 \vec{S}_2$ such ?)
2) Where do these formula come from ?
I have no background in QFT.