Fix the way to write beam particles in MCEventCollection for HepMC3 branch
Fix the way to write beam particles in MCEventCollection for HepMC3 branch.
Should fix https://its.cern.ch/jira/browse/AGENE-2097
This is a squashed version of !47919 (closed)