From d263b95b5827827429ae6bc2ccc52546b0911323 Mon Sep 17 00:00:00 2001 From: Clement Helsens Date: Mon, 15 Mar 2021 20:42:13 +0100 Subject: [PATCH] Fix energy --- converter/src/DelphesEDM4HepConverter.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/converter/src/DelphesEDM4HepConverter.cc b/converter/src/DelphesEDM4HepConverter.cc index 686d5aba..8a9f7f03 100644 --- a/converter/src/DelphesEDM4HepConverter.cc +++ b/converter/src/DelphesEDM4HepConverter.cc @@ -219,7 +219,9 @@ void DelphesEDM4HepConverter::processTracks(const TClonesArray* delphesCollectio auto cand = particleCollection->create(); cand.setCharge(delphesCand->Charge); const auto momentum = delphesCand->P4(); - cand.setEnergy(momentum.E()); + //Particle masses in Delphes are 0, so the energy should be recalculated if ones sets the mass to something else + //cand.setEnergy(momentum.E()); + cand.setEnergy(sqrt(momentum.Px()*momentum.Px() + momentum.Py()*momentum.Py() + momentum.Pz()*momentum.Pz()) + trackMass*trackMass); cand.setMomentum({(float) momentum.Px(), (float) momentum.Py(), (float) momentum.Pz()}); // At this point indiscriminantly set the mass for each track. If this is a // muon or an electron, the mass will be set to the appropriate value later.