Comparison of large-angle production of charged pions with incident protons on cylindrical long and short targets