The CMS barrel calorimeter response to particle beams from 2 to 350 GeV/c