Electromagnetic mass splittings of the low lying hadrons and quark masses from 2+1 flavor lattice QCD+QED