Optimization of clustering algorithms for the reconstruction of events started by a 1 GeV photon beam in a segmentated BGO calorimeteter