Make BeamDistributionItem::setDistributionGroupItem a template to reduce the need for casting and improve type safety