diff --git a/src/algorithms/calorimetry/CalorimeterClusterRecoCoG.cc b/src/algorithms/calorimetry/CalorimeterClusterRecoCoG.cc index 151483ac6..495fc927c 100644 --- a/src/algorithms/calorimetry/CalorimeterClusterRecoCoG.cc +++ b/src/algorithms/calorimetry/CalorimeterClusterRecoCoG.cc @@ -161,14 +161,15 @@ std::optional CalorimeterClusterRecoCoG::reconstruct(co // Used to optionally constrain the cluster eta to those of the contributing hits float minHitEta = std::numeric_limits::max(); float maxHitEta = std::numeric_limits::min(); - auto time = pcl.getHits()[0].getTime(); - auto timeError = pcl.getHits()[0].getTimeError(); + auto time = 0; + auto timeError = 0; for (unsigned i = 0; i < pcl.getHits().size(); ++i) { const auto& hit = pcl.getHits()[i]; const auto weight = pcl.getWeights()[i]; debug("hit energy = {} hit weight: {}", hit.getEnergy(), weight); auto energy = hit.getEnergy() * weight; totalE += energy; + time += (hit.getTime() - time) * energy / totalE; cl.addToHits(hit); cl.addToHitContributions(energy); const float eta = edm4hep::utils::eta(hit.getPosition());