Commit f817f061 authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

Avoid nan momentum in low energy neutrals with energy < mass

parent 84118b25
......@@ -203,7 +203,7 @@ private:
const eic::ConstCluster* optional_hclus, const double mass,
const int32_t pid, const eic::Index& newID) const {
const float energy = (optional_hclus) ? eclus.energy() + optional_hclus->energy() : eclus.energy();
const float momentum = sqrt(energy * energy - mass * mass);
const float momentum = energy < mass ? 0 : std::hypot(energy, mass);
const eic::VectorPolar p{momentum, eclus.position().theta(), eclus.position().phi()};
// setup our particle
eic::ReconstructedParticle part;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment