Study of a BGO calorimeter using electron and hadron beams from 1 to 50 GeV