Production of J/psi and gamma mesons in pp collisions at root s=8 TeV